PULSOUT Pin, Duration {, Resolution}

Function
Generate a pulse on Pin with a width of Duration * Resolution.

Quick Facts
  Units in Resolution    10 Ás (0.01 ms)
  Minimum pulse width    10 Ás
  Maximum pulse width    650.25 ms (byte), 167.11 s (word)

Explanation
PULSOUT sets Pin to output mode, inverts the state of that pin; waits for the specified Duration x Resolution x 10 microseconds; then inverts the state of the pin again returning the bit to its original state.

The pulse width is the product of Duration and Resolution. In the following example, a pulse of 50 microseconds will be generated on RA.0

  PULSOUT RA.0, 5                               ' 50 Ás pulse

The Resolution parameter gives the programmer a great deal of flexibility with PULSOUT. In the follow example, a stream of pulses will be created, each with a different pulse width:

Main:
  FOR idx = 1 TO 10
    PULSOUT RA.0, idx, 10                       ' pulses from 100 to 1000 Ás
    PAUSE 1                                     ' delay 1 millisecond
  NEXT
  GOTO Main

By combining Duration and Resolution, pulses from 10 microseconds to 167.11 seconds can be generated.


Related instruction: PULSIN