P3 mouth: P3 is a 8 port pins with internal pull-up resistor on the bi-directional I / O port, can receive the output current of 4 TTL gates. When the P3 I write "1" after, they are internal pull-up is high, and used as input. As input, due to the external pull-down for the low, P3 port output current (ILL) This is due to pull-up's sake.
RST: reset input. When the oscillator reset the device when the RST pin to maintain the high time for two machine cycles.
ALE / PROG: when accessing external memory, the address latch to allow the output level used to latch the status of the address byte. In the FLASH programming period, this pin for input programming pulse. In peacetime, ALE client to change the frequency cycle of the output positive pulse signal, the frequency of the oscillator frequency of 1 / 6. So it can be used as an external output pulse or used for timing purposes. It should be noted, however, is: When used as external data memory, it will skip one ALE pulse. If you want to prohibit the output of ALE can be SFR8EH address set 0. At this point, ALE is only in the implementation of the MOVX, MOVC instruction is ALE is applied. In addition, the pin is pulled slightly. If the microprocessor in the external implementation of the state of ALE prohibition, the set is invalid.
/ PSEN: external program memory strobe. By the external program memory fetch period, twice each machine cycle / PSEN effective. However, access to external data memory when the two effective / PSEN signals will not appear.
/ EA / VPP: When / EA to maintain low, then during this period the external program memory (0000H-FFFFH), regardless of whether an internal program memory. Note that encryption method 1, / EA will be internally locked RESET; when / EA to maintain high side when the internal program memory here. In the FLASH programming period, this pin is also used to exert 12V programming supply (VPP).
XTAL1 and XTAL2 respectively, reverse amplifier input and output. The reverse amplifier can be configured as on-chip oscillator. Shi Jing oscillation and ceramic oscillation can be used. If using an external clock source drive the device, XTAL2 should not take. More than input to the internal clock signal through a two-way flip-flop, so the external clock signal pulse width without any request, but must ensure that the high-low pulse width requirements.
The whole array and three lock-bit PEROM electrical erase control signals through the right combination and maintain ALE pin is low 10ms to complete. Cleaning operation in the chip, code arrays were all written "1" and in any non-empty memory byte has been programmed to repeat the past, the operation must be executed.
In addition, AT89S52 with steady-state logic, and can be in the low to zero frequency under the conditions of static logic, and supports two software selectable power-down mode. In idle mode, CPU stop working. But the RAM, timers, counters, serial port and interrupt system are still working. In the power-down mode, to save the contents of RAM and a freeze oscillator, to prohibit the use of other chip functions until the next until a hardware reset.
Serial Communication
MCU structure, and special registers, this is your key to write the software. As for the serial communication need to use those special function registers it, they are SCON, TCON, TMOD, SCON, etc. What is the meaning of the delegates do?
SBUF data buffer register which is a serial port can be directly addressable special-purpose register. A friend of mine had this asked, "Why in the serial port transceiver, are only used to the same register SBUF? Rather than using a register of all sending and receiving." SBUF actually contains two separate registers, one is sent hosting, and the other One is the receive register, but they all shared the same address address-99H. CPU reading SBUF will refer to the receiving register, when writing will point to send the register, and receive registers are double-buffered register, so that there is no receive interrupt can be avoided by timely response, the data have not been removed, and the next frame data has been the arrival of , which leads to the data overlap. Transmitters do not need to use double buffering, under normal circumstances, we do not have to write to send the program used to send interrupts to send data outside the grounds. Method of operation SBUF register is very simple, just 99H address this with the keyword is defined as an sfr variable then one can read and write operations, and such as the sfr SBUF = 0x99; Of course you can also use other names. Usually in a standard header files such as reg51.h or at89x51.h has been done to its definition, as long as with the # include references on it.
Serial Port Control Register SCON usually chip or device in order to monitor or control interface state, will be a reference to the interface control register. SCON is a 51-chip serial port control register. It is addressing address is 98H, is one of the registers can be bit-addressable, role is to monitor and control the 51-chip serial port of the working state. 51-chip serial port can work in several different operating modes, its operating mode setting is to use SCON register. 【转载请注明出处:https://www.5ubs.com/bsTemplate/fanyi/538.html】 |