LCD Flex LCD 420 PRGM
LCD Flex LCD 420 PRGM
#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
#include <Flex_LCD420.c>
//===================================
void main()
{
int8 i;
int8 b1, b2, b3, b4;
// The lcd_init() function should always be called once,
// near the start of your program.
lcd_init();
// Clear the LCD.
printf(lcd_putc, "\f");
delay_ms(500);
while(1)
{
// Test the clear screen and newline commands.
// Also test that we can write to all 4 lines.
printf(lcd_putc, "\fThis is the 1st line");
printf(lcd_putc, "\nNext is the 2nd line");
printf(lcd_putc, "\nThis is the 3rd line");
printf(lcd_putc, "\nFinally the 4th line");
delay_ms(3000);
// Test some additional characters.
printf(lcd_putc, "\fABCDEFGHIJKLMNOPQRST");
printf(lcd_putc, "\nabcdefghijklmnopqrst");
printf(lcd_putc, "\n12345678901234567890");
printf(lcd_putc, "\n!@#$^&*(){}[]:;<>?/=");
delay_ms(3000);
// Clear the LCD.
printf(lcd_putc, "\f");
delay_ms(500);
// Test that lcd_gotoxy() works. Go to each of
// the four corners and put a number in each one,
// in a clockwise direction, starting with the upper
// left corner.
lcd_gotoxy(4, 2);
printf(lcd_putc, "Put a number in");
lcd_gotoxy(4, 3);
printf(lcd_putc, "each corner.");
lcd_gotoxy(1, 1);
printf(lcd_putc, "1");
lcd_gotoxy(20, 1);
printf(lcd_putc, "2");
lcd_gotoxy(20, 4);
printf(lcd_putc, "3");
lcd_gotoxy(1, 4);
printf(lcd_putc, "4");
delay_ms(3000);
//
//
//
//
//
//
//
//
#ifdef USE_RW_PIN
// Test if lcd_getc() can read
// a byte from each corner.
b1 = lcd_getc(1,1);
b2 = lcd_getc(20,1);
b3 = lcd_getc(20,4);
b4 = lcd_getc(1,4);
lcd_gotoxy(1, 1);
printf(lcd_putc, "\fRead these bytes\n");
printf(lcd_putc, "from the 4 corners:\n\n");
printf(lcd_putc, "
%c %c %c %c", b1, b2, b3, b4);
delay_ms(3000);
#endif
// Type some characters and backspace over them.
printf(lcd_putc, "\fType characters and\n");
printf(lcd_putc, "backspace over them.");
delay_ms(2000);
// Go to end of 2nd line.
lcd_gotoxy(20, 2);
// Backspace over 2nd line.
for(i = 0; i < 20; i++)
{
printf(lcd_putc," \b\b");
delay_ms(150);
}
// Go to end of first line.
lcd_gotoxy(20, 1);
// Backspace over first line.
for(i = 0; i < 20; i++)
{
printf(lcd_putc," \b\b");
delay_ms(150);
}
}
}