Bit problem with operator
How can I use the operator and(&)·with two·bits?
same with add, sub ,.....
the compiler keep complaining when I try to perform any operation with two bit variables
Example:
x=a and b
where:
x var bit
a var bit
b var bit
·
same with add, sub ,.....
the compiler keep complaining when I try to perform any operation with two bit variables
Example:
x=a and b
where:
x var bit
a var bit
b var bit
·
Comments
The compiler doesn't support any bit operators (mainly because the SX doesn't support them).
You can assign the bit variables to byte variables and do the operation, or do IF...THEN constructs.
__PARAM1 = a
__PARAM2 = b
__PARAM3 = __PARAM1 AND __PARAM2
x = __PARAM3.0
or
x = 0
IF a = 1 THEN
· IF b = 1 THEN
··· x = 1
· ENDIF
ENDIF
I know it's not pretty, but it is exactly what the compiler would have to generate anyway.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
“The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·