number of clock cycles for a spin instruction
I am using an ultrasonic sensor that requires I wait 65mS for a result.
Instead of using a waitcnt for that time I would like to run some code written in spin.
The problem is how much code will cover 65mS? And if I do not have enough code
what is a good guess how long it did take?
If I understand the Propeller data sheet assembly instructions take 4-7 clock cycles.
I know it will vary by spin instruction, but what is a good number to start with?
Instead of using a waitcnt for that time I would like to run some code written in spin.
The problem is how much code will cover 65mS? And if I do not have enough code
what is a good guess how long it did take?
If I understand the Propeller data sheet assembly instructions take 4-7 clock cycles.
I know it will vary by spin instruction, but what is a good number to start with?
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com E-mail: mikronauts _at_ gmail _dot_ com
My products: Morpheus / Mem+ / PropCade / FlexMem / VMCOG / Propteus / Proteus / SerPlug
and 6.250MHz Crystals to run Propellers at 100MHz & 5.0" OEM TFT VGA LCD modules
Las - Large model assembler Largos - upcoming nano operating system
http://obex.parallax.com/objects/511/
Or, at the very least, you could set a counter in free-running mode and put checks in your spin code so you could continue to execute spin code with periodic tests of the counter value against a known threshold needed for 65 ms to elapse. When counter value exceeds, threshold, jump to measurement routine...
BR
Post Edited (BR) : 6/4/2010 10:49:45 PM GMT
Heres an example driver for a different sensor, you call GetPressure at intervals, if you dont specific wait, it returns false if not enough time has gone by, otherwise it returns true and the sensor reading. If you set wait to true if waits the remaining time needed.
Post Edited (Timmoore) : 6/4/2010 10:52:39 PM GMT