MCU learning remote control program detailed (full version)

STC89C52 is used for learning remote control functions, capable of storing eight different infrared remote control signals. Once a button is pressed and the timer interrupt 2 is completed, it can be applied in commercial production. The system uses specific pins for receiving and transmitting infrared signals, including RXIN on P2.0, TXZAI on P2.2, and TXOUT on P2.1. Several flags and variables are defined to manage the state of the system, such as KEY_SIGN to indicate whether a button press is valid or not, RXTX_SIGN to determine if the system is in transmit or receive mode, and ISP_DATA for handling internal programming functions. Registers like ISP_ADDRH, ISP_ADDRL, ISP_CMD, and others are used to interact with the internal flash memory for reading, writing, and erasing data. Constants such as WAIT_TIME, ZHIL, ZHIH, GESHU, JISHU, and others are defined for managing timing and data storage. The program starts at address 0000H, jumps to the main routine, and sets up timer interrupts for T0 and T1. The key scanning function detects which key is pressed and processes it accordingly. If a key is detected, the system checks if it's valid, debounces the signal, and then executes the corresponding action. For example, pressing a key might trigger either a transmission or reception mode, depending on the current state of the system. The system also includes functions for reading from and writing to the internal EEPROM, ensuring that the stored remote control codes are properly managed. The code includes routines for receiving infrared signals, storing them in external registers, and then processing them for transmission. It uses timer interrupts to manage timing for signal capture and playback. The system also includes delay functions for various purposes, such as debouncing buttons or managing timing during communication. Overall, this program provides a complete solution for learning and storing infrared remote control signals using the STC89C52 microcontroller, making it suitable for real-world applications.

5.08mm Ribbon Connector

5.08Mm Ribbon Connector,Pressure Connector,Electrical Connector,Wire-To-Board Connector

YUEQING WEIMAI ELECTRONICS CO.,LTD , https://www.wmconnector.com

Posted on