α-Innovation of The Month
"Innovation of the month" gives opportunity to showcase creativity with new technologies and keep our team indulge in innovative development at our in-house lab.
Innovation of the Month (March - 2012)
Innovation of the month of February is "USART TO LCD"
USART TO LCD
USART to LCD is a device which is capable of displaying any message that is relayed either by computer or by any device having a communication port as Serial Port/RS 232. This device will directly print the message to the 16x2 LCD having capability to display a message of 16 characters at a time.Theory
USART/RS 232
USART is described as Universal Asynchronous Rx Tx where the data is been transmitted in a form of a packet consisting of start bit, data bits, stop bit, parity bit(optional). Made as a Packet format and transmitted in a fixed baud rate, or with a data clock format as in Fig.1.1.
When the data is send in a fixed baud rate type the it is termed as Asynchronous type of data transmission expecting that the receiver to is listening the upcoming data with same data rate speed. Then only the receiver would be able to grab the data error free otherwise the data will get distorted and corrupted. In Computers this protocol usually is termed as RS 232 with a connector type as DB9(Data Box 9 pin) as shown in Fig.1.2. Out of these pin we will be using only three pin as RD TD Ground Pin(2,3,5). Other pin are utilized when we use them as a modem type.USART I connected in two different modes termed as modem configuration as Null Mode, Simplex Mode, Biplex Mode as in Fig.1.3.


Since whenever connecting to a device working in a TTL Logic(Transistor-Transistor Logic 2.4V-5V) and RS 232 works in a voltage level of +/-15V as In Fig.1.4.


Therefore we require a level convertor that converts +5V/0V to -15V/+15V and vice versa. As converter chip provided by Maxim as MAX232 which converts the TTL –RS 232 and Vice Versa. Now we are able to communicate with TTL device and Computer or other peripheral consisting of a UART feature.
LCD (Liquid Crystal Display)
LCD is a device which is capable of providing a GUI to user for Interactive with the device easily as well as a to view Parameters and readings of any particular. Here we are using a Hitachi LCD with 16x2 as 16 Characters capacity and 2 lines to display as in Fig.1.5.Bray Terminal
Terminal is a simple serial port (COM) terminal emulation program.It can be used for communication with different devices such as modems, routers, embedded uC systems, GSM phones,... It is very useful debugging tool for serial communication applications. As shown in Fig.1.6.AVR Platform
AVR is an architecture designed by Atmel for a microcontroller CPU. Upon which different features ore put on as IO’s, UART, Flash, RAM etc. As per our concern we will be utilizing USART, and IO’s for LCD rest features are not utilized.Hardware
-
Inside AVR
Inside AVR we are utilizing the USART and IO’S for LCD where we have to initialize the USART with some set of programming also defining the Baud Rate. The basic format is that on receiving of the data through USART we call for an Interrupt as upon which we update the content of the LCD on the same line following by the pre written data. At the end of the line we start to writing again from the first position. -
Connection
As defined we have to connect the RS 232 cable to the computer on one end and other to the α-Development Board to have a null modem configuration so that both the device can interchange the data between each other. -
Board(α-Development Board)
As in our board we are having a uart communication port and a LCD Interface Working
Bray Terminal
α–Development Board
RS 232 Connection
Software Code
- This is the C code inside the controller defining some initializing function as these function are defined for the Controller.
- The below code is define for the Interrupt Service Routine called when there is received buffer of USART is fill.Under which we are defining the lcd write to second line
USART Initialize
usart_init(ASYNC,EIGHT_BIT,NONE,ONE_BIT);
usart_rx_interrupt_en();
BAUD Rate Selection
#define BAUD 9600
#include
LCD Initialize
lcd_init();
lcd_cmd(0x01);
lcd_cmd(0x0c);
lcd_cmd(0x80);
lcd_puts_P(PSTR(" X2Alpha Lab"));
- The below code defined for the interrupt service routine of a timer as a comparator. Inside it data[] is a array storing the bit format of the message to be displayed. Since it is stored in the program memory therefor we read it from prog-mem by pgm_read_byte.
Interrupt Routine (USART_Receive)
lcd_cmd(0xc0+i);
lcd_data(receive);
i++;
if(i>15)i=0;



