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.
ville56 Guru Joined: 08/06/2022 Location: AustriaPosts: 411
Posted: 09:55am 23 Feb 2026
Copy link to clipboard
Print this post
is there a programatic way to map from pin name to PWM nuber like in
SETPIN GP15, PWMnc 'n=number c=channel
I found no other way so far as to loop thru all number and channel combinations for a given pin name and trapping an error, if any, or using the first non-error path as result, so plain try and error ...
But there is certainly a mor elegant solution I missed .... 73 de OE1HGA, Gerald
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10982
Posted: 10:02am 23 Feb 2026
Copy link to clipboard
Print this post
For SETPIN you can just use PWM. You don't need the "nc" I'll add a new mm.info(pwm pin) that will return the channel for a given pin. Will be in V6.02.01b6
ville56 Guru Joined: 08/06/2022 Location: AustriaPosts: 411
Posted: 10:05am 23 Feb 2026
Copy link to clipboard
Print this post
Thanks Peter, wasn't aware of the SETPIN without nc .... the new mm.info will also be helpful in such cases, thank you. 73 de OE1HGA, Gerald
ville56 Guru Joined: 08/06/2022 Location: AustriaPosts: 411
Posted: 12:07pm 23 Feb 2026
Copy link to clipboard
Print this post
Peter,
MM.INFO(PWM COUNT) as of the manual does not work ...
PicoMite MMBasic RP2350B V6.02.01b5 OPTION FLASH SIZE 16777216 OPTION COLOURCODE ON OPTION PICO OFF OPTION CPUSPEED (KHz) 200000 73 de OE1HGA, Gerald
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10982
Posted: 12:16pm 23 Feb 2026
Copy link to clipboard
Print this post
You need to specify the slice mm.info(pwm count n) where n=0-7 for the RP2040 and 0-11 for the RP2350 For mm.info(PWM DUTY n,m) you also need to specify the channel 0 or 1
ville56 Guru Joined: 08/06/2022 Location: AustriaPosts: 411
Posted: 12:24pm 23 Feb 2026
Copy link to clipboard
Print this post
Peter,
the manual says for mm.info(pwm count)
"Returns the number of PWM channels supported by the chip"
so I see no use for specifying a "slice", whatever this should be. I tried with several different slice numbers, they all give 65535 as result. Doesn't make sense for me. I would have expected something between 0 and 11, depending on the chip. 73 de OE1HGA, Gerald
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10982
Posted: 12:27pm 23 Feb 2026
Copy link to clipboard
Print this post
The manual is wrong - will get it updated. It returns the total count of the pwm slice given the frequency