metal
Global Moderator
Hero Member
   
Offline
Posts: 2420
Thank You
-Given: 862
-Receive: 678
Top Topic Starter
|
 |
« Reply #2 on: June 20, 2013, 10:53:30 10:53 » |
|
I modified the code to work with 15-Bit SIRC, I used PICKit2 to see the actual signals being sent, I thought there was something wrong with the remote itself, but apparently there is a trick in the code that I could not find to solve my problem. Look at the snapshot, I have not inverted the signal so what you see is the actually the inverted signal from the IR module.
I came across this code two days ago, since then I have been trying to figure why when I remove my finger off any button, the LCD shows 69 as the command received but while pressing any button, the correct command is displayed. very strange indeed, I have also tried measuring start bit time and then use it for 600us and 1200us as well as tolerance calculations, but this has not changed anything, the 69 command is still received when I remove my finger off the button, I understand that I did enhance the code and it worked perfectly, but this enhancement did not solve the problem, so I reverted back to the original code.
I did the modification to accommodate the 15-bit SIRC by changing the value to which bitmask is compared:
if (bitmask == 0x00) // all addr bits received?
So that I need 8 bits address instead of 5. Original code used 0x20, this means it was expecting 5 bits command. Shifting 3 bits, I believe I must test for 0x00, correct me if I am wring please.
Another funny thing, when I tried 12-bit remote with this code and the code which I enhanced, it worked flawlessly, I press the button, and the LCD shows the received command, when I remove my finger off the button, the command is still the same, contrary to what happens in the 15-bit remote. I attached the code, I am using PIC16F886 @ 4MHz and using MPLABX.
|