PulseOut

Syntax:

    PulseOut pin, time units

Command Availability:

Available on all microcontrollers.

Explanation:

The PulseOut command will set the specified pin high, wait for the specified amount of time, and then set the pin low again. The pin is specified in the same way as it is for the Set command, and the time is the same as for the Wait command.

Example:

    'This program flashes an LED on GPIO.0 using PulseOut
    #chip 12F629, 4

    'The DIRection of the port is set to show the command.  It is not required to set the DIRection when using the PulseOut command.
    Dir GPIO.0 Out
    Do
        PulseOut GPIO.0, 1 sec 'Turn LED on for 1 sec          ' <<< the PulseOut instruction
        Wait 1 sec             'Wait 1 sec with LED off
    Loop

Key line: PulseOut GPIO.0, 1 sec — sets GPIO.0 high, waits 1 second, then sets it low again, all within this single statement.

See Also:

  • PulseIn — measuring the length of an incoming pulse, the counterpart to PulseOut
  • Wait — the delay command that shares PulseOut’s time-unit syntax
  • Set — setting a pin’s state directly without a timed pulse