In SX Microcontrollers, SX/B Compiler and SX-Key Tool, kvwood wrote: Assuming that Switch1 and Switch2 can have a value of either 0 or 1: AND ----------- 0 & 0 = 0 0 & 1 = 0 1 & 0 = 0 1 & 1 = 1 So, the answer can only be 0 or 1, based on the inputs. You need both inputs to be 1 to get a 1 on the output. If closing the switches produces a zero, you could use NOR (Not OR): NOR ----------- 0 | 0 = 1 0 | 1 = 0 1 | 0 = 0 1 | 1 = 0 Here, both inputs need to be 0 for a 1 on the output. NOR isn't a keyword operator, so you would need to use OR + NOT: OR + NOT ------------ 0 | 0 = ~0 0 | 1 = ~1 1 | 0 = ~1 1 | 1 = ~1 Generally speaking, in Boolean logic, 1 = On/Open/Yes/True/etc., and 0 = Off/Closed/No/False/etc. NOT inverts the value, so NOT 0 = 1, NOT 1 = 0. Boolean logic will always reference a value of 0 or 1. The counter that you're using is doing essentially the same thing as the Boolean logic: keeping track of the states of two inputs to determine an output value. Boolean logic also scales very well. If you had 100 switches ANDed, they would only produce a 1 output if ALL the inputs = 1. Here is a website that shows some basic gates: [url]http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/gate.html#c1[/url] ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=157351#m157375 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)