Okay I'm stuck and need some help. In my program I am polling a port for settings from a dip switch which I'm breaking into 2 numbers. The first 4 and second 4 bits. the code is:
ADDR = PortE ' Read Unit Address
UID = ADDR >> 4 ' Shift Upper 4 Bits of into Lower 4 Bits
LID = ADDR & %00001111 ' Mask-Off (set) Upper 4 Bits to Zero
Now that I've separated the data I need at this point out of ADDR, I want to rebuild it (ADDR) using two different 4 bit numbers. So lets say I now have variables
UID2 and LID2
How do I shift UID2 from the lower to the upper Bits and then combine it with the lower bits of LID2.
For example:
UID2 = 00001011
LID2 = 00001001
I want ADDR to look like 10111001
Thank you,
Hylan
Bookmarks