Can someone please help me get started with this project:
I need a PIC to be able to learn 6 different IR codes and be able to output them depending on certain conditions. Basically a very small learning remote.
Thanks for any help.
Can someone please help me get started with this project:
I need a PIC to be able to learn 6 different IR codes and be able to output them depending on certain conditions. Basically a very small learning remote.
Thanks for any help.
Just 6 IR codes eg 6 buttons or 6 IR code sets eg for 6 devices.
If just 6 buttons do you know in advance what type of IR codes
eg NEC type, Sony, RC5, RC6 These are the common ones and will cover many items but there are still a lot of codes that do not conform to any of the above.
Panasonic and JVC use codes that are similar to NEC but have subtle differences however the decoding is basically the same once you account for differnt headers and number of bytes in the codes.
A bit moe information on exactly what you are trying to achieve would make it easier to answer your question.
Regards
Keith
www.diyha.co.uk
www.kat5.tv
Thanks for your reply.
I just need to transmit about 6 different codes.
The codes are from a proprietary remote (to control a piece of medical equipment). Presently, I do have the codes learned in my Pronto learning remote.
I would like to store the codes in the PIC using the DATA statement and transmit any of the codes based on certain external conditions the PIC will detect.
These are my initial thoughts (please feel free to comment on them):
Figure out the carrier frequency
Figure out if the IR code is PWM or simple high & lows
(I think I can get the above from the Pronto editor, I am trying to find my notes on reading the IR data through the PC software ProntoEdit)
Store the data in the PIC eg (HEADER PULSE), 2H,3L ....
AND the output pulses with the original carrier frequency (either produced by an external oscillator, or possibly by the PIC itself (comments please))
The combined data and carrier would drive a transistor that would be connected to an IR LED.
Comments, ideas suggestions please.
Thanks
If you can supply the codes in Pronto CCF format I can determine whether they use one of the standard protocols and can probably define them in 3-6 bytes (which will make it easier to store them in EEPROM) and suggest code for playback. All the needed details will be in the CCF codes.
I was up working on this all night, see what you think.
Assumptions based on ProntoEdit data:
The carrier is 40K
Header code: 4.12ms ON , 3.75ms OFF
Trailer code1: 11.25ms ON, 3.75ms OFF
Trailer code2: 11.25ms ON, 90ms OFF
Data 0 = 1.15ms ON, 6.35ms OFF
Data 1 = 3.55ms ON, 3.75ms OFF
Data Stream:
Header Code - IR data (eg off) 0010 - 0 spacer - Trailer Code1 -
Header Code - Inverse of IR data (eg 1100) - 1 spacer - Trailer Code2
I see that the PICs cant output a frequency greater then 32767Hz so I plan on ANDing a 555 output with the data stream. Haven't had a chance to test any of this yet. I am also not sure that my timing is accurate (ms ON, MS off).
This is the OFF string (from ProntoEdit)
0000 006b 000c 0000 00a5 0096 002e 00fe 002e 00fe 008e 0096 008e 0096 008e 0096 008e 0096 008e 0096 002e 00fe 002e 00fe 002e 00fe 01c2 0e10
This is the ON string:
0000 006b 000c 0000 00a5 0096 002e 00fe 002e 00fe 008e 0096 002e 00fe 008e 0096 008e 0096 008e 0096 002e 00fe 008e 0096 002e 00fe 01c2 0e10
That's a shame. I can analyze any CCF code in a minute or two, including a graph of the code. A graph of the ON code is attached.I was up working on this all night
What PIC do you plan to use? It's easy to get higher frequencies using hardware PWM. I do it with a PIC12F683 but you'll probably want more pins. There's an example program on the Reynolds Electronics website. Here's some test code that generates ~120kHz.I get somewhat different values.Code:DEFINE OSC 8 @ DEVICE PIC12F683, INTRC_OSC_NOCLKOUT @ DEVICE PIC12F683, MCLR_OFF TRISIO.2 = 0 'GPIO.2=Output PR2 = 17 'PWM Period 117.7kHz CCPR1L = 8 'PWM Duty-Cycle 'CCP1CON = %00001100 'PWM Mode T2CON = %00000100 'Timer2=ON, 1:1 prescale OSCCON = %01110001 'INT HF OSC 8MHz WHILE OSCCON.3>0: WEND 'OSC startup timeout WHILE OSCCON.2=0: WEND 'INT HF OSC stable 'CCP1CON = 0 'PWM module off WHILE OSCCON.2>0 CCP1CON = %00001100 'PWM ON PauseUS 1000 'generate 1ms burst CCP1CON = 0 'PWM OFF Low GPIO.2 Pause 10 'pause 10ms WENDIf all codes use the same lead-in & lead-out, the binary codes are 1100 0001 11 and 1101 0001 01 for OFF & ON respectively.
- Carrier=38740
Lead-in=4.259ms ON, 3.872ms OFF
1-bit=1.187ms ON, 6.557ms OFF
0-bit=3.665ms ON, 3.872ms OFF
Lead-out=11.616ms ON, 92.928ms OFF
Bookmarks