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 : COUNT and max frequency for PicoMite?
Page 2 of 2 | |||||
Author | Message | ||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2152 |
If Jim's method is fast enough for your needs it will give you 10^12 counts. That is a lot! While awaiting Peter's update I think this will give 62 or 63 bits starting from 0. setpin gp0,pwm : pwm 0, 1000000,50 setpin gp6,cin > pin(gp6)= -(2^31) :pause 10000 : C=pin(gp6)+(2^31) :? C At 1MHz it will take a much longer than the 10 seconds in the above example (years I imagine) to reach 2^62. |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6110 |
53375996 days or 146236 years approximately While Peter has now given us 64 bit (signed I assume) counts, there are plenty of external devices that are 16 or 32 bit or any strange number of bits that will need converting to MMBasic integers. VK7JH MMedit MMBasic Help |
||||
ElectroPI Newbie Joined: 27/04/2012 Location: AustraliaPosts: 36 |
Having it the same as a (signed?) integer would be great and saves confusion. Thanks Peter for including this in your next update. all the best |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9182 |
NB: The fast timer functionality is RP2350 only. This is because only the RP2350 has a second PWM interrupt and this is needed for the 16-bit PWM register rollover. The first interrupt is dedicated to audio. RC17 has the 64-bit counter variables |
||||
PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 886 |
Only just made it back to my desk to test this Many thanks Pete, works beautifully |
||||
Page 2 of 2 |
Print this page |