Circuit Diagram
UART – Universal Asynchronous Receiver Transmitter (UART0 and UART1)
UART0 has lines TXD, RXD and Gnd lines for interfacing simple serial port.
UART1 has lines apart from the above, control lines for interfacing Modem also. Now, we are going to see only the registers available in UART0
UART0 is used to send the byte of data serially and receive the byte of the data serially.
At the time of receiving, it receives the bits seri ally and assembles as parallel 8 bit data and it places in the receiver buffer register U0RBR. It is the content of the top of the FIFO buffer registers. At the time of transmitting, the user is supposed to place the 8 bit data in Transmit Hold Register Namely U0THR.
In serial communication, the serial data is sent in the same rate at which the receiving system also receives. This is called baud rate (bits per second). For example, 9600 baud means 9600 bits per second. The internal clock is divided by 16 bit no. to arrive at the required baud rate.
The Most Significant 8 bits of the divider value are stored is called U0DLM. The Least Significant 8 bits of
the divider value are stored in the register called U0DLL. At the time of writing in these registers only, DLAB bit in the U0LCR register (Line Control Register) is to be made 1. Whenever, the U0THR register is empty, the next byte of data can be sent to send it out serially. Similarly, whenever, a byte of data is received, it is placed in U0RBR. As soon as it happen, interrupt may be raised to inform the user. But interrupts are to be enabled before the use.
There is an interrupt enable register namely U0IER. By writing proper bits in the register, the above events will raise the interrupt. There is another register U0IIR, which is used to find what are all the interrupts pending. The register FIFO control register U0FCR is used to reset TX FIFO (Transmit First In First Out register set) and RX FIFO (Receive First In First Out) and to enable them.
The register U0LCR, line control register is used to write serial protocol parameters namely, the word length of the data, no. of stop bits, parity enable, parity select, Break control. The 7th bit in this register namely DLAB is used to enter the 16 bit divisor data. Line Status register U0LSR is the status register to know whether data has been received, data can be sent for transmission, to find out errors. There is another register U0TER which is used to enable the serial transmitter
PROGRAMLOGIC:
* Configure UART of ARM7 in 9600 baud rate.
* Program loop is created to send given string serially through transmitter pin of UART.
* Hyper terminal of PC is configured in 9600 baud rate in COM port 1
* Data transmitted through UART is received by receiver pin of COM port1 of PC.
* Received string is displayed in hyper terminal
No comments:
Post a Comment