MCU learning remote control program detailed (full version)

STC89C52 microcontroller is used for learning remote control functions. It can store up to eight different infrared remote control signals, and once the button is pressed, it can be used for commercial production with the help of timer interrupt 2. This makes it suitable for various applications in home automation, remote control systems, and more. The following are some important bit definitions: - RXIN BIT P2.0 - TXZAI BIT P2.2 - TXOUT BIT P2.1 - KEY_SIGN BIT 20H; 0 indicates an error, 1 indicates a correct button press - RXTX_SIGN BIT 21H; 0 means transmitting state, 1 means receiving state The following are some ISP (In-System Programming) related register definitions: - ISP_DATA DATA 0E2H - ISP_ADDRH DATA 0E3H - ISP_ADDRL DATA 0E4H - ISP_CMD DATA 0E5H - ISP_TRIG DATA 0E6H - ISP_CONTR DATA 0E7H ISP commands: - ISP_CMD_NO EQU 0 ; operand - ISP_CMD_READ EQU 1 - ISP_CMD_PROGRAM EQU 2 - ISP_CMD_ERASE EQU 3 Other constants: - WAIT_TIME EQU 1 - ZHIL EQU 30H - ZHIH EQU 31H - GESHU EQU 32H - JISHU EQU 33H - KEY_WORD EQU 34H - KEY_VALUE EQU 35H - ADDRH EQU 36H - ADDRL EQU 37H - TX_GESHU EQU 38H The program starts at address 0000H, jumps to the START label, and sets up the stack pointer. The main function includes scanning for key presses, handling button input, and storing or transmitting infrared signals based on user selection. The code also includes routines for delay, scanning keys, and managing the infrared communication. For example, when a key is pressed, the system checks if the key is valid, debounces the signal, and then processes the command accordingly. The system supports both receiving and transmitting modes. When in receive mode, it stores the received infrared signal into external memory. In transmit mode, it reads the stored data and sends it via infrared. The code also handles programming and erasing of the internal ISP EEPROM, ensuring that the stored remote control codes can be updated as needed. This makes the system flexible and adaptable for various applications. The system uses timer interrupts for timing purposes, such as generating precise delays for key debounce and signal transmission. These timers are configured and controlled through specific registers, allowing for accurate timing control. Overall, this project demonstrates how to use the STC89C52 microcontroller for remote control applications, including storing and transmitting infrared signals, handling user input, and managing memory operations. It provides a solid foundation for developing more advanced remote control systems.

Connector 2.00mm Pitch

Connector 2.00Mm Pitch,Ph Connector Accessories,Ph Connectors Accessories,Strip Wire Connectors

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

Posted on