8051 serial port
The only one communication hardware present in atmel 89S52 version of 8051 microcontroller is the serial port. The serial port or UART transfers data bit by bit. In mode 1, 8 bits can be sent with one start and stop bit in a frame.
We can communicate with PC by using the serial port available in 8051. In order to communicate with the PC, we need a level converter because the serial port of the pc uses RS232 voltage levels which is much higher voltage than the TTL logic used by the microcontroller (+12v for logic 0 and -12v for logic 1). A dedicated IC from MAXIM i.e. Max232 is readily available in the market. It converts the TTL signals from the microcontroller to RS232 level and the other way round. Max232 contains 2 channels, works with single 5V supply and uses the principle of charge pump to convert the voltage levels.
You are ready with level converter hardware and HyperTerminal, now its time for testing your level converter hardware. For testing purpose, just interconnect the Tx and Rx pins of the level converter, and type something in the HyperTerminal, you will see the echo.
8051 USART uses dedicated buffer register SBUF, the mode and other settings of the serial port such as number of stop bits etc. is determined by the contents of SCON register. Timer 1 should be initialized to 8-bit auto reload, and its content determines the Baud rate of the 8051 serial port. Read datasheet to know more about different modes of UART.
No comments yet.