Módulo de exibição de rolagem LCD – (Parte 30/46)

LCD Scrolling Display Module – (Part 30/46)

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.
  Configuração do circuito do módulo LCD construído usando controlador AVR e display LCD alfanumérico 16x2
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.
Interface do módulo LCD com o segundo microcontrolador AVR para
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.
Comunicação de dados entre o Módulo LCD e o AVR através da configuração do circuito de transmissão serial na placa de ensaio
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
#include #include #include #include #include "usart.h" void switch_init(void); int main (void) { usert_init; switch_init; while (1) { PORTD &= 0x7F; _delay_ms (2000); PORTD = 0x80; while ( 0x0F == ( PINC & 0x0F ) ); //wait until any key is pressed _delay_ms(50); usage_send_string("This is a demo of the single-line LCD scrolling display module interface by Garagem dos Engenheiros !!!n" ); _delay_ms(500); } } empty switch_init (empty) { cli; DDRC &= 0xE0; PORTC = 0xFF; DDRD = 0x80; PORTD = 0x80; }

#define _USART_H #ifndef F_CPU #define F_CPU 8000000 #endif #define USART_BAUDRATE 9600 #define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1) #include #include #include void usert_init ; void usert_putch(unsigned character send); unsigned int user_getch; void usert_send_string(const char* data); int uart_print(char c, FILE *stream); uart_out FILE = FDEV_SETUP_STREAM(uart_print, NULL, _FDEV_SETUP_WRITE); int uart_print(char c, FILE *stream) { if (c == 'n') uart_print('r', stream); loop_until_bit_is_set(UCSRA, UDRE); UDR = c; return 0; } void usert_init { UCSRB = (1< > 8); // Loads the upper 8 bits of the baud rate value.. // into the high byte of the UBRR register stdout = &uart_out; } void usert_putch(unsigned character send) { while ((UCSRA & (1 << UDRE)) == 0); // Do nothing until the UDR is ready. // so that more data is written to it UDR = send; // Send the byte } unsigned int gerar_getch { while ((UCSRA & (1 << RXC)) == 0); // Do nothing until the data has been received and is ready to be read into the UDR return(UDR); // returns the byte } void gerart_send_string(const char* data) { for(; *data; data ++) usage_putch(*data); } #end if

###

Project source code

###

#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) = '

Related Content

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.