51 MCU simulation decoding 2272 program

Publisher:石头上种庄稼Latest update time:2018-01-25 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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;


Reference address:51 MCU simulation decoding 2272 program

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

C51 MCU uses timer T0 interrupt to realize electronic clock
The above is the circuit schematic The following is the program source code: /******************************************************************************** Function description: Use timer T0 to realize electronic clock ********************************************************************/ #include"reg52.h
[Microcontroller]
C51 MCU uses timer T0 interrupt to realize electronic clock
Based on 51 single chip microcomputer --- remote control lamp
I recently played with a remote control lamp and made a record of it here. 1. The materials needed are as shown below: 1. 51 MCU of the minimum system 2. Relays for one channel 3.USB-TTL module 4.2272-M4 module remote control 5. Several DuPont lines 6. DC connector for data cable 7. A lamp 2. The too
[Microcontroller]
Based on 51 single chip microcomputer --- remote control lamp
51 single chip temperature + pwm controls the fan speed, and the temperature is displayed on LCD1602
The schematic diagram is as follows:   The source code is as follows: #include reg52.h #include intrins.h #include"define.h" #include"delay.h" #include"LCD1602.h" #include"DS18B20.h" #include"HL_alarm.h" sbit KEY3 = P3^5; //define start/stop   void zhuan();   unsigned char timer1; //********************************
[Microcontroller]
51 single chip temperature + pwm controls the fan speed, and the temperature is displayed on LCD1602
51 MCU instruction system addressing mode
The way instructions give data to be operated is called addressing mode. In other words, addressing mode is to find the real address of the number involved in the operation. There are 7 addressing modes in the instruction system of the MCS-51 series microcontrollers. Immediate addressing mode is an addressing mode
[Microcontroller]
Interface and Program Design between 12864 Dot Matrix LCD Module and 51 Single Chip Microcomputer
The display is an important interface for humans to communicate with application equipment. In recent years, with the rapid development of electronic technology, liquid crystal display technology has been widely used in real life. Liquid crystal display modules play an increasingly important role in scientific resea
[Microcontroller]
Interface and Program Design between 12864 Dot Matrix LCD Module and 51 Single Chip Microcomputer
C51 single chip buzzer two butterfly code
#include // This is the code generated by the MCU music code generator #define uchar unsigned char sbit beepIO=P1^5; // Output is P1.5, can be changed to other IO ports flying m,n;  uchar code T ={{0,0}, {0xF8,0x8B},{0xF8,0xF2},{0xF9,0x5B},{0xF9,0xB7},{0xFA,0x14},{0xFA,0x66},{0xFA,0xB9},{0xFB,0x03},{0xFB,0x4A},{0xFB,0
[Microcontroller]
Multi-task multi-process 51 single-chip C language complete version
*/ /* 1. This program does not use any assembly instructions 2. Timer T0 generates an interrupt to switch the process 3. Due to interruption or calling subroutine, PC stack is needed, so PC can be found with SP as the base address. 4. When an interrupt or subroutine returns, SP must be popped from the stack to the PC,
[Microcontroller]
Software Design of Single Chip Microcomputer Based on RTX51
1 Overview Many MCU applications need to execute many tasks at the same time. For such applications, we can use real-time operating systems to flexibly arrange system resources. RTX51 is a small real-time multitasking operating system developed by Keil in the United States for MCS51 series MCUs. It can work
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号