T
treez
Guest
Hello,
We are using microchip XC8 free c compiler within mplab.x. We are programming PIC18F65K22.
We have two 8 bit registers dipsw2 and dipsw3 which are declared with the uint8_t type declaration.
Dipsw2 and dipsw3 only ever hold the value 0 or 1. (0x00 or 0x01)
Is the following type of comparison statement valid?
if (!dipsw2 && dipsw3) {currentint = 4;}
We believe this means, “if dipsw2 contains zero, and dipsw3 is non zero, then currentint register gets the value 4.”
This is treating the register rather like it’s a bit, but will this work?
We are using microchip XC8 free c compiler within mplab.x. We are programming PIC18F65K22.
We have two 8 bit registers dipsw2 and dipsw3 which are declared with the uint8_t type declaration.
Dipsw2 and dipsw3 only ever hold the value 0 or 1. (0x00 or 0x01)
Is the following type of comparison statement valid?
if (!dipsw2 && dipsw3) {currentint = 4;}
We believe this means, “if dipsw2 contains zero, and dipsw3 is non zero, then currentint register gets the value 4.”
This is treating the register rather like it’s a bit, but will this work?