View Full Version : PULSIN and RCTIME commands

Joe Fishback
02-09-2007, 11:04 PM
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-

02-09-2007, 11:47 PM
PULSIN measures the time from when the signal drops to when the signal rises, with 2 uSec accuracy.

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.

02-10-2007, 12:38 AM
Hi Joe, the way I interpreted the use of the RCtime in the IR prog was that Pulsin has to seeˇthe start and the endingˇtransition on the other hand the RCtime only has to seeˇthe endingˇtransition. There are times in the example program where the start transiton is missed so RCtime is used to measure the remainder of the pulse. I worked through the IR example code but never finished it, I need to return to it as I really enjoyed the exercise.

Jeff T.

Andy Lindsay (Parallax)
02-21-2007, 08:06 AM
One factoid in addition to Jeff's and Allan's replies...

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.

Joe Fishback
02-22-2007, 04:32 AM

Thanks, now that makes sense.

ˇˇˇˇˇˇ Joe Fishback

-Robots are my friends-