What's the easiest way to toggle a bit on M series chips?
inc b0
Syntax:
TOGGLE pin,pin,pin...
- Pin is a variable/constant which specifies the i/o pin to use.
Function:
Make pin output and toggle state.
Information:
The high command inverts an output (high if currently low and vice versa)
On microcontrollers with configurable input/output pins (e.g. PICAXE-08) this
command also automatically configures the pin as an output.
Example:
main:
toggle B.7 ; toggle output 7
pause 1000 ; wait 1 second
goto main ; loop back to start
I think you are confusing TOGGLE with TOGGLEBIT. The former only works with pins, not bits; the latter works only on X2 chips.A method that I found, and have used for years, is like this:
let b1=1-b1
However, I just now looked at the PICaxe manual, and the TOGGLE command works in all chips.