Checking for CNT timeout...
Kye
Posts: 2,200
Mmm, I forgot how to do this...
So, I backup a copy of CNT in result. Then I wait until their difference is over 5ms apart... or (clkfreq / 200).
However, in spin the ">" operator is signed so this comparison does not always work... So, How do I fix this?
Thanks,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
result := cnt repeat until(...) if((cnt - result) > (clkfreq / 200)) .. Do stuff
So, I backup a copy of CNT in result. Then I wait until their difference is over 5ms apart... or (clkfreq / 200).
However, in spin the ">" operator is signed so this comparison does not always work... So, How do I fix this?
Thanks,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Comments
Rich H
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Simple Servo Tester, a kit from Gadget Gangster.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
This one allows you to do a continuously repeating process, then every length cycles something specific is executed.
Then there is the repetitive timing loop:
and here is the one I think you are thinking of:
EDIT: looks like I misunderstood the questions...oh well, that is still good information above
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
Some of my objects:
MCP3X0X ADC Driver - Programmable Schmitt inputs, frequency reading, and more!
Simple Propeller-based Database - Making life easier and more readable for all your EEPROM storage needs.
String Manipulation Library - Don't allow strings to be the bane of the Propeller, bend them to your will!
Fast Inter-Propeller Comm - Fast communication between two propellers (1.37MB/s @100MHz)!
Post Edited (Bobb Fwed) : 6/16/2010 2:30:41 PM GMT
The essence is: Never use : if a > CNT, always: if (a - CNT) > 0
I hope I'm right. I didn't systematically verify that, but since I changed the If statement, my program didn't hang!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
cmapspublic3.ihmc.us:80/servlet/SBReadResourceServlet?rid=1181572927203_421963583_5511&partName=htmltext
Hello Rest Of The World
Hello Debris
Install a propeller and blow them away
Post Edited (ErNa) : 6/16/2010 7:43:01 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,