51 single chip computer connected ESP8266 serial WiFi module

The 51 MCU is a broad category of microcontrollers that are compatible with the Intel 8031 instruction set. The first ancestor of this series was the Intel 8004 MCU. As Flash ROM technology advanced, the 8004 evolved into one of the most widely used 8-bit microcontrollers. A well-known representative of this family is Atmel's AT89 series, which is commonly used in industrial measurement and control systems. Many companies have developed 51-compatible models, ensuring their continued dominance in the market for years to come. It’s important to note that the 51 series microcontrollers typically lack self-programming capabilities, which can limit their flexibility in certain applications. However, they remain popular due to their simplicity, reliability, and extensive support from the development community. **Differences Among 51 MCUs** While different manufacturers may produce 51-series chips, such as ATMEL's 89C51 (now discontinued), 89S51, Philips, and Winbond, the same program should run identically on each hardware platform. The 89C51, for example, introduced enhancements like improved clocking and replaced the one-time programmable ROM with Flash memory, allowing for over 1,000 rewrites. This made it more versatile compared to the original 8051. However, the 89C51 faced competition from PIC microcontrollers, mainly because it lacked ISP (In-System Programming) functionality. To address this, Atmel introduced the 89S51, which became a popular choice in practical applications. The 89S51 features a new 0.35-micron process, reducing costs while increasing performance and competitiveness. It is backward compatible with earlier 89CXX models, and Atmel no longer accepts orders for 89CXX chips. Most 89C51 chips seen on the market today are pre-production inventory. **Connecting 51 MCU with ESP8266 WiFi Module** To connect a 51 MCU with an ESP8266 serial WiFi module, proper pin connections are essential. The module communicates via UART, so the TXD and RXD pins of the MCU should be connected accordingly. Once connected, you can use a serial port assistant to send AT commands and configure the module. **Firmware Burning Process** To update the firmware of the ESP8266 module, open the burning software, go to the Configuration tab, and load the firmware address. Ensure only the "Firmware Address" option is selected. Then, return to the Operation tab, select the correct COM port, and click "Burn." After powering the module back on, the firmware will be successfully downloaded. **Testing the ESP8266 Module** After connecting the module to the 51 MCU, you can test it using a serial port assistant. The connection should allow communication between the MCU and the module. Note that the ESP8266 operates in three modes: Station mode, AP mode, or both. You can test the module by sending basic AT commands such as "AT" to check if it responds with "OK." **Common AT Commands** - `AT`: Verifies the module is working. - `AT+RST`: Restarts the module. - `AT+CWMODE="mode"`: Sets the working mode (1 = Station, 2 = AP, 3 = Both). - `AT+CWSAP="ssid","pwd",ch,ecn`: Configures the AP settings. - `AT+CIPMUX="mode"`: Enables multiple connections. - `AT+CIPSERVER="mode",port`: Starts a server on a specified port. **Initializing the WiFi Module via 51 MCU** To ensure the ESP8266 works correctly, some configurations must be initialized in code. For example, setting the mode to AP and station coexistence, creating a hotspot, enabling multiple connections, and starting a server. These settings are usually done during initialization. **Sample Code for 51 MCU** ```c #include "reg52.h" #define uchar unsigned char #define uint unsigned int void sendByte(uchar b) { SBUF = b; while(!TI); TI = 0; } void sendString(uchar *s) { while(*s != '\0') { sendByte(*s); s++; } } void initEsp() { uint a; SCON = 0x50; // 8-bit data, variable baud rate TMOD = 0x20; // Timer 1 in 16-bit auto-reload mode TL1 = 0xfd; // Baud rate 9600 TH1 = 0xfd; ET1 = 0; // Disable timer 1 interrupt TR1 = 1; // Start timer 1 EA = 1; for(a=0; a<50000; a++); // Delay for module to start sendString("AT+CWMODE=2"); // Set to softAP and station mode for(a=0; a<50000; a++); sendString("AT+CIPMUX=1"); // Enable multiple connections for(a=0; a<20000; a++); sendString("AT+CIPSERVER=1,333"); // Start server on port 333 for(a=0; a<20000; a++); sendString("AT+CIPSTO=50"); // Set server timeout RI = 0; ES = 1; // Enable serial interrupt } ``` **Receiving Data via WiFi** When the ESP8266 receives data, it sends a signal like "+IPD,0,14:time": "11:11". The code should parse this data, extract the time, and send it back to the serial port for display. **Interrupt-Based Data Reception** An interrupt service routine can be used to receive data, filter out invalid packets, and store valid information in a buffer for processing. This setup allows the 51 MCU to communicate with the ESP8266, making it possible to build IoT-based projects with simple and cost-effective hardware.

Front Dash Cam

Front Dash Cam,Hidden Dash Camera,Dash Cam Touch Screen,Dash Cam With Wifi

SHENZHEN ROSOTO TECHNOLOGY CO., LTD. , https://www.rdtkdashcam.com

This entry was posted in on