Shop OBEX P1 Docs P2 Docs Learn Events
Help with pulsewidth and timing — Parallax Forums

Help with pulsewidth and timing

kenner12kenner12 Posts: 7
edited 2012-05-16 07:15 in General Discussion
Hello everyone,

I'm having a hard time following the ''boe-bot student guide'' book as relates to pulsewidth duration,timing in microseconds, milliseconds and seconds.Which one is which?could someone help me understand what they mean by this particular example that I pulled from the 'boe-bot student guide'' book:
' Robotics with the Boe-Bot – PulseBothLeds.bs2

' Send a 0.13 second pulse to P13 and P12 every 2 seconds.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
0.13 s 0.13 s
P12
0.13 s 0.13 s
2.26 s
P13
Chapter 2: Your Boe-Bot’s Servo Motors · Page 57
DO
PULSOUT 13, 65000
PULSOUT 12, 65000
PAUSE 2000
LOOP

How do you know it is 0.13s?

Thanks,

Ken.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-05-16 07:15
    First of all, it helps for you to look at what you've sent as a message. You've obviously copied and pasted and extra stuff has crept in from the PDF of the book.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    DEBUG "Program Running!"
    DO
    PULSOUT 13, 65000
    PULSOUT 12, 65000
    PAUSE 2000
    LOOP

    The above seems to be the actual program. If you read the description of the PULSOUT statement in the Stamp Manual (Basic Stamp Syntax and Reference Manual) or in the Stamp Editor's help files, you'll see that the first parameter is an I/O pin number and the second parameter is a pulse width in units that vary from one Stamp model to another. In the case of the BS2, the unit is 2us. 65000 x 2us = 130000us = 130ms = 0.13s.

    In general, look up the description of any Parallax Basic statements that are unfamiliar. The existing documentation will answer a lot of your questions. If, after looking them up, you still don't understand something, by all means ask.
Sign In or Register to comment.