SCM Getting Started Guide series (10) SCM program download knowledge

Source: Internet
Author: User

Self-personal homepage, welcome to visit http://purplesword.info/mcu-primer-10

Note: This article has already been written before writing the "single chip microcomputer Getting Started Guide Series". Now it is found that this article is a reasonable position and should be placed in the "single chip microcomputer Getting Started Guide series (6) the smallest single-chip microcomputer system-although the sparrow is small, dirty, after, but due to the lack of weeks before, so I had to put it here, so I will not re-Modify the position of the article.

As a supplement to the basic knowledge, this article describes in detail the serial port, 51 scm isp download and other knowledge, although these knowledge does not have to be very familiar with can also learn SCM, however, some concepts are sometimes very helpful for solving the problem.

As mentioned above, the single-chip microcomputer is equivalent to a micro-computer, so the single-chip microcomputer can execute the program. On the computer, we can download various game software over the Internet, but how can we let the MCU execute the program? Don't worry. This will introduce you to related knowledge. Some professional words are involved here. You may not understand them, but they do not have a great impact. You just need to know about them. If you are interested, you can search for them online. In addition, after learning it, many concepts will naturally be understood.

1. Serial Port (RS232, UART)

In a broad sense, a serial interface, also known as a serial communication interface, is an extended interface using a serial communication method. We are familiar with the USB interface. The full name of the Universal Serial Bus is the serial port. Serial ports also include UART, RS232, rs422, and RS485. Generally, in a narrow sense, the serial port refers to the RS232 and UART serial ports, which are often called com interfaces.

Classic desktop computers and some laptops have RS232 serial ports (RS232 refers to RS232 serial ports ). Later, this serial port was gradually eliminated in laptops and even desktops due to its small usage, slow speed, and large size.

While 51 single-chip microcomputer has UART serial port (UART = universal asynchronous transmitter/transmitter, universal asynchronous transmitter, refers to the TTL-level serial port ).

The difference between uart and RS232 lies in its level definition. UART is a TTL level, which is defined as 3 ~ 5 V is a high level, indicating "1", 0 V is a low level, indicating "0", just like what we mentioned above; while RS232 is a negative logic level, it defines + 5 ~ + 12 V is low, indicating "0", while-12 ~ -5 V is high, indicating "1 ".

The standard serial port refers to the RS232 serial port (also called the COM interface), which is the standard serial port behind the desktop computer chassis.

  

  

2. Download the MCU Program

Some readers may have guessed that the single-chip microcomputer is loaded into a program through a computer and serial port. But unfortunately, it's only half right.

In order to feel "professional", we should not talk about installing programs for Single-Chip Microcomputer in the future. The professional point should be about program burning or downloading programs. Readers may wonder why it is called burning a program? Do I need to bake a single-chip microcomputer with fire when downloading the program? Of course not. This is just like why the road is called the road. It has its origins. If you want to know the specific reason, let's go into it after learning about the microcontroller and understanding the working principles of the early Rom.

Back to the question, different single-chip microcomputer programs are written in different ways. When I first introduced the STC single-chip microcomputer, I mentioned one of its advantages: You can use the serial port to download the program. I wonder if you have noticed it. The same 51 single-chip microcomputer, Atmel products are divided into two types, one is the early 89cxx system, this type of single-chip microcomputer download program, you need to take down the single-chip microcomputer, it is very troublesome to use a dedicated programmer to program writing. The other is the ipvxx series (ISP = in system programming, online programming) launched later to support ISP ), you only need several lines to connect the single-chip microcomputer and the download loader to download the program easily.

3. ISP online programming

What is ISP? ISP stands for online programming. Its function is to download the program without the need to extract the MCU from the existing circuit. You may not be able to understand the benefits, but the benefits are quite obvious. Here is an example.

One day you designed an electrical appliance for the customer, which was controlled by a single-chip microcomputer. After that, many people have bought the product. However, after a while, you may find that the program you wrote is faulty, or you may need to optimize it in some places, but you have sold the product, the program has been written in it. At this time, if the single-chip microcomputer you use does not support ISP, you have to find customers one by one, remove their products, then remove the single-chip microcomputer, burn the program, and then install it back. If you do not design properly, the single-chip microcomputer is still welded to the circuit and cannot be obtained, it will be even worse.

But it is different with ISP. You can design the product and leave the ISP interface out. If the program is faulty, send the new program you have written to the Internet, and send a batch of emails to inform your customers that the downloaded line provided by the product is used to connect the computer to your ISP interface, then install a download software and download the new program. You can even write it in the manual. Our product software is often updated. Please download the latest software from the official website on your own. This is a permanent task.

So a small improvement has brought about such a big change. To use a single-chip microcomputer, I chose ISP, which is cost-effective and easy to use.

The STC microcontroller not only supports ISP download, but also can be downloaded through a serial port and computer connection, which saves us the money to buy the programmer, it is really inexpensive, suitable for our use.

4. USB and serial port conversion module

Because the USB interface is different from the TTL serial port of the single-chip microcomputer, it cannot be directly connected. Generally, it is connected through the conversion chip. The conversion chip connected to the USB interface requires that the corresponding driver be installed on the computer, and the driver can be easily found online.

The conversion between USB, RS232, and UART can be achieved through chips, and it is easy to buy finished modules. The following describes several commonly used adapters.

  

The first is USB to TTL serial port, which is the most commonly used adapter, often known as USB to TTL Small board, USB-TTL adapter board, commonly used to convert the chip to pl2303, you need to install the corresponding driver on your computer.

  

USB to RS232 serial port, commonly used conversion chip is ch341, when using to install the ch341 driver on the computer, you can search on Baidu

  

RS232 serial port to TTL serial port, the level conversion chip is maxcompute, if your computer has a serial port, you can directly use this adapter, and then the TTL serial port to one end of the microcontroller, this does not need the driver.

  

This USB-RS232 serial port-TTL serial port adapter that integrates the conversion functions of three interfaces ,. This feature is powerful, but it may not be available in the e-market.

Many of the finished MCU learning boards on the market provide USB interfaces, or RS232 serial port + USB interfaces. On the one hand, the USB interface is responsible for power supply to the microcontroller, on the other hand, USB to TTL, or RS232 to TTL has been integrated into the learning board.

5. Reference Circuit Diagram

The reference circuit schematic diagram of these modules is provided below, which does not need to be mastered. If you need to create these modules, you can refer to these circuit diagrams.

  

Maxcompute circuit diagram

  

Pl2303 circuit diagram

  

USB-RS232 circuit diagram

6. 51 MCU program burning

For more information about downloading the program used by the single-chip microcomputer of the AT89C51 XX series, and downloading the program using the ISP method used by the single-chip microcomputer of the at89sxx series, we will not detail it here. When the STC single-chip computer program, in addition to the computer driver, the general use of macro crystal dedicated STC-ISP software for download. Its interface.

Here are some considerations. STC-ISP software is best to download the latest version on the macro crystal official website. Similar situations often occur during the first running, prompting that the part XXX cannot be registered. Corresponding win7 system can first try to right-click the STC-ISP exe program file, select "Run as administrator" (if it is XP system, just log on to the computer as administrator to run the program ). If the problem persists, You need to download the xxx prompt online. DLL or XXX. place the ocx file in the c: \ windows \ system32 folder, run c: \ windows \ system32 \ cmd.exe as an administrator, and enter regsvr32 c: \ windows \ system32 \ XXX. DLL press enter to register. Such a file is a system dynamically linked library file, which is required for program execution. Some computers do not have it or cannot be registered, so this situation occurs.

  

If you have purchased the USB to serial port module, you can install the corresponding driver and plug it into the USB port of the computer. If it is a finished learning board, you can use the power supply to the learning board, connect the download line to your computer. If everything goes well, right-click "my computer" (Windows XP system) or "computer" (Windows 7 7 or later) on the computer, manage and open the Device Manager, the corresponding serial port is displayed in the Device Manager ,.

  

I hope this article has been read, we install the STC-ISP software on your computer, the conditions of the driver is also installed. The download method will be described later.

All rights reserved. For more information, see Source: purplesword homepage? SCM Getting Started Guide series (10) SCM program download knowledge

SCM Getting Started Guide series (10) SCM program download knowledge

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.