The architecture of the microcontroller AT89S51 can be seen as follows:
Block diagram Figure 15 microcontroller 89S51
8051 microcontroller and memory architecture can be seen in the picture
Figure 16 Memory Microcontroller Architecture 8051
Facility Timer and Counter
Many microcontroller applications require the counting of external events, such as the frequency of the pulse or the generation of internal time delay between computers. Both of these examples can be performed using software techniques, but the loop software for counting or timing mejadikan overburdened processors. Therefore, to avoid this we can use the facilities available in the microcontroller in the form of 16-bit up counter named T0 and T1. Each counter may be programmed to count internal clock pulses, to act as a timer or be programmed as a counter to count external pulses.
Interruption Timer Counter
Counter has been incorporated into the chip, the processor can do the job sehigga counting and timing. When a program wants to count a certain number of pulses internal or external events, a figure placed on the counter. Counter is incremented from the initial figure to the maximum and then back to zero at the end of the pulse, and also set the timer flag. Flag condition tested by a nstruksi to tell the program that the matter has been done or flags are used to meninterupsi program.
Figure 17 Logic Control Timer / Counter
Serial Data Input / Output
The computer is to be able to communicate with other computers. One inexpensive way to communicate is to send and receive serial data bits. 8051 has a serial data communication circuit that uses SBUF registers to retain data. Register SCON controls data communications, data rate control register PCON. And RDX pin (P3.0) and TDX (P3.1) connects to a serial data network.
SBUF physically consists of two registers. One is just to write and is used to maintain the data to be transmitted via the TDX 8051. The other is simply to read and maintain data received from external sources via RDX. The two are not separated using address 99h. There are four programmable modes for serial data communications is selected by setting bits in the SCON SMX. Baud rate is determined by the selected mode. Figure 1.17 shows the bit assignments for SCON and PCON.
Interruptions Serial Data
Serial data communication is communication process relatively slow, taking several ms per byte of data to do so.
Figure 18 Function Register SCON and PCON