LCD Circuit
//Exercise1LCD : Display “WELCOME”
#include <18f4550.h> //Header File
#fuses HS, NOWDT, NOLVP ,NOPROTECT
#use delay (clock=20M)
//Define LCD PIN
#define LCD_ENABLE_PIN PIN_D0
#define LCD_RS_PIN PIN_D1
#define LCD_RW_PIN PIN_D2
#define LCD_DATA4 PIN_D4
#define LCD_DATA5 PIN_D5
#define LCD_DATA6 PIN_D6
#define LCD_DATA7 PIN_D7
//Include LCD Library
#include //Library LCD
//Main Function
Void main()
{
lcd_init();
//Initialize LCD
While(true)
{
Printf(lcd_putc,”\fWELCOME\nMY
FRIEND”);
delay_ms(100);
}
}
/**************************************************************/
//Exercise2LCD : Display “WELCOME” at correct
coordinate
#include <18f4550.h>//Header File
#fuses HS, NOWDT, NOLVP ,NOPROTECT
#use delay (clock=20M)
//Define LCD PIN
#define LCD_ENABLE_PIN PIN_D0
#define LCD_RS_PIN PIN_D1
#define LCD_RW_PIN PIN_D2
#define LCD_DATA4 PIN_D4
#define LCD_DATA5 PIN_D5
#define LCD_DATA6 PIN_D6
#define LCD_DATA7 PIN_D7
//Include LCD Library
#include //Library LCD
//Main Function
Void main()
{
Lcd_init();
//Initialize LCD
While(true)
{
Lcd_putc(“\f”);
//Clear screen
Lcd_gotoxy(3,1);
Lcd_putc(“PRAY
TO”);
Lcd_gotoxy(5,2);
Lcd_putc(“MH370”);
Delay_ms(100);
}
}
/**************************************************************/
//Exercise3LCD : Message blink
#include <18f4550.h>//Header File
#fuses HS, NOWDT, NOLVP ,NOPROTECT
#use delay (clock=20M)
//Define LCD PIN
#define LCD_ENABLE_PIN PIN_D0
#define LCD_RS_PIN PIN_D1
#define LCD_RW_PIN PIN_D2
#define LCD_DATA4 PIN_D4
#define LCD_DATA5 PIN_D5
#define LCD_DATA6 PIN_D6
#define LCD_DATA7 PIN_D7
//Include LCD Library
#include //Library LCD
//Main Function
Void main()
{
Int
I;
Lcd_init();
//Initialize LCD
While(true)
{
For(i=0;
i<=4; i++)
{
Lcd_putc(“\f”);
//Clear screen
Delay_ms(250);
Lcd_gotoxy(3,1);
Lcd_putc(“PRAY
TO”);
Lcd_gotoxy(5,2);
Lcd_putc(“MH370”);
Delay_ms(250);
}
}
}
/**************************************************************/
//Exercise4LCD : Scroll Message Left Right
#include <18f4550.h>//Header File
#fuses HS, NOWDT, NOLVP ,NOPROTECT
#use delay (clock=20M)
//Define LCD PIN
#define LCD_ENABLE_PIN PIN_D0
#define LCD_RS_PIN PIN_D1
#define LCD_RW_PIN PIN_D2
#define LCD_DATA4 PIN_D4
#define LCD_DATA5 PIN_D5
#define LCD_DATA6 PIN_D6
#define LCD_DATA7 PIN_D7
//Include LCD Library
#include //Library LCD
//Main Function
Void main()
{
Int
I;
Lcd_init();
//Initialize LCD
While(true)
{
For(i=1;
i<=2; i++)
{
Lcd_putc(“\f”);
//Clear screen
Lcd_gotoxy(i,1);
Lcd_putc(“PRAY
TO”);
Lcd_gotoxy(16-i,2);
Lcd_putc(“MH370”);
Delay_ms(250);
}
}
}
/**************************************************************/
//Exercise5LCD : Scroll Message Up Down
#include <18f4550.h>//Header File
#fuses HS, NOWDT, NOLVP ,NOPROTECT
#use delay (clock=20M)
//Define LCD PIN
#define LCD_ENABLE_PIN PIN_D0
#define LCD_RS_PIN PIN_D1
#define LCD_RW_PIN PIN_D2
#define LCD_DATA4 PIN_D4
#define LCD_DATA5 PIN_D5
#define LCD_DATA6 PIN_D6
#define LCD_DATA7 PIN_D7
//Include LCD Library
#include //Library LCD
//Main Function
Void main()
{
Int
I;
Lcd_init();
//Initialize LCD
While(true)
{
For(i=1;
i<=2; i++)
{
Lcd_putc(“\f”);
//Clear screen
Lcd_gotoxy(5,i);
Lcd_putc(“PRAY
TO”);
Lcd_gotoxy(5,i-1);
Lcd_putc(“MH370”);
Delay_ms(250);
}
}
}
/**************************************************************/
//Exercise4LCD : Button
#include <18f4550.h>//Header File
#fuses HS, NOWDT, NOLVP ,NOPROTECT
#use delay (clock=20M)
//Define LCD PIN
#define LCD_ENABLE_PIN PIN_D0
#define LCD_RS_PIN PIN_D1
#define LCD_RW_PIN PIN_D2
#define LCD_DATA4 PIN_D4
#define LCD_DATA5 PIN_D5
#define LCD_DATA6 PIN_D6
#define LCD_DATA7 PIN_D7
#define BUTTON PIN_B0
//Include LCD Library
#include //Library LCD
//Main Function
Void main()
{
Set_tris_b(0xff);
Int
I;
Lcd_init();
//Initialize LCD
While(true)
{
If(input(BUTTON))
{
Lcd_putc(“\fNO
BUTTON\nPRESSED”);
Delay_ms(100);
}
Else
{
For(i=1; i<=16; i++)
{
Lcd_putc(“\f”); //Clear screen
Lcd_gotoxy(i,1);
Lcd_putc(“PRAY TO”);
Lcd_gotoxy(16-i,2);
Lcd_putc(“MH370”);
Delay_ms(250);
}
}
}
}
}
/**************************************************************/
|
No comments:
Post a Comment