Positron Compiler Documentation

Toggle

Positron8 · Revision 4.0.6.5 · PDF page 195

Toggle Port.Bit or Variable or Variable.Bit

Sets a pin to output mode and reverses the output state of the pin, changing 0 to 1 and 1 to 0.

Port.Bit can be any valid Port and Bit combination. Variable can be a variable or a bit of a variable that’s contained value will be reversed.

Device = 18F25K40               ' Select the device to compile for
Declare Xtal = 16  ' Tell the compiler the device will be operating at 16MHz
Declare Hserial_Baud = 9600      ' Set the Baud rate for HRsoutLn

Low PORTB.0
Do                    ' Create a loop
  Toggle PORTB.0      ' Now reverse the pin
  DelayMs 500        ' Wait for half a second
Loop                  ' Do it forever

See also : High, Low.

View original PDF page 195Open page in PDFOriginal PDF page 195