Hi,
Lets say you have the four switches connected to PortB.0 thru PortB.3 and that they pull their respecitve pin high when 'on'. Then all you need to isAt this point the variable Adress will contain the the "value" of the dip switches as coded "in binary" and allows for a total of 16 adresses, 0-15.Code:Adress VAR BYTE TRISB = %00001111 ' lower four bits as inputs, rest as outputs Adress = PortB & 15
In your example, the first line would be adress 1 but the second would be adress 3 when using the above code.
/Henrik.




Bookmarks