test file lcd driver for Xmega devices More...
Macros | |
#define | F_CPU 2000000UL |
F_CPU must be declared. | |
Functions | |
void | define_unused_data_lines (void) |
Defines unused data lines. More... | |
void | define_unused_rw_line (void) |
Defines unused R/W line. More... | |
void | lcd_print_mode (void) |
Print LCD mode. More... | |
void | lcd_print_busy_flag (void) |
Print if busyflag is used. More... | |
int | main (void) |
Main testprogram. More... | |
test file lcd driver for Xmega devices
This file contains the test for lcd library. This testprogram can be used for all four modes (4-bit/8-bit,busyfalg/no busyflag) It uses the default settings in lcd.h The data lines are connected to port A. The control lines R/W, RS and E are connect to the pins 3, 4 and 5 of port D. The circuit is in schematic below:
The schematic below gives an example with a 5 V display without using the busy flag. Input R/W off the display is now connected to the reference.
#define LCD_4BIT_MODE 1 #define LCD_BUSY_FLAG 0 #define LCD_DATA_PORT PORTD #define LCD_D4_bp PIN0_bp #define LCD_D5_bp PIN1_bp #define LCD_D6_bp PIN2_bp #define LCD_D7_bp PIN3_bp #define LCD_COMM_PORT PORTD #define LCD_RS_PORT LCD_COMM_PORT #define LCD_E_PORT LCD_COMM_PORT #define LCD_RS_bp PIN4_bp #define LCD_E_bp PIN5_bp
After changing lcd.h both lcd.c en test_lcd.c must be recompiled.
void define_unused_data_lines | ( | void | ) |
Defines unused data lines.
This function makes unused data lines output and makes this outputs low.
void define_unused_rw_line | ( | void | ) |
Defines unused R/W line.
This function makes unused r/w line output and make it low.
void lcd_print_busy_flag | ( | void | ) |
Print if busyflag is used.
This function printfs BF is busy flag is used and NO BF if no busyflag is used
void lcd_print_mode | ( | void | ) |
Print LCD mode.
This function printf 4 bit if the 4-bit mode is used and 8 bit if the 8-bit mode is used
int main | ( | void | ) |
Main testprogram.
This program prints on the first line of the LCD the text "Test" and a number counting from 0 until 999. On the second line it prints the LCD mode and if it uses the busy flag or not.