FFH), users can program at any time. The programming interface can receive programming permission signals with high voltage (+12V) or low voltage (Vcc). Low voltage programming module
This formula is suitable for the user's online programming system, and the high-voltage programming mode is compatible with the general EPROM programmer.
In AT89C52 single chip microcomputer, some belong to low-voltage programming mode, and some are high-voltage programming mode. Users can read from the model on the chip and the inside of the chip.
The signature byte gets this information.
The program memory array of AT89C52 is programmed by byte writing, one byte at a time, and the PEROM program memory in the whole chip should be programmed.
To write non-empty bytes, the contents of the whole memory must be erased by chip erasure. Before programming, address, data and control signals must be set as shown in Table 9 and Figure 1 1. The programming method of AT89C52 is as follows:
1. Add the address signal of the unit to be programmed to the address line.
2. Add data bytes to be written into the data line.
3. Activate the corresponding control signal.
4. In high voltage programming mode, add+12V programming voltage to EA/Vpp terminal.
5. Write a byte or a program encryption bit for each pair of flash memory arrays, plus an ALE/PROG programming pulse. Write cycle per byte
It is self-timed, usually about1.5 ms. Repeat step 1-5 to change the address of the programming unit and the written data until all files are programmed. AT89C52 has three program encryption bits, which can be obtained by programming (P) or not programming (U) the three encryption bits LB 1, LB2 and LB3 on the chip.
When the encryption bit LB 1 is programmed, the logic level of the EA terminal is sampled and latched during the reset period, and if the microcontroller is not reset after power-on, it is latched.
The initial value is a random number, which will remain until the real reset. In order to make the microcontroller work normally, the latched EA level value must be the same as the reference value.
The current logic levels of the pins are consistent. In addition, the encrypted bits can only be cleared by the whole erase method. AT89C52 MCU uses data pile to indicate the end of a write cycle. In a writing cycle, if the last written byte needs to be read, the highest bit (P0.7) of the read data is opposite to that of the original written byte. After the write cycle is completed, the output data is valid and can be written into the next byte. Data grooming may be effective at any time after the start of the write cycle.
Ready/Busy: The progress of byte programming can be monitored by the "RDY/BSY" output signal. During programming, after ALE becomes high level "H", the level of P3.4(RDY/BSY) terminal is pulled down, indicating the programming state (busy state). After the programming is completed, P3.4 becomes high, indicating the ready state.
Program verification: If the encryption bits LB 1 and LB2 are not programmed, the code data can be read back to the original data through the address and data line, and the circuit shown in figure 12 is adopted. The encrypted bits cannot be directly verified, and the verification of the encrypted bits can be verified by checking the checksum and write state of the memory.
Chip Erase: Using the correct control signal combination (Table 6) and keeping the low-level pulse width of ALE/PROG pin 10mS, the entire PEROM array (4k bytes) and three encrypted bits can be erased. The code array writes any non-empty cells into "1" in the chip erase operation, which needs to be performed before reprogramming.
Read the on-chip signature bytes: AT89C52 single chip microcomputer has three signature bytes, the addresses are 030H, 03 1H and 032H respectively. Used to declare the manufacturer, model and programming voltage of the equipment. To read the signature byte of AT89C52, P3.6 and P3.7 should be set to logic low level. The process of reading signature bytes is similar to the normal check of 030H, 03 1H and 032H cells, and the significance of only returning values is as follows:
(030H)= 1EH declares that the product is made by ATMEL company.
(03 1H)=52H declared as AT89C52 single chip microcomputer.
(032H)=FFH is declared as 12V programming voltage.
(032H)=05H declared as 5V programming voltage.