Design of a STC89C52RC programmer based on CH340T

Publisher:ph49635359Latest update time:2013-11-04 Source: dzscKeywords:CH340T  STC89C52RC  Programmer Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  The programmer communicates with the PC host computer through the USB interface. Users only need to perform simple operations on the PC host computer GUI to erase, program, verify and encrypt STC 89C/S51XX/52XX series microcontrollers. After repeated tests on STC89C52RC and other microcontrollers, the programmer has the advantages of stable function, fast speed, low price and easy use.

  1 Introduction

  STC (Hongjing Technology) Company launched STC 89C/S 51XX/52XX series of single-chip microcomputers, which have the advantages of low price, undecryptable, low power consumption, high speed, high reliability, strong anti-static, strong anti-interference, etc. Its instruction code is fully compatible with the traditional 8051 single-chip microcomputer, and the on-chip resources are very rich. They all have built-in rewritable Flash memory and provide ISP (In-System Programming) programming mode. As a typical representative of the STC 89C/S51XX/52XX series of single-chip microcomputers, STC89C52RC has the following features: 8K bytes of programmable flash memory, 1000 write/erase cycle life, 10 years of data retention time, three-level program memory lock, 512 internal RAM, 32 programmable I/O lines, two 16-bit timers/counters, 5 interrupt sources, programmable serial channels, low-power idle and power-down modes, and on-chip oscillators and clock circuits. Therefore, this powerful and highly cost-effective single-chip microcomputer is widely used in China.

  ISP online programming is a technology that completely subverts the traditional programming mode. It will not damage the pins of the chip, and the download speed is very fast, which shortens the design time, reduces the R&D cost, accelerates the product launch, and greatly improves work efficiency. The general programmer adopts the method of using PL2303, CP2102, FT232 and other main control chips, but the cost is often high, and some chips are not stable, and very few chip firmware versions have bugs. In view of this, this paper proposes a design scheme of ISP programmer based on domestic CH340T chip. After repeated testing of STC89C52RC and other chips, the function is stable and the performance is excellent.

  2 System Hardware Design

  2.1 System overall structure diagram

  The overall structure of the system is shown in Figure 1. The USB power supply and data transmission module is mainly responsible for powering the microcontroller and CH340T and other modules, and converting the USB serial data from the computer into serial port data through CH340T and communicating with the microcontroller, providing a data channel for microcontroller programming.

     

  2.2 Introduction to the core chip CH340T

  CH340T is an interface conversion and microcontroller peripheral chip designed and produced by Nanjing Qinheng Electronics Co., Ltd. It supports USB2.0. It can realize functions such as USB to serial port, expansion of computer asynchronous serial port and USB to IrDA infrared. This design is only used for USB to serial port. The converted serial port is a full-duplex serial port with built-in receiving and sending buffers. It supports communication baud rates from 50bps to 2Mbps, and the allowable baud rate error for sending is < 0.3%, and the allowable baud rate error for receiving is < 2%. Its use is relatively simple, and the peripheral components only require crystals, resistors and capacitors.

  CH340T has 20 standard pin interfaces. The main ones are 1. UD+ and UD- pins, which have built-in USB pull-up resistors and can be directly connected to the USB bus. 2. GND and VCC, namely ground and power pins, support 5V or 3.3V power supply voltage. 3. Data transmission pins TXD and RXD, which are serial port data sending and receiving pins respectively. When the input is idle, RXD is generally high level, but if the R232 pin is high level and the auxiliary RS232 function is enabled, an inverter will be automatically inserted into the RXD pin, and it will become low level by default; when the output is idle, TXD is generally high level. 4. Other pins. Including MODEM contact signal pins and auxiliary pins.

  2.3 System Schematic Diagram

  The schematic diagram is shown in Figure 2.

  

  In the figure, in addition to data transmission, USB interface P1 also powers the CH340T chip, microcontroller and other components after voltage stabilization by LM7805. When using 5V working voltage, the VCC pin of the CH340 chip inputs an external 5V power supply, and the V3 pin should be connected to a power decoupling capacitor with a capacity of 4700pF or 0.01uF. The CH340T adapter chip converts UD1+ and UD1- into serial port signals and serial port data to communicate with the microcontroller serial port. It should be noted that the serial receiving port CRXD of the CH340T chip needs to be connected to the P3.1 (serial output port TXD) of the microcontroller through the PNP transistor Q1 in the form of an emitter generator to achieve the buffering and isolation of the data. [page]

  The MCU subsystem uses a 40-pin test socket. For normal programming, the necessary MCU reset circuit and crystal oscillator circuit are connected externally. In particular, in order to improve the applicability of the programmer, the crystal oscillator circuit uses jumper switch J1 to provide 2 operating frequencies for the MCU: 12MHz and 11.0592M.

  3 System Testing

  The software involved in ISP programming mainly consists of three parts: USB driver, MCU firmware program and computer application program. The MCU firmware program is used to enable the computer to read and program the E2PROM (data Flash) inside the STC MCU, which has been solidified in the MCU in advance.

  Before testing, you must first install the USB driver software USB DriverInstaller.exe, which can map the programming of the USB interface connected to the computer to a virtual serial port, usually COM3 or COM4. Then install the STC microcontroller online programming and burning software STC-ISP. STC-ISP is designed for STC series microcontrollers. It can download STC89 series, 12C2052 series and 12C5410 series STC microcontrollers. It is powerful and easy to use. This programmer requires a version above V3.0.

  The test steps are: insert the STC89C52RC microcontroller into the programmer socket, and then insert the whole into the computer USB port (or connect the programmer and the computer with a USB cable). Then open the STC-ISP software, select the MCU microcontroller model (MCUTYPE) in the main interface, import the Hex file (Open File/ Open File), select the serial port (COM:

  COM3 or COM4, ​​etc.) and baud rate, and finally click the Download button. The main interface after successful download is shown in Figure 3.

  After repeated tests, the programmer designed in this article has normal functions and reliable performance.

  

  4 Conclusion

  This article introduces a simple, practical and low-cost ISP programmer. This programmer has the advantages of stable function, fast speed, low price and easy use, and is suitable for programming STC 89C/S51XX/52XX series microcontrollers. In addition, this system has good scalability. With a slight change in the schematic diagram, it can realize ISP programming download for more microcontrollers such as Atmega8515/Atmega162 (AVR chip) with the help of SPI interface.

Keywords:CH340T  STC89C52RC  Programmer Reference address:Design of a STC89C52RC programmer based on CH340T

Previous article:Design of work and rest alarm controller
Next article:Research on the design of external data storage expansion based on MCS-8051 single chip microcomputer

Latest Microcontroller Articles
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号