so I know that: 6 << 1 will shift 0110 to become 1100.
so I have this variable "sPORTA.port" that I will load with data, shift it, then store the data into PORTA. So I want to shift bits one at a time so I tried:
sPORTA.port << 1
but that doesn't do anything, so I tried:
sPORTA.port = sPORTA.port << 1
and that gets the job done, 0001 becomes 0010 which then becomes 0100 and so forth and so forth. Is there a simpler way to do this, am I doing this a real backwards way?
The reason I'm using a union variable is because I want to be able to write some data to the entire variable then be able to pick individual bits out, any suggestions?
my setup:
pic16f627a
MPLAB X
xc8 compiler
pickit2
so I have this variable "sPORTA.port" that I will load with data, shift it, then store the data into PORTA. So I want to shift bits one at a time so I tried:
sPORTA.port << 1
but that doesn't do anything, so I tried:
sPORTA.port = sPORTA.port << 1
and that gets the job done, 0001 becomes 0010 which then becomes 0100 and so forth and so forth. Is there a simpler way to do this, am I doing this a real backwards way?
The reason I'm using a union variable is because I want to be able to write some data to the entire variable then be able to pick individual bits out, any suggestions?
my setup:
pic16f627a
MPLAB X
xc8 compiler
pickit2