Infrared remote control receiver for PIC

Here is the rewritten and improved version of your content in English, with added explanations and details to make it more natural and comprehensive: ---
RF cable can be customized for other specifications
There are currently three main methods for using infrared transmission. 1. **Polling Method**: This involves software continuously checking if a signal is low (like a remote control signal) and then reading the header code through precise timing delays. It also detects whether the data is 0 or 1. 2. **Timer-based Detection**: When a signal is detected, the timer counter is activated. The number of timer interrupts is then read to determine the header code and the binary values (0 or 1). 3. **Interrupt-based Detection**: Using RB0 or RB4–RB7 along with a timer or software delay, this method takes advantage of real-time input interrupts for accurate signal capture. Below is an example of how infrared signals can be processed using a PIC microcontroller: ; *** Emission is 6221, received code value is sent to ICD PORTC port display ****** ;******************************* Org 0000h Nop Goto start Org 0004h Goto serv ;************************************************* * Start Bsf status, RP0 ; Select Bank 1 MOVlw 0000h MOVwf TRISC ; Set PORTC as output MOVlw 0FFh ; Set PORTB as input MOVwf TRISB MOVlw B'00000100' ; Timer0 settings MOVwf OPTION_REG Bcf status, RP0 ; Select Bank 0 Clrf INTCON ; Disable all interrupts Bsf INTCON, 7 ; Enable external interrupt on falling edge Bsf INTCON, 4 ; Enable TMR0 overflow interrupt Bcf INTCON, 1 ; Clear GIE Clrf PORTC Loop Sleep Nop Goto Loop ;*************On-site protection******************************** Serv MOVwf w_temp Swapf STATUS, 0 Clrf STATUS MOVwf status_temp MOVfpclath, 0 MOVwfpclath_temp Clrf pclath ;***************Remote handling.****************************** Bcf INTCON, 1 ; Disable interrupt Btfsc PORTB, 0 ; Check if RB0 is low Goto zdhh ; If not, skip Call delay8 ; Call 8ms delay for header detection Btfsc PORTB, 0 ; Check again Goto zdhh ; Not valid Call delay5 ; Delay for data detection Btfss PORTB, 0 ; Check if RB0 is high Goto zdhh ; Not valid ;********************************************* Clrf data1 ; 20H Clrf data2 ; 21H Clrf data3 ; 22H Clrf data4 ; 24H Clrf jsp2 ; 32-bit counter Clrf sj ; Received data register Clrf jsp1 ; 8-bit counter MOVlw 0x20 ; Load 20H into W MOVwf FSR ; Send to FSR Jc btfsc PORTB, 0 ; Check if RB0 is low Goto jc ; Skip if not ;**************0 and 1 data detection ****************************** Jc Call delay1 ; Delay 1.3ms Btfsc PORTB, 0 ; Detect 0 or 1 Goto s1 ; Not 1 ;*************0Data Processing***************************** Bcfsj,c ; Data is 0 Rrfsj,1 ; Right shift Goto j1 ;**************1Data processing.************************* S1 bsfsj,c Rrfsj,1 Ddp btfsc PORTB, 0 Goto ddp ;**************RAM shift*************************** J1 incf jsp1 ; 8-bit counter Incf jsp2 ; 32-bit counter Btfss jsp1, 3 ; Check if 8 bits done Goto js Clrf jsp1 MOVf sj, 0 ; Move to W MOVwf findf ; Store in data Incffsr ; Increment RAM address Clrf sj ;***************************** Btfss jsp2, 5 ; Check if 32 bits received Goto js ; Not yet MOVlw B'10001111' ; Send high 8-bit code Xorwf data1, 0 ; Compare Btfss status, 2 ; If match, continue Goto zdhh ; Else, return MOVlw B'10101010' ; Low 8-bit code Xorwf data2, 0 Btfss status, 2 Goto zdhh ;comf data4,0 ; Not used ;subwf data3,0 ;btfss status,2 ;goto zdhh MOVf data3, 0 ; Output to PORTC MOVwf PORTC Goto zdhh ; Return after receiving ;****************zdhh interrupt return procedure ********************* Zdhh MOVfpclath_temp, 0 MOVwfpclath Swapf status_temp, 0 ; Restore bank selection MOVwf status Swapfw_temp, 1 ; Swap w_temp Swapfw_temp, 0 ; Swap back Bcf INTCON, 1 Retfie ; Return from interrupt ;****************8ms******************************** * Delay8 Bcf INTCON,5 Bcf INTCON, 2 MOVlw D'15' MOVwftmr0 Loop1 btfss INTCON, 2 Goto loop1 Return ;****************5ms******************************** * Delay5 Bcf INTCON,5 Bcf INTCON, 2 MOVlw D'120' MOVwftmr0 Loop2 btfss INTCON, 2 Goto loop2 Return ;****************1.3ms******************************* Delay1 Bcf INTCON,5 Bcf INTCON, 2 MOVlw D'240' MOVwftmr0 Loop3 btfss INTCON, 2 Goto loop3 Return ;************* End There may be two types of error codes: one where the prefix is incorrect, and another where there are transmission errors, especially timing-related ones. To avoid this, it's better to use software to verify the headers. Sending multiple packets can help ensure accuracy. Also, when decoding, you can look for patterns like 20 consecutive transitions that indicate the start of a signal. After that, wait for the end of the transition and check for a specific header like 11110000. A. I bought a universal remote control from outside. It uses a PIC16C57C. It works without any issues. I don’t understand how they did it. There’s no decoding chip. Does anyone know? I’m trying to do the same now. Any hints would be appreciated. B. That’s easy. Last time I used two PIC16C57C chips to create a small module for transmitting and receiving. It worked well, but one downside is that it can be interfered with by other infrared devices. C. I use an infrared receiver connected to an external interrupt. Timing is very accurate. I’m using a PIC16F72 chip. D. I use an infrared receiving tube with two-stage amplification to see the output waveform. I used a Changhong remote as the source. On the oscilloscope, it takes about 10ms to show the full signal. According to some books, the IR signal is modulated at 38kHz. But when I set the oscilloscope to 50ns, I couldn’t see the waveform clearly. So programming it seems difficult. How can I detect which part is high? Help me, thanks. E. You can use the input capture function of CCP. It's very easy to implement. Just read the related documentation carefully. The CCP pin can trigger an event (rising, falling, or other edges), and the TMR1 value is recorded. This makes it very accurate, even if the interrupt response is slow. Using this function for infrared remote control is the best approach! F. I used RB0 as an interrupt (first rising edge, then falling edge) and started TIMER2 for 100µs counting. When the next interrupt occurs, the count is 88, which corresponds to 9ms. The rest of the time follows the same pattern. Note that the interrupt edge of RB0 must change according to the timing. With this logic, it's easy to write the code. Another important point: infrared signals have strong attenuation, so you need to consider the reception range. In practice, there is enough time to receive data correctly, ensuring reliable signal capture.

Automotive Rotary Switches

Automotive Rotary Switch


YESWITCHES Automotive Rotary Switches is a multi-function switch selection switches. This Momentary Rotary Switches is widely used in car modification design, car dimmer, this selector switch can be equipped with handle, built-in beautiful LED indicator design, conspicuous operation indicator



Automotive Rotary Switches


The Features of this type of rotary switch: High current load, 10A 125VAC, 6A 250VAC and 20A14V DC, 10A28V DC; Panel card type installation, multi-position design 6 files (0-5) and 5 files (0-4); High load current rating, simple mounting and beautiful appearance make this rotary switch unanimously recognized by customers in the automotive and electronics industries.

The rotary switches offers more rotary switches for PCB or panel-mount applications. Miniature and subminiature designs save space on PCBs, while solder lug, PC thru-hole, wire lead, or quick connect terminations support a variety of mount options.Applications:All kinds of home appliances products, Industrial electronic equipment.


Rotary Switches

Automotive Rotary Switch,Waterprof Automotive Rotary Switch,Automotive Rotary Switch Waterproof

YESWITCH ELECTRONICS CO., LTD. , https://www.yeswitches.com