//PROGRAM TO DISPLAY WELCOME on line1,enter from right,left justified.
//d0-d7 on port f and e and rs on portk
volatile uint8_t *outf,*outk;
volatile uint8_t arr[]={0x57,0x45,0x4C,0x43,0x4F,0x4D,0x45};
volatile uint8_t address;
volatile uint8_t j,i;
volatile uint32_t k;
void setup() {
// put your setup code here, to run once:
volatile uint8_t *dirf,*dirk;
dirf=0x30,dirk=0x107;
*dirf=0xff;*dirk=0x03;
outf=0x31;outk=0x108;
initialize();
for(i=0;i<16;i++){
address=0x8f-i;
for(j=0;j<=i;j++){
*outk=0x00;
*outf=address+j;
pulse_enable_command();
if(j<=6){
*outk=0x02;
*outf=arr[j];
pulse_enable_data();
}
else{
*outk=0x02;
*outf=0x20;
pulse_enable_data();
}
}
for(k=0;k<100000;k++);
if(i<15) clear_display();
}
}
void loop() {
// put your main code here, to run repeatedly:
}
void initialize(){
for(k=0;k<10000;k++);//15ms wait
//function set 2lines and 8 columns
*outk=0x00;// using lcd in command mode
*outf=0x38;//putting data
pulse_enable_command();
//turning the display ON
*outk=0x00;// using lcd in command mode
*outf=0x0c;//putting data
pulse_enable_command();
//clearing display
*outk=0x00;// using lcd in command mode
*outf=0x01;//putting data
pulse_enable_command();
}
void pulse_enable_data(){
*outk=0x03;//pulsing e
for(k=0;k<100;k++);
*outk=0x02;
}
void pulse_enable_command(){
*outk=0x01;//pulsing e
for(k=0;k<100;k++);
*outk=0x00;
}
void clear_display(){
*outk=0x00;// using lcd in command mode
*outf=0x01;//putting data
pulse_enable_command();
}