This is the video of practical and simulation
You also can watch the video in this YouTube link below:
Pin description LCD display:
LCD pin diagram
Pin Symbol Description
1 GND Ground
2 Vcc +5V
3 Vee Contrast Adjustment -2V to -5V
4 RS Register Select
5 R/W 1 - Read, 0 - Write
6 EN Enable
7 DB0 Data Line
8 DB1 Data Line
9 DB2 Data Line
10 DB3 Data Line
11 DB4 Data Line
12 DB5 Data Line
13 DB6 Data Line
14 DB7 Data Line
15 Led+ Power supply for back light, Vcc
16 Led- GND connection for back light, GND
C Program:
#include <reg52.h>
#include "stdio.h"
#include "lcd_header.c"
#include "delay.c"
#define DATA P2
sbit SW0 = P1^0;
const unsigned int str[10];
int milisec,sec,minute;
char flag = 0;
void main (void)
{
Initialize_LCD();
send_control(0x80);
puts_lcd(" FIQ MAL JAHID ");
send_control(0xC0);
puts_lcd(" STOPWATCH ");
while(SW0);
delay_1ms(10);
send_control(0x01);
delay_1ms(100);
while(1)
{
milisec++;
delay_1ms(50);
if (milisec>=10){
milisec=0;
sec++;
if (sec>=60){
sec=0;
minute++;
}
}
send_control(0x80);
sprintf(str," %d:%d:%d ",minute,sec,milisec);
puts_lcd(str);
if (!SW0 && flag==0){
delay_1ms(100);
send_control(0xC0);
sprintf(str,"LAP1: %d:%d:%d ",minute,sec,milisec);
puts_lcd(str);
flag=1;
}
if (!SW0 && flag==1){
delay_1ms(100);
send_control(0x80);
sprintf(str,"LAP2: %d:%d:%d ",minute,sec,milisec);
puts_lcd(str);
milisec=sec=minute=0;
ET0=0;
while(SW0);
delay_1ms(100);
milisec=sec=minute=0;
flag=0;
send_control(0x01);
puts_lcd("");
ET0=1;
}
}
}
Download C program, HEX file, Proteus simulation file, etc using below link.
No comments:
Post a Comment