| 359 | kaklik | 1 | /****************************************************************************
 | 
        
           |  |  | 2 |  Title  :   C Test program for the LCD FUNCTIONS library (test_lcd.c)
 | 
        
           |  |  | 3 |  Author:    Chris efstathiou hendrix@otenet.gr
 | 
        
           |  |  | 4 |  Date:      1/Jul/2002
 | 
        
           |  |  | 5 |  Software:  AVR-GCC with AVR-AS
 | 
        
           |  |  | 6 |  Target:    any AVR device
 | 
        
           |  |  | 7 |  Comments:  This software is FREE.
 | 
        
           |  |  | 8 |   | 
        
           |  |  | 9 | *****************************************************************************/
 | 
        
           |  |  | 10 | #define  F_CPU   3686400L
 | 
        
           |  |  | 11 |   | 
        
           |  |  | 12 | #include <io.h>
 | 
        
           |  |  | 13 | #include "lcd_io.h"
 | 
        
           |  |  | 14 |   | 
        
           |  |  | 15 |   | 
        
           |  |  | 16 | void main(void)
 | 
        
           |  |  | 17 | {
 | 
        
           |  |  | 18 |   | 
        
           |  |  | 19 |  /* Since we also test the eeprom DONT! forget to write the test_lcd.eep to AVR's eeprom 
 | 
        
           |  |  | 20 |      otherwise the lcd will not show the eeprom_string                                       */
 | 
        
           |  |  | 21 |   static  unsigned char eeprom_string[]__attribute__((section(".eeprom")))={"lcd_puts_e testing"};
 | 
        
           |  |  | 22 |   unsigned char ram_string[]={"DONE TESTING..."};
 | 
        
           |  |  | 23 |   unsigned int pos=0;
 | 
        
           |  |  | 24 |   | 
        
           |  |  | 25 |    lcd_init();         /* lcd(s) is(are) initialized and if more than 1, lcd unit 0 gets active */
 | 
        
           |  |  | 26 |   | 
        
           |  |  | 27 |    lcd_clrscr();
 | 
        
           |  |  | 28 |    lcd_gotoxy(0,0);  lcd_puts_P("NOT VISIBLE LINE");
 | 
        
           |  |  | 29 |    lcd_clrline(0);   lcd_puts_P( "Hello World\nthis is line 2" );
 | 
        
           |  |  | 30 |   | 
        
           |  |  | 31 | #if LCD_AUTO_LINE_FEED == 1
 | 
        
           |  |  | 32 |    lcd_gotoxy(0,2);  lcd_puts_e(eeprom_string); lcd_puts(ram_string);  
 | 
        
           |  |  | 33 | #elif LCD_AUTO_LINE_FEED == 0
 | 
        
           |  |  | 34 | /*---------------------------------------------------------------------------------------------------*/
 | 
        
           |  |  | 35 | /*
 | 
        
           |  |  | 36 |    I puted this command here to test the correct saving of the lcd x,y coordinates
 | 
        
           |  |  | 37 |    between lcd unit switching, if you select mode 7 
 | 
        
           |  |  | 38 | */
 | 
        
           |  |  | 39 |    lcd_gotoxy(0,2);
 | 
        
           |  |  | 40 | /*---------------------------------------------------------------------------------------------------*/
 | 
        
           |  |  | 41 | #if   LCD_IO_MODE == 7
 | 
        
           |  |  | 42 |    select_lcd(LCD_1);
 | 
        
           |  |  | 43 |    lcd_clrscr();
 | 
        
           |  |  | 44 |    lcd_clrline(0);   lcd_puts_P( "This is display #2" );
 | 
        
           |  |  | 45 |    select_lcd(LCD_0);
 | 
        
           |  |  | 46 | #endif
 | 
        
           |  |  | 47 | /*---------------------------------------------------------------------------------------------------*/
 | 
        
           |  |  | 48 |    lcd_puts_e(eeprom_string);
 | 
        
           |  |  | 49 |    lcd_gotoxy(0,3); lcd_puts(ram_string);  
 | 
        
           |  |  | 50 | #endif /* #elif LCD_AUTO_LINE_FEED == 0 */
 | 
        
           |  |  | 51 |   | 
        
           |  |  | 52 |    lcd_gotoxy(16,3); lcd_puti(pos,2);  pos=lcd_getxy();
 | 
        
           |  |  | 53 |    lcd_gotoxy(16,3); lcd_puti(pos,2);  
 | 
        
           |  |  | 54 |   | 
        
           |  |  | 55 | }
 | 
        
           |  |  | 56 | /*######################################################################################################*/
 | 
        
           |  |  | 57 | /*                                         T H E   E N D                                                */
 | 
        
           |  |  | 58 | /*######################################################################################################*/
 | 
        
           |  |  | 59 |   |