In SX Microcontrollers, SX/B Compiler and SX-Key Tool, johncouture wrote: THE QUESTION: I need to be able to set and get individual bit positions in a byte. The SX/B help file says to do the following: alarms VAR Byte(2) ' two bytes (16 bits) fDoor VAR alarms(0).0 ' front door bDoor VAR alarms(0).1 ' back door patio VAR alarms(1).7 Using alarm as an example, I want to: a = 1 x = 1 y = 7 alarm(x) = $00 ' clear the 2nd byte (this works) alarm(x).y = a ' to set the 8th bit position within the 2nd alarm byte with a one The SX/B seems to imply that patio(1).7 has to be hard coded. I need to be able to have variables in place of the 1 and the 7. Does anyone know how to do it. THE APPLICATION: In working on the 1 Wire Search ROM routine, I need to store 64 bits of information. A zero would indicate that there is no collision in this bit position and a one would indicate that there is a collision in this position. This information will help in the next pass to determine which bits need to be toggled so that you can change your search pattern. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=106033 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)