Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : pico reserved pin on startup
Author | Message | ||||
Plasmamac Guru Joined: 31/01/2019 Location: GermanyPosts: 554 |
forget it Edited 2023-07-28 09:48 by Plasmamac Plasma |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
> option list PicoMite MMBasic Version 5.07.06 OPTION SYSTEM SPI GP18,GP19,GP16 OPTION AUTORUN ON OPTION LCDPANEL ILI9488, LANDSCAPE,GP15,GP14,GP13 OPTION GUI CONTROLS 30 OPTION TOUCH GP12,GP11 GUI CALIBRATE 0, 3965, 3856, -1284, -851 OPTION SDCARD GP22 OPTION AUDIO GP0,GP1, ON PWM CHANNEL 0 > Don't use these? I had same error message. wanted adc and ili |
||||
Plasmamac Guru Joined: 31/01/2019 Location: GermanyPosts: 554 |
For r = 0 To 34 On error skip SetPin r,din If MM.ErrMsg$ ="" Then Print "Pin";r; EndIf Print MM.ErrMsg$ Next Plasma |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2136 |
for n=1 to 40 : ? n, MM.INFO$(PIN n) : next 1 DOUT 2 OFF 3 Invalid 4 OFF 5 OFF 6 OFF 7 OFF 8 Invalid 9 OFF 10 OFF: Boot Reserved 11 OFF: Boot Reserved 12 OFF: Boot Reserved 13 Invalid 14 OFF 15 OFF: Boot Reserved 16 OFF: Boot Reserved 17 OFF: Boot Reserved 18 Invalid 19 OFF: Boot Reserved 20 OFF: Boot Reserved 21 OFF: Boot Reserved 22 OFF 23 Invalid 24 OFF: Boot Reserved 25 OFF: Boot Reserved 26 OFF 27 OFF 28 Invalid 29 OFF: Boot Reserved 30 Invalid 31 AIN: Reserved for function 32 OFF 33 Invalid 34 OFF 35 Invalid 36 Invalid 37 Invalid 38 Invalid 39 Invalid 40 Invalid > Edited 2023-07-28 12:00 by phil99 |
||||
Plasmamac Guru Joined: 31/01/2019 Location: GermanyPosts: 554 |
thanks Plasma |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2136 |
Something for the library? LIST Sub FreePins For n=0 To 29 gp$ = "GP"+Str$(n) p = MM.Info(pinno gp$) pu$ = MM.Info(pin p) Print gp$, p, pu$ Next End Sub > freepins GP0 1 OFF GP1 2 OFF GP2 4 OFF GP3 5 OFF GP4 6 OFF GP5 7 OFF GP6 9 OFF GP7 10 OFF GP8 11 OFF GP9 12 OFF GP10 14 OFF GP11 15 OFF GP12 16 OFF GP13 17 OFF GP14 19 OFF GP15 20 OFF GP16 21 OFF GP17 22 OFF GP18 24 OFF GP19 25 OFF GP20 26 OFF GP21 27 OFF GP22 29 OFF GP23 41 DOUT GP24 42 DIN GP25 43 HEARTBEAT GP26 31 OFF GP27 32 OFF GP28 34 OFF GP29 44 AIN > |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
Just bear in mind that the hardware pin number will only apply to an original PicoMite, whereas the GP number should be applicable to all RP2040-based systems. IMHO the use of hardware pin numbers should be discouraged. Edited 2023-07-28 19:16 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4247 |
hi phil, Good idea about a library function. But think about variable useage. If your library uses "n" then your program cannot use "n" as a different variable (float/string). So invent variable names that are not incidentally used. Something like "Internal_Lib_variable_n%" Regards, Volhout PicomiteVGA PETSCII ROBOTS |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
Even better, make all library routines use local or declared variables unless they *have* to have a shared global, in which case it should be related to the name of the routine. e.g. SUB swapvars(var_a, var_b) local var_c var_c = var_a var_a = var_b var_b = var_c g_swapvars_done = 1 END SUB This is stupidly simplistic, but you get the idea? Also use STATIC variables where it's only a counter or something that nothing else will need access to. Try to sandbox every library routine as far as possible. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2136 |
OK, Mk2 Sub FreePins local n%, p%, gp$ For n%=0 To 29 gp$ = "GP"+Str$(n%) p% = MM.Info(pinno gp$) Print gp$, p%, MM.Info$(pin p%) Next End Sub |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
That's useful Phil99. cheers |
||||
Print this page |