The following is a software simulation PT2272 decoding program, which is simply posted here for your reference.
Software decoding program (simulation PT2272) ; ;The crystal frequency is 11.0592MHz ;
The time positioning relationship in this program is only applicable to the decoding of PT2262 connected to a 3.3M oscillation resistor;
When using other resistance values, the positioning time should be scaled according to the resistance ratio; In the following program, REM is the signal input terminal;
RECEIVE detects a valid signal flag;
ENABLE_DETE continuous key flag;
3AH, 3BH are used as timers; ;
PT2262 has 12 address lines; ;31H, 32H: the first 8 bits of address code received; ;33H, 30H: the last 4 bits of address code received (if the last 4 bits are used as the data terminal, only the content of the 33H unit needs to be read);
When used as a data terminal, the corresponding pin of PT2262 is left floating and is considered to be a low level. ;Address data description; ;Take 31H.0 and 32H.0 as an example; ;Floating: 31H.0=0 32H.0=1 ; ; 1: 31H.0=1 32H.0=1 ; ; 0: 31H.0=0 32H.0=0 ; ;Error 31H.0=1 32H.0=0 ; ; ;
Description: In order to reliably detect the valid signal, it is recommended to detect at least 3 times each time receiving, and then compare the 3 detection values; only when the 3 values are the same can it be considered that the correct signal has been received. It can be processed as follows in the main program: Call REMOTE for the first detection; Call REMOTES for the second and third detections. Please note that it must be called continuously, otherwise the correct data will not be obtained; ;
Note: Set T1 as a 16-bit timer and allow interrupts, otherwise it will cause data reception errors;---------------------------------------;
REMOTE: ; CLR RECEIVE ; ;Check whether there is any code reception within 50ms;
MOV 3AH,#55 ;
REMOTEA: ;
MOV 3BH,#250 ;
REMOTEB: ;
JB REM,REMOTE0 ;If there is a code to send, jump
DJNZ 3BH,REMOTEB ;
DJNZ 3AH,REMOTEA ;
REMOTE_END_1: ;
CLR ENABLE_DETE ;
REMOTE_END: ;
CLR REMOTING ;Clear probe detection flag
RET ;
REMOTE0: ;
JB ENABLE_DETE,REMOTE_END_1; Return to
REMOTES if the key is not released: MOV 34H,#12; Receive 12-bit code; Decode; ; First find the beginning of the received code, which is the high level of 10ms; ; Set the high level time to 8~12ms; ; Detect and wait for 8ms of low level, 70ms threshold;
CLR T_OVER;
MOV TH1,#00H;
MOV TL1,#00H;
SETB TR1;
REMOTE1:;
MOV 3AH,#50;
REMOTE2:;
MOV 3BH,#25;
REMOTE3:;
JB REM,REMOTE1;
JB T_OVER,REMOTE_END;
DJNZ 3BH,REMOTE3;
DJNZ 3AH,REMOTE2;; ; Wait for the high level received within 4ms;
CLR T_OVER ;
MOV TH1,#0F1H ;
MOV TL1,#0F0H ;
SETB TR1 ;
REMOTE_4: ;
JB T_OVER,REMOTE_5 ;
JNB REM,REMOTE_4 ;
CLR TR1 ;
AJMP REMOTE6 ; ;Exceed 12ms, receive error return;
REMOTE_5: ;
AJMP REMOTE_END ;
REMOTE6: ; ;Wait for 550us and collect receive signal;
MOV 3AH,#00 ;
DJNZ 3AH,$ ; ;Collect receive signal and record;
MOV C,REM ;
MOV A,33H ;
RLC A ;
MOV 33H,A ;
MOV A,31H ;
RLC A ;
MOV 31H,A ; ;Wait for the second rising edge, time limit 1.5ms ;
CLR T_OVER ;
MOV TH1,#0FAH ;
MOV TL1,#099H ;
SETB TR1 ;
RM1: JB T_OVER,REMOTE_END ;
JB REM,RM1 ;
CLR TR1 ; ;
CLR T_OVER ;
MOV TH1,#0FAH ;
MOV TL1,#099H ;
SETB TR1 ;
RM2: JB T_OVER,REMOTE_END ;
JNB REM,RM2 ;
CLR TR1 ; ;Wait for 550us and then collect the received signal;
MOV 3AH,#00 ;
DJNZ 3AH,$ ;
MOV C,REM ;
MOV A,30H ;
RLC A ;
MOV 30H,A ;
MOV A,32H ;
RLC A ;
MOV 32H,A ; ;Wait for the rising edge of the second code value;
CLR T_OVER ;
MOV TH1,#0FAH ;
MOV TL1,#099H ;
SETB TR1 ;
RM3: JB T_OVER,RM5 ;
JB REM,RM3 ;
CLR TR1 ; ;
CLR T_OVER ;
MOV TH1,#0FAH ;
MOV TL1,#099H ;
SETB TR1 ;
RM4: JB T_OVER,RM5 ;
JNB REM,RM4 ;
CLR TR1 ;
DJNZ 34H,REMOTE6 ; ;Shift the received code left by 4 bits and put the 8-bit password on the same byte
MOV 34H,#4 ;
AJMP REMOTE7 ;
RM5: AJMP REMOTE_END ;
REMOTE7: ;
CLR C ;
MOV A,33H ;
RLC A ;
MOV 33H,A ;
MOV A,31H ;
RLC A ;
MOV 31H,A ;
CLR C ;
MOV A,30H ;
RLC A ;
MOV 30H,A ;
MOV A,32H ;
RLC A ;
MOV 32H,A ;
DJNZ 34H,REMOTE7 ; ;Move the 4-bit data code from the high 4 bits to the low 4 bits;
MOV A,33H ;
SWAP A ;
MOV 33H,A ;
MOV A,30H ;
SWAP A ;
MOV 30H,A ;
SETB ENABLE_DETE ;
SETB RECEIVE ; ;
AJMP REMOTE_END_1 ;
END;
Previous article:MCU analog remote control
Next article:Infrared remote control software decoding principle and procedure
Recommended ReadingLatest update time:2024-11-16 21:49
- Popular Resources
- Popular amplifiers
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- Fundamentals and Applications of Single Chip Microcomputers (Edited by Zhang Liguang and Chen Zhongxiao)
- Single chip microcomputer control technology (Li Shuping, Wang Yan, Zhu Yu, Zhang Xiaoyun)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- The motor drive waveform has burrs
- I'm almost driven crazy by AD
- TE Live | How to effectively respond to the challenges in the current test and measurement field? Hot recruitment
- stm32 pwm fails after eight cycles
- A preliminary study on STEVAL-MKI109V3 debugging and logic construction
- SS805 base current setting upper limit problem
- An article to understand the commonly used microwave transmission lines (I)
- [Q&A] About the selection of C2000
- Summary of MCU delay methods
- Who can teach me?