Sorry if this is a silly question!
I have an app writing to a PCF8574 i/o expander running 8 leds used to indicate the status of various things going on in my 28x1.
I have the i2c running fine and have another PCF8574 on the same bus running 8 inputs (just having fun getting the INT function to work ATM!)
I have a byte var (SYMBOL LEDS = b8) as the byte indication the status of the leds - what I'm trying to do is update the leds one at a time as the program runs its course.
Would the correct method of say updating the 5th leds value (bit6) be:
LEDS = LEDS + 1 & %00100000 (or similar - syntax might be wrong)
To my thinking that adds 1 to the value of LEDS, but masks it to the 6th bit only? Is that correct or am i WAYYYY off track here?
Cheers
I have an app writing to a PCF8574 i/o expander running 8 leds used to indicate the status of various things going on in my 28x1.
I have the i2c running fine and have another PCF8574 on the same bus running 8 inputs (just having fun getting the INT function to work ATM!)
I have a byte var (SYMBOL LEDS = b8) as the byte indication the status of the leds - what I'm trying to do is update the leds one at a time as the program runs its course.
Would the correct method of say updating the 5th leds value (bit6) be:
LEDS = LEDS + 1 & %00100000 (or similar - syntax might be wrong)
To my thinking that adds 1 to the value of LEDS, but masks it to the 6th bit only? Is that correct or am i WAYYYY off track here?
Cheers