In SX Microcontrollers, SX/B Compiler and SX-Key Tool, mumcs01 wrote: 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. [code] 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 [/code] 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? ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=301741 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)