Shop OBEX P1 Docs P2 Docs Learn Events
Pulsin problems — Parallax Forums

Pulsin problems

Joe FishbackJoe Fishback Posts: 99
edited 2005-05-12 01:47 in BASIC Stamp
I am controling my Robot by a "Futaba Model Radio Control" unit which inputs signals into a Bs2 BOE. I have the program running OK, but have a question about tha "PULSIN" command. When I measure the maxium pulse lenghts output by the RC receiver, using a oscilloscope·I get high of 2ms and a low of 1ms. This should be equal to a high of 1000us and a low of 500us lenghts of pulses measured by·the "PULSIN" command on the BOE. When I write a simple program that receives the RC pulses with the "PULSIN" command and "DEBUG" to show the lenght of pulse received, I get following measurements. The maxium shown by "DEBUG" is 860us and minium of 640us. Why they not·1000 and 500? The receiver and the BOE are using a common Vss and Vdd. The program to measure the lengths is as follows-

DO
·· PULSIN 4, 1, pulsLenght
·· DEBUG DEC pulsLenght, CR
LOOP

Joe Fishback

Comments

  • Aristides AlvarezAristides Alvarez Posts: 486
    edited 2005-05-12 01:47
    Hello Joe,

    PULSIN works in similar way to PULSOUT, using time units with a size depending on the BASIC Stamp model you have.

    If you are using a BASIC Stamp 2, the time unit is 2 microseconds (2 uS), so to generate an output or when reading a 2,000 milliseconds (2 S) pulse width signal your argument would be 1000.

    The BASIC Stamp reads the value looking at a threshold transition at about 1.4 Volts. If the edges of the signal are not very sharp you could get different readings using an oscilloscope, depending in where you have your measurement settings. Try to look into the oscilloscope to the pulse width when the signal crosses the 1.4 Volts level.

    On a BASIC Stamp 2 reading a 1,000-milliseconds pulse should return a value of around 500.

    Your program could look like this (if you want to show milliseconds):

    DO
    · PULSIN 4, 1, pulsLenght
    · DEBUG DEC pulsLenght*2, " mS", CR
    LOOP

    Regards,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Aristides Alvarez
    Education and Technical Support Manager
    aalvarez@parallax.com
    Parallax, Inc. www.parallax.com
Sign In or Register to comment.