|
Forum Index : Microcontroller and PC projects : PWM pins required
| Author | Message | ||||
| G.B.P. Newbie Joined: 13/08/2014 Location: AustraliaPosts: 16 |
I am experimenting with the MM Plus with a project that requires to use 4 out of the 5 PMW connections. Additionally, the use of both the Touch and SD Card access on the LCD screen used (SSD1963) are also required. Is there any possibility to allocate different pin to either the DB3 or T_DO so that one of the 2 PWM (pins63 or pin47) can be made free? Thanks |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10566 |
DB3 No: otherwise the bus for parallel transfer to the display is compromised T_DO is possible with a CFunction that re-allocates SPI2IN to a different pin using peripheral pin select capability of the MX470. The only possible alternate pins are 51, 32, and 1 (1 would need checking) |
||||
| G.B.P. Newbie Joined: 13/08/2014 Location: AustraliaPosts: 16 |
Thanks matherp Unfortunately CFunction are beyond my expertise Pin 1 is shown as being reserved for the data transfer as DB5, therefore it should also not be available. Will need to revert to the smaller ILI9341 screen then |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10566 |
Sorry - me misreading the datasheet. 13 and 15 would also be OK but not 1. Happy to knock up a CFunction for you if it is important |
||||
| G.B.P. Newbie Joined: 13/08/2014 Location: AustraliaPosts: 16 |
If not too much of a job, this would be of great help.. I could get away in not using the SD Card, as this is required just to load images but the Touch control is a must for all adjustment's required in the program. Thanks |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10566 |
Touch and SD both use the SPI2IN pin so both would be affected by the change. Pick one of the pins I identified above and I'll knock something up for you to test |
||||
| G.B.P. Newbie Joined: 13/08/2014 Location: AustraliaPosts: 16 |
Great! Probably best is Pin 14.. I am sure that such routine will come handy for many users. Thank You . |
||||
| G.B.P. Newbie Joined: 13/08/2014 Location: AustraliaPosts: 16 |
Hoops! Pin 32 |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10566 |
No promises as completely untested as I don't have a 64-pin MM+ sub MM.STARTUP remap() end sub ' CSub remap 00000000 27BDFFE8 AFBF0014 AFB00010 3C109D00 8E020010 24040020 24050002 0040F809 00003021 8E020010 24040020 24050064 0040F809 00003021 3C02BF81 8C43FA90 24040002 7C831804 AC43FA90 8FBF0014 8FB00010 03E00008 27BD0018 End CSub include in the library and then reset and the SPI2IN should be remapped to pin 32. |
||||
| WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2959 |
Why not Would it prove useful if I send you one for testing these kind of things on? |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10566 |
Forgot to free up pin 47 to be re-allocated in the previous version. Try: CSub remap 00000000 27BDFFE8 AFBF0014 AFB00010 3C109D00 8E020010 24040020 24050002 0040F809 00003021 8E020010 24040020 24050064 0040F809 00003021 3C02BF81 8C43FA90 24040002 7C831804 AC43FA90 8E020088 AC4000BC 8FBF0014 8FB00010 03E00008 27BD0018 End CSub This is now tested and seems to work. |
||||
| panky Guru Joined: 02/10/2012 Location: AustraliaPosts: 1116 |
@matherp Very interesting Peter - would it be possible to post the C code for us to peruse and learn? Thanks, Doug. ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
| G.B.P. Newbie Joined: 13/08/2014 Location: AustraliaPosts: 16 |
Thank you motherp. I have the SSD1963 on order.. waiting for it to arrive now |
||||
bigmik![]() Guru Joined: 20/06/2011 Location: AustraliaPosts: 2971 |
Quite an appropriate Typo.. Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10566 |
#define Version 101 //Version 1.01 #define _SUPPRESS_PLIB_WARNING // required for XC1.33 Later compiler versions will need PLIB to be installed #include <plib.h> // the pre Harmony peripheral libraries #include "../cfunctions.h" #define SPI_INP_PIN_NEW 32 #define SPI_PPS_OPEN { PPSInput(2, SDI2, RPF5);} void remap (void) { ExtCfg(SPI_INP_PIN, EXT_DIG_IN, 0); ExtCfg(SPI_INP_PIN, EXT_RESERVED, 0); SPI_PPS_OPEN ExtCurrentConfig[47]=EXT_NOT_CONFIG; 'pin 47 is F5 } void main(void){ } |
||||
| panky Guru Joined: 02/10/2012 Location: AustraliaPosts: 1116 |
Thanks Peter, Doug. ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
| G.B.P. Newbie Joined: 13/08/2014 Location: AustraliaPosts: 16 |
Hi matherp (<- this time correct... apologies Peter! )I finally received the SSD1963 display and after setting up the LCD with the MM+ Explore 64, I ran the program including your CSub and with the connection to pin 47 transferred to pin 32.. The program hangs immediately after searching for the starting BMP image.. Option autorun on SetPin 22, ain CLS LCDLight = 100 VAR restore Load Image "HUD2.BMP" Do:Loop Until Touch(down)=1 Load Image "HUD3.BMP" etc....... The following message received: > [6] Load Image "HUD2.BMP" Error: SD card not found > LCD options set as below: > Micromite Plus MMBasic Ver 5.04.05 Copyright 2011-2017 Geoff Graham > > option list OPTION AUTORUN ON OPTION LCDPANEL SSD1963_4, LANDSCAPE, 50, 49 OPTION TOUCH 18, 21 OPTION SDCARD 12, 14 > > memory Flash: 3K ( 2%) Program (107 lines) 1K ( 1%) 3 Saved Variables (52 bytes) 4K ( 4%) Library 92K (93%) Free RAM: 1K ( 0%) 9 Variables 0K ( 0%) General 102K (100%) Free > When the pin is relocated to pin 47 and the MM reset, the program still requires to be reloaded before it can find the SD Card and run smoothly. With the SD Card and Touch screen back to normal functions. I have tried with the CSub saved under both the Library and in the program, but with similar results. Is there any possible reason for this? Thanks again. |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10566 |
You need to call the CFunction from MM.STARTUP and save this routine and the Cfunction in the library. Then it will be called every time the Micromite boots. sub MM.STARTUP remap end sub ' CSub remap 00000000 27BDFFE8 AFBF0014 AFB00010 3C109D00 8E020010 24040020 24050002 0040F809 00003021 8E020010 24040020 24050064 0040F809 00003021 3C02BF81 8C43FA90 24040002 7C831804 AC43FA90 8E020088 AC4000BC 8FBF0014 8FB00010 03E00008 27BD0018 End CSub Once you have done this you need to test that basic SDcard handling is working with the new pin i.e. "FILES" from the command prompt |
||||
| G.B.P. Newbie Joined: 13/08/2014 Location: AustraliaPosts: 16 |
Hi matherp Done this, tested the SD card reading and "FILES" did report what on the SD card. > files A:/ 391734 HUD2.bmp 0 directories, 1 files > Problem now is that the Touch does not respond. Done a GUI TOUCH TEST, no response. Relocate the jumper to pin 47 and TOUCH working again .. It appears that the OPTION TOUCH is not affected by this subroutine ... Any possible further suggestion.. please Thank you. |
||||
| G.B.P. Newbie Joined: 13/08/2014 Location: AustraliaPosts: 16 |
Hi matherp I have tested the Pump program (Geoff) as this uses only one opening screen and no files are required to be loaded... but same results, swop pins and touch working again... if of any help, is the below listing correct..? > library list CSub remap End CSub > SD card reading still working > files A:/ 391734 HUD2.bmp 0 directories, 1 file > If not possible to use both the SDcard and the Touch.. then to free the required extra PWM pin, will need to revert to the smallest LED ILI9341 Regards |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |