Positron Compiler Documentation

Toggle

Source: Positron8 Compiler User Manual, PDF page 195

Syntax

Toggle Port.Bit or Variable or Variable.Bit

Overview

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

Parameters

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.

Example 1

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.