View previous topic :: View next topic |
Author |
Message |
iseron
Joined: 21 Feb 2004 Posts: 12 Location: Santiago - Chile
|
generate 1 byte, pasting 8 bits ( from an IR remote control) |
Posted: Wed Jul 14, 2004 1:09 am |
|
|
Hi.
I lost my practice in programming and now i'm spending a lot of time in a relative "simply" thing.
Now i'm receiving pulses from infrared remote control (using the inexpensive IRM-8601s )
The problem:
I want to "paste" the receiving bits to build a 8 bits word.
Can anybody drop some code here, and help me out? :-)
Thanks in advance
Ignacio. |
|
|
Haplo
Joined: 06 Sep 2003 Posts: 659 Location: Sydney, Australia
|
|
Posted: Wed Jul 14, 2004 1:27 am |
|
|
Check the SHIFT_LEFT( ) function in the CCS manual. It also has a code example in the same page which does what you want. |
|
|
iseron
Joined: 21 Feb 2004 Posts: 12 Location: Santiago - Chile
|
it works! thanks |
Posted: Wed Jul 14, 2004 11:28 am |
|
|
thanks! |
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Wed Jul 14, 2004 1:16 pm |
|
|
You could make a loop to do that too:
Code: |
word = incomming_bit & 0x01;// receive first bit
for(i = 0; i < 7; i++)
{ // now shift left 1 position and place the next bit in the LSB place
word = word << 1 | (incomming_bit & 0x01);
}
|
or something like that. Simple and works fine.
Ronald |
|
|
|