Easy... have a look "under the hood" at the generated assembly code and use it to create a custom function (I've been doing this a lot lately). Remember, the BS2sx has a fixed 50 MHz resonator and SX/B has to generate code that can work down to 4 MHz and lower, hence the decision to use 10 uS for PULSIN resolution.
What Jon said... Also initially SX/B only had byte variables, so the pulsin had to have low resolution to avoid overflowing the byte variables when reading servo pulses.
cnt = 0
DO ' Wait for pin to go low
LOOP UNTIL inPin = 0
DO ' Wait for pin to go high
LOOP UNTIL inPin = 1
DO ' count until pin goes low again
PAUSEUS 0.8 ' You'll have to adjust this value to account for instruction time
INC cnt
IF cnt = 0 THEN EXIT
LOOP UNTIL inPin = 0
' cnt now holds the desired value
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
“The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa
Comments
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
“The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·
Thank you very much