Blame | Last modification | View Log | Download
/* ---------------------------------------------------------------------------* AVR_MLIB - HD 44780 LCD Display Driver Test Application* www.mlab.cz miho 2008* ---------------------------------------------------------------------------* Simple test application for lcd_hd44780.h LCD library. This code ilustates* how to use and configure the library functions.* ---------------------------------------------------------------------------* 00.00 2008/03/28 First Version* 00.01 2008/04/19 Improved* ---------------------------------------------------------------------------*/// Required Libraries// ------------------// Delay#define F_CPU 1000000UL // CPU Frequency#include <util/delay.h> // Delay Routines// Standard Output Library#include <stdio.h> // For printf// LCD Display Interface// ---------------------// LCD Port Settings#define LCD_DATA B // 4 or 8 bits field (lsb port)#define LCD_DATA_BIT 0#define LCD_RS D // Register Select#define LCD_RS_BIT 4#define LCD_E D // Enable#define LCD_E_BIT 3// LCD Display Parameters#define LCD_INTERFACE_BITS 4 // 4 or 8 bit interface#define LCD_LINES 2 // 1 or 2 or 4 lines#define LCD_CHARS 16 // usualy 16 or 20, important for 4 line display only// LCD Library#include "lcd_hd44780.h"// Test Application// ----------------// Define Output Stream to LCDstatic FILE lcd_stream = FDEV_SETUP_STREAM(lcd_putc_stream, NULL, _FDEV_SETUP_WRITE);// Main Programint main (){int i;DDRB|= (1<<DDB6);DDRB|= (1<<DDB7);PORTB &= ~(1<<PB6);stdout = &lcd_stream; // Connect stdout to LCD Streamlcd_init(); // Init LCD (interface and display module)lcd_gotoxy(1,1);printf("stavebnice MLAB");_delay_ms(1000);while(1){lcd_gotoxy(2,2);printf("demo aplikace");_delay_ms(1000);lcd_gotoxy(2,2);printf(" ");PORTB|= (1<<PB6);_delay_ms(500);PORTB &= ~(1<<PB6);_delay_ms(5000);PORTB|= (1<<PB7);_delay_ms(500);PORTB &= ~(1<<PB7);_delay_ms(5000);}}