Tutorial 4B - Scrolling Words On Lcd Display - ablelogic AVR-DK20A User Manual

Avr development board
Table of Contents

Advertisement

A.11 Tutorial 4b – Scrolling Words on LCD Display
//Tutorial 4b
//Title : LCD Display with Scrolling words
//Jumper for LCD : LK2-LK8
//Jumper Setting: A1-E,A2-RS,A3-RW,A4-LD4,A5-LD5,A6-LD6,A7-LD7
//Display a word - 1st Row of LCD : 4Bit LCD Display
//Display a word - 2n Rom of LCD :
//Clear screen
//Display a word and scrolling left right on 1st row : "Ablelogic AVRKit"
//Display a word and scrolling left right on 2nd row : "AVR-DK20A"
// LCD module connections
sbit LCD_RS at PORTA2_bit;
sbit LCD_EN at PORTA1_bit;
sbit LCD_D4 at PORTA4_bit;
sbit LCD_D5 at PORTA5_bit;
sbit LCD_D6 at PORTA6_bit;
sbit LCD_D7 at PORTA7_bit;
sbit LCD_RS_Direction at DDA2_bit;
sbit LCD_EN_Direction at DDA1_bit;
sbit LCD_D4_Direction at DDA4_bit;
sbit LCD_D5_Direction at DDA5_bit;
sbit LCD_D6_Direction at DDA6_bit;
sbit LCD_D7_Direction at DDA7_bit;
// End LCD module connections
char txt1[] = "Ablelogic AVRKit";
char txt2[] = "AVR-DK20A";
char txt3[] = "4Bit LCD Display";
char txt4[] = "Example";
char i;
void main(){
DDRA = 0xff;
PORTA3_bit = 0;
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Out(1,1,txt3);
Lcd_Out(2,6,txt4);
Delay_ms(2000);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,txt1);
Lcd_Out(2,4,txt2);
Delay_ms(2000);
// Moving text
for(i=0; i<4; i++) {
AVR Development Board – AVR-DK20A User Manual
Example
// Loop variable
// Initialize Lcd
// Clear display
// Cursor off
// Write text in first row
// Write text in second row
// Clear display
// Write text in first row
// Write text in second row
// Move text to the right 4 times
40

Advertisement

Table of Contents
loading

Table of Contents