Shop OBEX P1 Docs P2 Docs Learn Events
Measuring pulse lengths — Parallax Forums

Measuring pulse lengths

ArchiverArchiver Posts: 46,084
edited 2001-10-27 17:47 in General Discussion
Hi all,
I would like to know how to measure low pulses for lengths of 0.2,
0.5, and 0.8 s. I looked at the PULSIN command and immediately ran
into a problem. I have a BS2 and BS2SX. The limits for maximum pulse
with according to the manual are 131.07 ms and 52.428 ms
respectively. Thus, I would like know if there are any other ways of
measuring pulses. As always, any input would be appreciated.

Sincerely,
RP

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-10-26 21:59
    Use a Counter and Loop Then pulsin

    Lawrence C. Windrem
    lwindrem@p...
    lwindrem@g...

    Original Message
    From: <rpsu279@y...>
    To: <basicstamps@yahoogroups.com>
    Sent: Friday, October 26, 2001 3:53 PM
    Subject: [noparse][[/noparse]basicstamps] Measuring pulse lengths


    > Hi all,
    > I would like to know how to measure low pulses for lengths of 0.2,
    > 0.5, and 0.8 s. I looked at the PULSIN command and immediately ran
    > into a problem. I have a BS2 and BS2SX. The limits for maximum pulse
    > with according to the manual are 131.07 ms and 52.428 ms
    > respectively. Thus, I would like know if there are any other ways of
    > measuring pulses. As always, any input would be appreciated.
    >
    > Sincerely,
    > RP
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-10-27 17:13
    IF you do not need to do other tasks and the measurement only needs to tell
    you the difference between .2, .5, and .8 then you could use a if or while
    statement with a pause and a for next this is very rough but the idea is
    here. now if your pause is set correctly you will get readings of 2, 5, or 8
    with debug

    looking:
    if pin 1 = 1 then timing
    goto looking

    timing:
    for i = 1 to 10
    pause 100 'this is a 100ms pause it will need to be shorter to give the
    count you need
    if pin 1 = 0 then reading
    next i
    goto overflow

    reading:
    debug ? i
    goto looking

    overflow:
    debug ? "too much time
    goto looking
    Original Message
    From: <rpsu279@y...>
    To: <basicstamps@yahoogroups.com>
    Sent: October 26, 2001 12:53 PM
    Subject: [noparse][[/noparse]basicstamps] Measuring pulse lengths


    | Hi all,
    | I would like to know how to measure low pulses for lengths of 0.2,
    | 0.5, and 0.8 s. I looked at the PULSIN command and immediately ran
    | into a problem. I have a BS2 and BS2SX. The limits for maximum pulse
    | with according to the manual are 131.07 ms and 52.428 ms
    | respectively. Thus, I would like know if there are any other ways of
    | measuring pulses. As always, any input would be appreciated.
    |
    | Sincerely,
    | RP
    |
    |
    |
    | To UNSUBSCRIBE, just send mail to:
    | basicstamps-unsubscribe@yahoogroups.com
    | from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    |
    |
    | Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    |
    |
  • ArchiverArchiver Posts: 46,084
    edited 2001-10-27 17:47
    I missed your low pulse requirement so change the first if statement to if
    pin1 = 0 then timing and the second if statement to if pin 1 = 1
    Original Message
    From: Larry Gaminde <lgaminde@t...>
    To: <basicstamps@yahoogroups.com>
    Sent: October 27, 2001 9:13 AM
    Subject: Re: [noparse][[/noparse]basicstamps] Measuring pulse lengths


    | IF you do not need to do other tasks and the measurement only needs to
    tell
    | you the difference between .2, .5, and .8 then you could use a if or
    while
    | statement with a pause and a for next this is very rough but the idea is
    | here. now if your pause is set correctly you will get readings of 2, 5, or
    8
    | with debug
    |
    | looking:
    | if pin 1 = 1 then timing
    | goto looking
    |
    | timing:
    | for i = 1 to 10
    | pause 100 'this is a 100ms pause it will need to be shorter to give the
    | count you need
    | if pin 1 = 0 then reading
    | next i
    | goto overflow
    |
    | reading:
    | debug ? i
    | goto looking
    |
    | overflow:
    | debug ? "too much time
    | goto looking
    |
    Original Message
    | From: <rpsu279@y...>
    | To: <basicstamps@yahoogroups.com>
    | Sent: October 26, 2001 12:53 PM
    | Subject: [noparse][[/noparse]basicstamps] Measuring pulse lengths
    |
    |
    | | Hi all,
    | | I would like to know how to measure low pulses for lengths of 0.2,
    | | 0.5, and 0.8 s. I looked at the PULSIN command and immediately ran
    | | into a problem. I have a BS2 and BS2SX. The limits for maximum pulse
    | | with according to the manual are 131.07 ms and 52.428 ms
    | | respectively. Thus, I would like know if there are any other ways of
    | | measuring pulses. As always, any input would be appreciated.
    | |
    | | Sincerely,
    | | RP
    | |
    | |
    | |
    | | To UNSUBSCRIBE, just send mail to:
    | | basicstamps-unsubscribe@yahoogroups.com
    | | from the same email address that you subscribed. Text in the Subject
    and
    | Body of the message will be ignored.
    | |
    | |
    | | Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
    | |
    | |
    |
    |
    | To UNSUBSCRIBE, just send mail to:
    | basicstamps-unsubscribe@yahoogroups.com
    | from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    |
    |
    | Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    |
    |
Sign In or Register to comment.