|
|||||||
| Home | Forums | Articles | Links | Blogs | Register | Donations | FAQ | Calendar | Search | Today's Posts | Mark Forums Read | Search |
| The Lounge A place to talk about almost anything but politics and religion. |
|
We're saving for a new server - help us to serve you by Donating Today and become a friend with benefits!
Ads on/off / Custom Title / 2009 Tshirt / More PMs / Bigger Images / Advanced printing |
|
![]() |
|
|
Thread Tools |
|
|
#1 |
|
diyAudio Member
Join Date: Jun 2004
Location: UK
|
Hi All.
I'm an audiophile and an electronics designer by day. I have a RC5 remote control design that I have inherited in C that runs my pre-amp, but it interferes with my TV. Unfortunately i'm a Pascal man completely. I have picked up most things, but I need to be able to decipher the constant declarations below. They denote the translation from the decoded manchester input from the IR receiver. But I have searched every thing I can find on google and have found no reference to the syntax used. Can anyone out there help me to get a binary representation of each of the constant values. i.e. RC_VOLUP etc It's the CBITS line that is really messing me up! // definitions of remote keys #define CBITS(x) (((x) & 0x3f) | ((x & 0x40) ? 0x1000 : 0)) #define RC_ECODE (0x10 << 6) #define RC_NONE 0x0000 #define RC_VOLUP (RC_ECODE|CBITS(16)) #define RC_VOLDOWN (RC_ECODE|CBITS(17)) #define RC_INPUTLEFT (RC_ECODE|CBITS(85)) #define RC_INPUTRIGHT (RC_ECODE|CBITS(86)) #define RC_STANDBY (RC_ECODE|CBITS(12)) #define RC_MUTE (RC_ECODE|CBITS(13)) #define RC_SELECT (RC_ECODE|CBITS(87)) Help please. |
|
|
|
#2 |
|
just another
diyAudio Member
|
ok I'm guessing that it is the question mark that is confusing the issue??? it is a ternary operator, basically what it says is (if x logically anded with 0x40 is true then 0x1000 else 0
so we end up with the argument to cbits being anded with 0x3f then or'ed with either 0x1000 or 0 depending on the result of anding the argument with 0x40.... is that clear?? Tony.
__________________
Any intelligence I may appear to have is purely artificial Some of my photos .... Finally getting back to working on my MTM after a 4 year Hiatus. |
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Up to date PIC programming | TroelsM | Everything Else | 4 | 6th May 2009 09:54 PM |
| microcontroller programming | traf | Digital Source | 7 | 12th September 2007 01:49 PM |
| PIC programming | serosmaness | Digital Source | 12 | 6th February 2005 11:33 PM |
| PIC programming | future | Parts | 33 | 4th June 2003 05:26 AM |
| New To Site? | Need Help? |
| Page generated in 0.11508894 seconds (75.38% PHP - 24.62% MySQL) with 10 queries |