Hi,
A flag is just a bit that you set or reset at one (ore more) point in the program and then read at another point. Sort of a one bit memory if you will.
Code:
myFlag VAR BIT 'This is a single bit flag.
Flags VAR BYTE 'Variable containig 8 bits ("flags").
Flag0 VAR Flags.0 'This points to the first bit in Flags
Flag1 VAR Flags.1 'This points to the second bit in Flags
DisplayON VAR Flags.2 'Another flag in the 'flag-byte'
' //And so on....
Main:
If Flag0 = 1 then 'Is Flag0 set?
High Portb.0 'If so set PortB.0 High
Else
Low PortB.0 'If not, set it low
Endif
If PortA.0 = 1 AND PORTA.1 = 0 then
Flag1 = 1 'If so
Else
Flag1 = 0
Endif
' //And so on...
/Henrik Olsson.
Bookmarks