Theoretical Considerations
3.1. Serial Data Communication Serial transmission refers to the way each character is transferred. Characters transmitted serially are sent one bit at a time and received one bit at a time in the order of transmission. This is in contrast to parallel transmission schemes which transmit more than one bit at a time. In a long transmission line it will be more economical when serial data communication is used between terminal device and peripheral devices, since fewer data lines and control lines are used.
3.1.1. Asynchronous Serial Communication Asynchronous Serial Communications (ASC) is the term used to describe the specific manner in which communications take place between a computer and its associated terminals and serial printers. In asynchronous communication, data is
preceded with a start bit which indicates to the receiver that a word (a chunk of data broken up into individual bits) is about to begin. To avoid confusion with other bits, the start bit is twice the size of any other bit in the transmission. The end of a word is followed by a stop bit, which tells the receiver that the word has come to an end, that it should begin looking for the next start bit, and that any bits it receives before getting the start bit should be ignored. To insure data integrity, a parity bit is often added between the last bit of data and the stop bit. The parity bit makes sure that the data received is composed of the same number of bits in the same order in which they were sent. Because this scheme allows data to be sent intermittently and does not require elaborate timing mechanisms, the asynchronous
method is particularly useful for reading characters entered through a keyboard, where the time interval between the entries of two characters can vary greatly.
3.1.2. Synchronous Serial Communication Synchronous communication takes place between a transmitter and a receiver operating on synchronized clocks. In a synchronous system, the communication partners have a short conversation before data exchange begins. In this conversation, they align their clocks and agree upon the parameters of the data transfer, including the time interval between bits of data. Any data that falls outside these parameters will be assumed to be either in error or a placeholder used to maintain synchronization. Synchronous lines must remain constantly active in order to maintain synchronization, thus the need for placeholders between valid data. Once each side knows what to expect of the other, and knows how to indicate to the other whether what was expected was received, then communication of any length can commence.
3.1.3. Clock Synchronization In a synchronous link, it is imperative that all the hardware operate together with a common clock. There are three clocking methods by which to achieve synchronization: internal, external, and recovered clocking. All three methods derive the clock signal for the reception line from the incoming data. The clock signal for the transmission line will always be generated by the devices internal oscillator, but the phase reference used by the internal oscillator differs for each of the clocking methods. When internal clocking is used, the transmit
clock is phase locked to the device's own internal oscillator. For external clocking, the transmit clock is phase locked to the phase of the oscillator belonging to another device in the network. For recovered clocking, the transmit clock phase is locked to the clock derived from the incoming data. In general, the DCE device (such as a modem) uses internal clocking, while the DTE device (such as a PC) uses external clocking and synchronizes around the DCE device. In cases where DTE-DTE or DCE-DCE connections are necessary, one device must be configured atypically, or a device such as a modem-eliminator or tail-circuit buffer must be placed between the two. However, in large networks with multiple devices this is not always possible. One solution for such networks is to have all devices synchronize around a single modem's clock source. However, this solution has the tendency to result in clock drift, and thus can potentially corrupt data. The other solution is to use recovered clocking so that a modem can derive the clock from data on its reception line then send that information out on its transmit line to be used by the next modem in line, etc. There are three clocking methods by which to achieve synchronization: internal, external, and recovered clocking. All three methods derive the clock signal for the reception line from the incoming data. The clock signal for the transmission line will always be generated by the devices internal oscillator, but the phase reference used by the internal oscillator differs for each of the clocking methods. When internal clocking is used, the transmit clock is phase locked to the
device's own internal oscillator. For external clocking, the transmit clock is phase locked to the phase of the oscillator belonging to another device in the network. For recovered clocking, the transmit clock phase is locked to the clock derived from the incoming data. In general, the DCE device (such as a modem) uses internal clocking, while the DTE device (such as a PC) uses external clocking and synchronizes around the DCE device. In cases where DTE-DTE or DCE-DCE connections are necessary, one device must be configured atypically, or a device such as a modem-eliminator or tail-circuit buffer must be placed between the two. However, in large networks with multiple devices this is not always possible. One solution for such networks is to have all devices synchronize around a single modem's clock source. However, this solution has the tendency to result in clock drift, and thus can potentially corrupt data. The other solution is to use recovered clocking so that a modem can derive the clock from data on its reception line then send that information out on its transmit line to be used by the next modem in line, etc.
3.2. UART or USART UART stands for universal asynchronous receiver transmitter. At the heart of every asynchronous serial system is the Universal Asynchronous Receiver/Transmitter or UART. The UART is responsible for implementing the asynchronous communication process described in asynchronous data communication as both a transmitter and a receiver (both encoding and decoding data frames). The UART not only controls the
transfer of data, but the speed at which communication takes place. However, the first UARTs could only handle one byte of information at a time, which meant that the computer needed to immediately process any transmission or risk losing data as the next byte of information pushed its way onto the UART. Not only does this makes for unreliable and slow communication, it can slow down the entire system. It is used for serial communication interface which translates data between parallel and serial interfaces. This is hardware which is already integrated in some microcontroller used for serial communications over a computer or peripheral device serial port. Software UART can also be established by means of a program. The USART is just like the UART with an additional synchronous mode rather than asynchronous mode only. USART module can be configured in three different modes, as a full-duplex asynchronous system that can communicate with peripheral devices, such as CRT terminals and personal computers. It can also be a master/slave half-duplex synchronous system that can communicate with peripheral devices such as A/D or D/A integrated circuits and serial EEPROMS. Depending on the microcontroller model, it can have more than 1 USART module on one chip.
3.2.1. USART-Related Registers USART module uses the following registers to control its operation are: Transmit status register (TXSTA), receive status register (RCSTA), baud rate generate register (SPBRG), transmit register (TXREG), and receive register (RCREG). To those microcontroller devices with two USART modules a suffix is added to the names of the register. For example the transmit status register for USART1 will be TXSTA1.
3.2.2. USART structure A UART usually contains the following components: •
a clock generator, usually a multiple of the bit rate to improve sampling in the middle of a bit period.
•
input and output shift registers
•
transmit/receive control
•
read/write control logic
•
optional transmit/receive buffers
•
optional parallel data bus buffer
3.3. LCD module Liquid Crystal Display (LCD) is a display device which is widely used for various electronic applications that has human interface in it. It is made out of glass substrate with electrode film (ITO), twisted nematic liquid crystals, vertical and horizontal filter films. There are two types of LCD an active-matrix and a passive-matrix. Active-matrix displays are the modern colored LCD display like thin-film transistors (TFT) and the active-matrix LCDs. These displays are not only colored but they also have higher resolution and refresh rate. The passive-matrix is the monochrome display LCDs, their resolution are smaller and refresh rate does not match the active-matrix.
3.4. Protocols In order for electronic devices to communicate with each other they must conform to well defined sets of rules which govern factors ranging from hardware configurations to the actual process of data transfer. Such a set of rules is called a protocol. Data communications protocols are conventions set up to assure the orderly exchange of information between two or more data processing entities.
3.4.1. Hardware Protocols The lowest level protocols deal with the hardware connection between two pieces of data processing equipment. The cables used to connect asynchronous devices to the Data communications and Terminal Controller conforms to protocols defined by the Electronic Industries Association (EIA). These protocols, RS-232-C and RS-422, were developed and updated in conjunction with the Bell System and independent equipment manufacturers.
3.4.2. Software Protocols
3.5. DTE and DCE devices
3.5.1. Data Terminal Equipment This refers to an end instrument that converts user information into signals that are ready for transmission. It also reconverts the received signals back to user information. A general rule is that DCE devices provide the clock (internal clocking) and that the DTE device synchronizes on the provided clock (external
clocking). This may be just a single piece of equipment or it can be an interconnected subsystem of multiple equipment that performs all the required functions necessary to permit users to communicate.
Figure 4. (from taltech.com)
Figure 5. (from taltech.com)
The TD (transmit data) wire is the one through which data from a DTE device is transmitted to a DCE device. This name can be deceiving, because this wire is used by a DCE device to receive its data. The TD line is kept in a mark condition by the DTE device when it is idle. The RD (receive data) wire is the one
on which data is received by a DTE device, and the DCE device keeps this line in a mark condition when idle.
RTS stands for Request To Send. This line and the CTS line are used when "hardware flow control" is enabled in both the DTE and DCE devices. The DTE device puts this line in a mark condition to tell the remote device that it is ready and able to receive data. If the DTE device is not able to receive data (typically because its receive buffer is almost full), it will put this line in the space condition as a signal to the DCE to stop sending data. When the DTE device is ready to receive more data (i.e. after data has been removed from its receive buffer), it will place this line back in the mark condition. The complement of the RTS wire is CTS, which stands for Clear To Send. The DCE device puts this line in a mark condition to tell the DTE device that it is ready to receive the data. Likewise, if the DCE device is unable to receive data, it will place this line in the space condition. Together, these two lines make up what is called RTS/CTS or "hardware" flow control. The Software Wedge supports this type of flow control, as well as Xon/XOff or "software" flow control. Software flow control uses special control characters transmitted from one device to another to tell the other device to stop or start sending data. With software flow control the RTS and CTS lines are not used.
DTR stands for Data Terminal Ready. Its intended function is very similar to the RTS line. DSR (Data Set Ready) is the companion to DTR in the
same way that CTS is to RTS. Some serial devices use DTR and DSR as signals to simply confirm that a device is connected and is turned on. The Software Wedge sets DTR to the mark state when the serial port is opened and leaves it in that state until the port is closed. The DTR and DSR lines were originally designed to provide an alternate method of hardware handshaking. It would be pointless to use both RTS/CTS and DTR/DSR for flow control signals at the same time. Because of this, DTR and DSR are rarely used for flow control.
CD stands for Carrier Detect. Carrier Detect is used by a modem to signal that it has a made a connection with another modem, or has detected a carrier tone.
The last remaining line is RI or Ring Indicator. A modem toggles the state of this line when an incoming call rings your phone.
The Carrier Detect (CD) and the Ring Indicator (RI) lines are only available in connections to a modem. Because most modems transmit status information to a PC when either a carrier signal is detected (i.e. when a connection is made to another modem) or when the line is ringing, these two lines are rarely used.
3.6. Baud Rate The baud unit is named after Jean Maurice Emile Baudot, who was an officer in the French Telegraph Service. He is credited with devising the first uniform-length 5-bit
code for characters of the alphabet in the late 19th century. Baud is a measure of the symbol rate; that is, the number of distinct symbolic changes (signalling event) made to the transmission medium per second in a digitally modulated signal. Simply baud really refers to is modulation rate or the number of times per second that a line changes state. This is not always the same as bits per second (BPS). If you connect two serial devices together using direct cables then baud and BPS are in fact the same. Thus, if you are running at 19200 BPS, then the line is also changing states 19200 times per second.
RS-232 The RS-232-C standard defines the electrical circuit functions for 25 connector pins. This standard is implemented by Hewlett-Packard in two versions. The first version makes use of only three of the defined transmission circuits, Data-In, Data-Out and Signal Ground. This special implementation provides an inexpensive interface, since the cable consists of only three wires with the connector on one end replaced by a three-pin connector. However, it is limited to local (direct) connections, in distances up to 15 meters (50 feet). RS-422 The RS-422 standard is implemented by HP in a five pin version. The connecting cable is composed of one twisted pair of wires for Data-In, one twisted pair of wires for DataOut, and a single wire for Signal Ground. Devices can be connected via this interface at
distances up to 1,500 meters (4,000 feet). The coaxial cable used for the Local Area Network complies with the 802.3 standard developed by the Institute of Electrical and Electronics Engineers (IEEE). This standard describes a transmission access method called Carrier Sense Multiple Access with Collision Detect (CSMA/CD).
http://www.taltech.com/resources/intro-sc.html