Shop OBEX P1 Docs P2 Docs Learn Events
PULSOUT Question — Parallax Forums

PULSOUT Question

AlonAlon Posts: 4
edited 2005-04-05 16:45 in BASIC Stamp
I was wondering about the command PULSOUT... While the command is running, does the program go to the next set of instructions or does it wait until PULSOUT is finished before moving onto the next line of instruction?

Comments

  • JonbJonb Posts: 146
    edited 2005-04-04 13:59
    All Pbasic commands are executed before moving on to the next.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • AlonAlon Posts: 4
    edited 2005-04-04 14:02
    Sorry to be newbish but when you say executed, you mean from start to finish right? And then once the command is finished it goes to the next line.. so it will set the·pin to output mode, invert the state of that pin; waits for the specified duration;·invert the state of the pin again; returning the bit to its original state and only after that move on to whatever the next line is?
  • kb2hapkb2hap Posts: 218
    edited 2005-04-04 14:13
    Its one instruction at a time. so it will finish doing its puslout before it goes to the next instruction. Also you have to figure it approximately does a few thousand instructions a second.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    DTQ
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-04-04 15:26
    Yes, Alon, you are correct. When you issue a PULSOUT, the command makes the pin an output, toggles the pin, waits the pulseout time period, and toggles the pin again. Leaving the pin as an Output, the BS2 run-time only then reads the next PBasic statement and begins to execute it.

    The BS2 is strictly single-tasking -- when it is running a PULSOUT it will wait until the PULSOUT completes before reading the next PBasic instruction. When it is in a PAUSE 100 then for 100 mSec the BS2 does nothing else.

    On the one hand, this can be a pain -- you can't run two motors using PWM without some additional hardware. On the other hand, this behavior makes a very reliable and consistent platform.
  • AlonAlon Posts: 4
    edited 2005-04-05 16:45
    thank you all very much for the replies and help!
Sign In or Register to comment.