MC1413 is an inverting driver
Philips enhanced 8051 core microcontroller ISP simple operation steps
[ISP Circuit Description]
The figure above shows the typical connection method of the ISP circuit of the P89V51RD2 microcontroller. If the serial interface part (J1 and U1) is removed, it becomes the minimum system circuit of the traditional 8051 microcontroller. The names of some signals are prefixed with lowercase letters n, which means that the low level is valid. In the circuit, pay attention to several key points:
VCC is the power supply, which must be stable and reliable;
the nEA pin cannot be left floating, it must be connected to VCC, or connected to VCC through a pull-up resistor;
the reset circuit is recommended to use the traditional RC reset, and it is best to have an additional reset button for easy operation;
the watchdog reset circuit cannot be connected, otherwise it will cause a reset during the ISP period, resulting in download failure;
the frequency of the crystal oscillator is not arbitrary, and it is recommended to use 11.0592MHz or 22.1182MHz;
Note: Please leave the nPSEN pin floating and do not connect it to GND, which is different from the P89C51RD2.
[Introduction to ISP driver Flash Magic]
Flash Magic is a driver that supports ISP downloads for many Philips microcontrollers, including support for P89(L)V51RB2, RC2, and RD2. The software can be downloaded for free from the following websites:
Zhou Ligong Microcontroller: http://www.zlgmcu.com
Embedded Systems Academy: http://www.esacademy.com
The installation method of Flash Magic software is very simple and is omitted.
[ISP operation steps]
1. Connect the serial port cable.
Note that the 2nd pin of the computer DB9 connection is the computer's receiving Rx, the 3rd pin is the computer's sending Tx, and the 5th pin is GND. Usually, serial port cables have two types: "cross" and "non-cross". Be careful to distinguish and do not connect them in reverse. It is recommended to use a computer with a real serial port for operation. If it is a USB virtual serial port, the download may fail.
2. Run Flash Magic softwareStep1
:
COM Port: Select the serial port actually used, usually COM1;
Baud Rate: The baud rate cannot be set too high, 9600 or 19200 is recommended;
Device: Please select the correct model;
Interface: Select None (ISP).
Step2:
Please check "Erase blocks used by Hex File".
Step3:
Load your program file, note that it must be in HEX format.
Step4:
Please check "Verify after programming";
if you don't understand the other items, please do not check them.
Step5:
Please power on the circuit board first, press and hold the reset button, and then click the "Start" button of Flash Magic software. When the dialog box prompting you to reset appears, release the reset button and the ISP download process will begin. If the reset button is not set, you can click "Start" first, and then power on the circuit board.
3. Run the programAfter
the ISP download is completed, press the reset button once or power on again to start the program.
[page]
P89C51RD2 ISP is conditional |
To use the ISP function of this chip, you must pay attention to
the values of the two registers BOOT STATUS and BOOT VECTOR. When the chip is powered on, it will first check the value
of BOOT STAUTS. If it is not 0, it will jump to the address of BOOT VECTOR*100H to start
executing the mask program; if the value of BOOT STATUS is 0, the MCU will check
whether the level of the /PSEN pin is 0. If it is 0, the above steps will also be executed; and to ensure
the correct execution of ISP, it is necessary to ensure that the value of BOOT VECTOR = 0FCH, because
FC00H is the correct entry for the ISP mask program.
If the value of BOOT VECTOR is changed, then ISP burning cannot be performed normally.
You can modify the value with a universal programmer and then download the program using ISP. |
|
About Boot Vector |
If it is a brand new chip, its BOOT STATUS should
be 0FFH, and BOOT VECTOR should be 0FCH.
There is no problem with ISP burning of such a chip. FLASH MAGIC or
WINISP software also provides
the function of reading and modifying these two values; the problem is that after the value of BOOT VECTOR is changed to non-
0FCH, you can't enter the ISP program, and
there is no way to read and modify it. You can only find a universal programmer and
change the value of BOOT VECTOR back to 0FCH through the universal programmer
. |
|
Using P89C664 to realize automatic storage of large batches of data on I2C bus
Abstract: Combined with FlashMagic software, the ISP function of Philips P89C664 microcontroller is introduced in detail. At the same time, the automatic saving technology of large batch data of I2C bus is realized by using P89C664 hardware I2C interface to receive data and forward it to the computer, and the source program list and necessary comments are attached. s0100
Keywords: FlashMagic I
SPI2CP89C664
Introduction
In actual work, in some cases, it may be necessary to analyze some data sent by I2C interface. If the data is small, it is easier to solve. For example, the data can be directly saved to the RAM of the microcontroller and then displayed through the LED, but if the amount of data is large, this method is very difficult. In this case, it is a better method to save a large amount of data to the computer. This not only solves the problem of storing large amounts of data, but also makes it easy to edit, analyze and print.
However, there is no I2C interface in the peripheral interface of the computer, so it is necessary to convert the data sent by I2C so that it can be sent to the computer to realize the file storage of data. Considering various factors, it is more convenient to use
UART serial port, because serial port technology is simple, widely used, and various application software are also rich.
This article not only introduces how to realize the forwarding and automatic storage of I2C data, but also introduces the ISP function of P89C664, and gives detailed matching related software, which can completely save an expensive programmer and is very practical. This is very suitable for amateur self-study of single-chip microcomputer technology or building a simple and practical development system at home.
1 Introduction to P89C664 single-chip microcomputer and ISP, IAP
P89C664 is an excellent 51 core single-chip microcomputer chip of Philips, with 64KB Flash program memory, 1792B data memory, I2C hardware full working mode interface, 6clocks/12clocks can be 8 interrupt sources/4-level interrupt priority, dual DPTR registers, PCA and IAP, ISP functions, etc. For specific content, please refer to relevant resources. Detailed technical information and various application documents can be downloaded from Philips' website: http://www.semiconductors.philips.com/.
The following is a brief introduction to the concepts of ISP and IAP.
ISP (In System Programming) means in-system programming. It allows the MCU to download new programs while it is still on the product circuit board. One of the obvious advantages of this technology is that you do not need to remove the MCU chip from your circuit board and install it on a traditional programmer to write a new program. You can solder the MCU chip with ISP function on the circuit board, which is more reliable and convenient to use. Of course, you have to leave the UART serial port of the MCU and design a simple peripheral circuit; at the same time, it is also equipped with a dedicated ISP software to realize direct download of user programs. This dedicated ISP download software can be downloaded for free on the websites of various companies. The ISP software of P89C664 can be downloaded from the website of Philips. Of course, if you are interested, you can also design a personalized ISP download software yourself, because Philips is open to various ISP programming instructions.
IAP (In Application Programming
) means in-application programming. That is, the MCU can obtain new codes and reprogram itself. This is an extremely useful technology. For example, you can remotely upgrade your product through the Internet, program-controlled telephone network, etc., just like common anti-virus software can be automatically upgraded. With this technology, you can use the current program-controlled telephone network, the Internet, etc. to achieve remote automatic upgrades of your embedded system without the inconvenience of traditional mailing chips to customers.
It should be pointed out that the core technology of ISP and IAP is the same, both of which call internal standard programs to erase and reprogram the Flash memory. The difference is that ISP is completed by a default serial loader (BootLoader) solidified in the chip; while IAP is completed by the user in his own program, which makes it possible to remotely upgrade the product, and can even be said to be a milestone in MCU application technology.
2 Application of ISP Technology
For Philips MCU, its ISP circuit is very simple, that is, a circuit that communicates with the computer serial port (Note: The circuit will be slightly different depending on the ISP control software), as shown in Figure 1.
The Embedded Systems Academy abroad provides an ISP software FlashMagic, which can be downloaded from the organization's website at http://www.esacademy.com/. The connection circuit above is also used with this software. This is an excellent software, easy to operate, powerful, and supports almost all devices with ISP from Philips. In addition, Philips also provides ISP software for free, but its ease of use is not as good as FlashMagic. The
installation process of FlashMagic is similar to that of standard Windows software, so I will not go into details here. After the installation is complete, after starting FlashMagic, the screen shown in Figure 2 will appear.
Then FlashMagic will try to connect to the ISP chip with the default settings, as shown in Figure 3.
Please note that the display "Attempting to connect..." in the status bar indicates that FlashMagic is trying to connect to the ISP device. If you have downloaded the program with FlashMagic and have not changed the ISP device, you will be able to connect quickly. If you are using it for the first time, you need to make some necessary targeted settings so that FlashMagic can connect to the MCU with ISP normally. If the connection fails, FlashMagic will pop up the prompt box shown in Figure 4.
Please click "Cancel"! Then select the menu Options/AdvancedOptions... in the main interface of the software, as shown in Figure 5.
At this time, a setting box pops up. Please switch to the HardwareConfig tab, as shown in Figure 6. Enable the options
"UseDTRandRTStocontrolRSTandPSEN
" and "KeepRTSassertedwhileCOMPortopen ". No other changes are needed. Just click "OK" to confirm. There are clear 1, 2, 3, 4, and 5 digital indicators on the main interface of FlashMagic. These 1 to 5 numbers do not represent 5 different areas, nor are they 5 steps to download the program. Of course, if you have already set it up, you can directly click the "start" button after each download. In area 1, we need to set each option here. Here we take P89C664 as an example, as shown in Figure 7. COMPort: FlashMagic supports 4 serial ports, COM1, COM2, COM3 and COM4. Most computers only have COM1 and COM2 ports. The main COM port is selected, which is the serial port connected to the user board. BaudRate: Set the download rate of the program here. Choose a suitable value according to the situation. It should not be too large, otherwise it will fail to connect due to interference. Usually, 19200bps is more suitable.
More suitable.
Device: Select the ISP device model. In FlashMagic version 1.81, a total of 35 ISP devices are supported. Here, select P89C664.
OscillatorFrea.(MHz): Please fill in the crystal frequency value of the MCU on your user board.
The other parts are similar. You can download the next FlashMagic by yourself. It will be very clear after a new operation.
In addition to downloading user programs, FlashMagic also provides some other functions, all of which are concentrated in the "ISP" menu. You can try it yourself, and you will find that FlashMagic is really easy to use. With it, your development work will be more efficient, and you can save an expensive programmer, which is especially suitable for microcontroller beginners.
3I2C receives data and forwards it to the computer
. Since P89C664 has a hardware I2C interface, we use it as a slave device to receive data on the I2C bus. Philips provides a standard I2C interface control program package in the relevant technical information. In fact, you can also write the I2C interface control program yourself according to the information of P89C664, but the reference program provided by Philips is worth learning and studying. The following program uses the I2C interface control program launched by Philips. In order to be more suitable for receiving large quantities of I2C bus data, we have made necessary changes to some of the codes. If you need a standard control program, please download it from the Philips website.
The program flow is to first set the address of the I2C interface and the value of each SFR, then start the I2C interface, and send the received data to the computer through the serial port. Start another serial port debugging software on the computer and make relevant settings, and the data of the I2C bus can be received and saved. Here, our user board acts as a protocol conversion device, that is, converting the data stream of the I2C bus into the data stream of the UART and sending it to the computer.
Please note: Generally, our ISP download and serial port debugging share the same circuit and the same serial port. Therefore, FlashMagic and serial port debugging software cannot be started at the same time, otherwise an error will occur. Please close the FlashMagic software after downloading the program and then start the serial port debugging software.
Since the serial port has always been a standard interface provided by various computer systems, the debugging software for the serial port can be found everywhere on the Internet. Of course, if you are interested, you can also design a serial port debugging software yourself.
Here we use a software called COMPortDebuger, which is easy to use and has the function of automatically saving large amounts of data, which is very important. The interface after the software is started is shown in Figure 8.
The website of the software author is displayed in the sending area and the receiving area, and you can go there to download the latest version.
After the user board program is running and the serial port debugging is set up, you can click "Open Serial Port". At this time, various data sent through the serial port will be displayed in the receiving area.
The website (www.dpj.com.cn) gives the source program of the P89C664 in the forwarding device, and the necessary comments are attached to the program.
Conclusion
This article introduces the application of the P89C664ISP function in detail, and uses a simple online download device to program the data forwarding and saving of the I2C bus; at the same time, it gives a detailed initialization of the I2C hardware interface and the source program of the entire device. It can be used for automatic saving, editing, analysis, printing, etc. of various large quantities of I2C bus data. It can also be used in general development to test whether your program meets the requirements.
The ISP of Philips chips is mainly implemented through the serial port.
The software on the PC side is FlashMagic, which was jointly developed by Philips and a certain company.
The software is free and can be accessed through the Philips website.
It basically supports the full range of Philips 51 MCUs that support ISP. The way
Philips MCU enters the ISP BootLoader is relatively complicated.
I remember that under the condition of RST=1, nPSEN flips 3 times. (Except for the LPC9xx series)
Therefore, in order to realize the ISP function, the serial port line needs to transmit 4 signals:
TXD, RXD: standard serial data signals;
DTS: MCU reset signal; RTS: nPSEN control signal.
Of course, there is also a ground line.
The specific signal line connection method is clearly described in the AppNote of FlashMagic, just follow the instructions.