Setting the BITS of a BYTE variable
I'm fairly new to spin programming, but not to microcontrollers.
I am trying to individually set the bits in a byte variable and I can only seem to set the LSB.
I have the Propellor hooked up to an addressable 16 input mux chip (74150), and I want to compile the information into 2 BYTE variables so I can send them out serially.
Here is the code that I am using:
Can anyone give me any insight into what I am doing wrong?
Thanks.
Thanks,
I am trying to individually set the bits in a byte variable and I can only seem to set the LSB.
I have the Propellor hooked up to an addressable 16 input mux chip (74150), and I want to compile the information into 2 BYTE variables so I can send them out serially.
Here is the code that I am using:
repeat
repeat address from 0 to 7
outa[d_pin..a_pin] := address
waitcnt(10000 + cnt)
if ina[w0_pin]==1
status[address] := 1
else
status[address] := 0
status and address are both BYTE variables.Can anyone give me any insight into what I am doing wrong?
Thanks.
Thanks,

Comments
varb |= |< 5 ' set bit 5 high
to set a bit low, do this:
varb &= !|< 3 ' set bit 3 low
This is breaking it down into simplest terms. I hope this helps.
Edit, I see Bob replied, you can use his method as well. If you have additional questions about how he is doing that please ask.
repeat [COLOR="orange"]repeat address from 0 to 7[/COLOR] [COLOR="blue"]outa[/COLOR][d_pin..a_pin] := address waitcnt(10000 + [COLOR="blue"]cnt[/COLOR]) [COLOR="blue"]dirb[/COLOR][address] := [COLOR="blue"]ina[/COLOR][w0_pin]dirb is unused in the current propeller revision so can be (mis)used for whatever you want. After you leave the bit loop dirb[7..0] holds your assembled byte value. HTHrepeat status := 0 repeat address from 7 to 0 outa[d_pin..a_pin] := address waitcnt(10000 + cnt) status := (status << 1) | ina[w0_pin]