Shop OBEX P1 Docs P2 Docs Learn Events
PULSIN and RCTIME commands — Parallax Forums

PULSIN and RCTIME commands

Joe FishbackJoe Fishback Posts: 99
edited 2007-02-21 21:32 in BASIC Stamp
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-

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2007-02-09 16:47
    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.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-02-09 17:38
    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.
  • edited 2007-02-21 01:06
    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 FishbackJoe Fishback Posts: 99
    edited 2007-02-21 21:32
    Andy,

    Thanks, now that makes sense.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ······ Joe Fishback

    -Robots are my friends-
Sign In or Register to comment.