variable as a bit position of a variable in SX/B
I'm trying to change one bit of a byte in a subroutine, however the bit place may change. It doesn't seem like I can refer to the bit position with a variable.
Simple example below.
all variables declared as BYTES. (Though I tried changing temp6 to a bit, because that's all it is, and it still gets the same results).
I get the error
'EXPECTED A VALUE BETWEEN 0 AND 7 "temp5"
I can't specify a hard value because I want to pass the bit postion as a variable so I can reuse this routine.
Any ideas?
Simple example below.
sub rtc_bit_change ' PARAM1 = Takes Byte address to change ' PARAM2 = bit position (0-7) ' PARAM3 = desired state temp4 = __PARAM1 temp5 = __PARAM2 temp6 = __PARAM3 temp7 = rtc_read_byte temp4 temp7.temp5 = temp6 rtc_write_byte temp4 temp7 endsub
all variables declared as BYTES. (Though I tried changing temp6 to a bit, because that's all it is, and it still gets the same results).
I get the error
'EXPECTED A VALUE BETWEEN 0 AND 7 "temp5"
I can't specify a hard value because I want to pass the bit postion as a variable so I can reuse this routine.
Any ideas?
Comments
You use it like this:
Also keep an eye out when SX/B 2.0 is released for something to help you on this also.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Smykowski: Well-well look. I already told you: I deal with the customers so the engineers don't have to. I have people skills; I am good at dealing with people. Can't you understand that? What is wrong with you people?