CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

generate 1 byte, pasting 8 bits ( from an IR remote control)

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
iseron



Joined: 21 Feb 2004
Posts: 12
Location: Santiago - Chile

View user's profile Send private message

generate 1 byte, pasting 8 bits ( from an IR remote control)
PostPosted: Wed Jul 14, 2004 1:09 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Jul 14, 2004 1:27 am     Reply with quote

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

View user's profile Send private message

it works! thanks
PostPosted: Wed Jul 14, 2004 11:28 am     Reply with quote

thanks! Surprised
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Wed Jul 14, 2004 1:16 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group