PULSIN and RCTIME commands
Joe Fishback
Posts: 99
I am working through the Parallax "IR Remote for the Boe-Bot" manual and have a question about the use of the PULSIN and RCTime commands. I understand what both of them do. But in the case of measuring pulse lengths, the manual starts out measuring length with PULSIN and changes to using RCTime later in the manual. Why? What advanages does one have on the other in measuring just·pulse lengths, no RC cicuit involved?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······ Joe Fishback
-Robots are my friends-
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······ Joe Fishback
-Robots are my friends-
Comments
RCTIME measures the time from when you start the RCTIME command, to when the pin it's monitoring crosses the 1.4 volt value. I think also with 2 uSec accuracy.
PULSIN should be much more repeatable, but does require the "drop--hold--rise" part of a signal.
Jeff T.
A BASIC Stamp 2 executing a series of PULSIN commands can catch and store all the pulses from an IR remote transmitting SONY protocol. However, if extra code is added between PULSIN commands to conserve RAM it delays the start of each successive PULSIN command. This in turn causes the BASIC Stamp 2 to start missing the rising edge of various pulses in sequence. When PULSIN misses the starting edge, it discards the pulse altogether and catches the next pulse. Capturing every other pulse isn't really a good tradeoff for saving RAM.
The solution is to use RCTIME instead of PULSIN. Unlike PULSIN which needs a starting and ending edge, RCTIME only looks for the pulse's ending edge. The values are a little different from PULSIN, but they are repeatable. So, RCTIME makes it possible to add code between commands that conserves RAM, and still catch all the pulses.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
Thanks, now that makes sense.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······ Joe Fishback
-Robots are my friends-