Positron Compiler Documentation

PulseOut

Positron8 · Revision 4.0.6.5 · PDF page 180

PulseOut Pin, Period, { Initial State }

Generate a pulse on Pin of specified Period. The pulse is generated by toggling the pin twice, thus the initial state of the pin determines the polarity of the pulse. Or alternatively, the initial state may be set by using High-Low or 1-0 after the Period. Pin is automatically made an output.

Pin is a Port.Pin constant that specifies the I/O pin to use. Period can be a constant of user defined variable. See notes. State is an optional constant (0 or 1) or name High - Low that specifies the state of the outgoing pulse.

' Send a high pulse 1ms long (at 4MHz) to PORTB.5
'
  Device = 18F25K40               ' Select the device to compile for
  Declare Xtal = 16  ' Tell the compiler the device will be operating at 16MHz

  Low PORTB.5
  PulseOut PORTB.5, 100
'
' Send a high pulse 1ms long (at 4MHz) to PORTB.5
'
  PulseOut PORTB.5, 100, High

The resolution of PulseOut is dependent upon the oscillator frequency. If a 4MHz oscillator is used, the Period of the generated pulse will be in 10us increments. If a 20MHz oscillator is used, Period will have a 2us resolution. Declaring an Xtal value has no effect on PulseOut. The resolution always changes with the actual oscillator speed.

See also : Counter, PulseIn, RCin.

View original PDF page 180Open page in PDFOriginal PDF page 180