A microcontroller is a device that has a built-in processor surrounded by some dedicated hardware modules. Once the microcontroller initializes them, they begin operating on their own. In case of an ADC it will do the sampling and digital to analog conversion by itself and keep the converted data in its buffer so that the microcontroller can read it later. The advantage of this type of implementation is that the microcontroller is free to perform other tasks during this period and therefore increases overall efficiency. This was the case with hardware modules or peripherals within a microcontroller that increase the processing efficiency of the embedded processor. Efficiency can increase further if the external hardware connected to the microcontroller can also perform many more tasks on its own without relying on the microcontroller. The hardware may or may not contain another processor so that it can perform a certain predetermined task after initialized by the microcontroller.
An example of such a device is the serial LCD scrolling display . Once the data to be displayed in scrolling is received from the microcontroller, it will start the operation on its own and carry out the scrolling process. This project explains LCD MODULE interface with any type of controller using a single serial receive pin. In this mode only one pin is used to send data. This scrolling display mode has an advantage over 8-bit mode in that it only uses a single pin. The remaining controller pins are available for normal use and the valuable processing power required to roll the dice can be used for any other purpose.
The project is discussed in two parts.
Part 1: To create an LCD module
In part an LCD module is created using the AVR controller and the 16×2 alphanumeric LCD display. The ATMEGA16 controller controls the LCD. The programmed code permanently dumped into this atmega16 is controlling the LCD module. A single receiver pin (RXD -14) of the ATMEGA16 is the only input of this LCD module. Data received via serial communication is displayed on the LCD module in scrolling form.
Fig. 2: Circuit configuration of LCD module built using AVR controller and 16×2 alphanumeric LCD display
Part 2: Interfacing the LCD module using any other microcontroller.
In part two, the controller used in our project is another AVR chip. Data is sent to the LCD module via the serial transmission pin (TXD-15). A switch demonstrated in our project provides the input to the controller.
Fig. 3: LCD module interface with the second AVR microcontroller to
A predefined text is transmitted to the LCD module each time the button is pressed. Whatever text is sent, the data will be scrolled on the LCD module.
Fig. 4: Data communication between the LCD Module and the AVR by configuring the serial transmission circuit on the breadboard
From this demonstration it can be seen that 8 data pins and 3 control pins of the microcontroller can be saved. These saved pins can be used for any other purpose.
Circuit Description:
LCD connections with ATmega16 are shown in the circuit diagram. In 4-bit mode, the data lines must be connected to pins D4, D5, D6 and D7 of the LCD module.
Project source code
###
#define F_CPU 8000000
###
#ifndef _LCD_H #define _LCD_H #ifndef F_CPU #define F_CPU 8000000 #endif #include<avr/io.h> #include<util/delay.h> #include<inttypes.h> #include <stdio.h> #include < string.h> #define rs PA0 #define rw PA1 #define en PA2 void lcd_init ; void dis_cmd(char); void dis_data(char); void lcdcmd(char); void lcddata(char); void lcd_clear(void); void lcd_2nd_line(void); void lcd_1st_line(void); void lcd_string(const char *data); int lcd_print(char c, FILE *stream); int lcd_scroll(const char *data); FILE lcd_out = FDEV_SETUP_STREAM(lcd_print, NULL, _FDEV_SETUP_WRITE); char disp_beg = " "; int lcd_print(char c, FILE *stream) { if('n' == c) lcd_2nd_line ; else dis_data(c); return 0; } #define F_CPU 8000000 #include <avr/io.h> #include <util/delay.h> #include <stdio.h> #include <avr/interrupt.h> #include "lcd.h" #include "usart .h" char A ( 150 ); char B ( 150 ); int main (void) { int i; usert_init; cli; lcd_init; printf("ENGINEERS"); printf("n GARAGE"); for ( i = 0; 'n' != ( A ( i ) = use_getch ); i ++ ); A(i) = '