I would like to take an 8 bit binary number, and separate the 8 bits into an array of size 8.
Can anyone help me with this?
I do know C a bit, but am not familiar with CCS.
Thank you!
Here is what I had started:
Code:
BYTE array[8]
...
void main(void){
int mynum = 0b00010101;
...
for int i =0; i<8; i++){
array[i] =
}
}
I just wasn't sure if I should somehow truncate mynum of if there is an easier way to separate this BYTE.
Thanks for any help with this fairly simple C question...
deperkin
Joined: 04 Feb 2009 Posts: 83 Location: PA
Array in CCS cont.
Posted: Fri Mar 13, 2009 2:18 pm
maybe to clarify...
what i really would like to do is take in an analog signal...
seperate it, then send have of the lower byte to a nibble on one port and the other half of the lower byte to a nibble on another port.
THanks!!
Sydney
Joined: 13 Feb 2009 Posts: 71
Posted: Fri Mar 13, 2009 2:19 pm
Code:
BYTE array[8]
...
void main(void){
int mynum = 0b00010101;
...
for int i =0; i<8; i++){
array[i] = mynum & 1;
mynum >>= 1;
}
}
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum