Microcontroller › 8051 › how to reset time in lcd using interrupt(using 89s52 microcontroller)
- This topic has 0 replies, 1 voice, and was last updated 11 years, 4 months ago by
manohar.
-
AuthorPosts
-
November 20, 2011 at 1:26 pm #1408
manohar
Participantsir i got output to display time in lcd using 89s52.but i need the help whenever i press the switch in the board the time will start from beginning using external interrupt.
here is the code how to modify the code.#include<reg51.h>
#define cont_port P3
#define port P1
#define dataport P2 // Data port for LCD
#define m_sec 10
sbit rs = cont_port^0;
sbit rw = cont_port^1;
sbit en = cont_port^6;
sbit dig_hr1=port^0;
sbit dig_min1=port^1;
sbit start=port^2;
sbit am_pm=port^3;
int hr ,hr1=0;
int min,min1=0;
int sec,sec1=0,dig_am_pm=0;void delay(unsigned int msec) // Time delay funtion
{
int i,j ;
for(i=0;i<msec;i++)
for(j=0;j<1275;j++);
}void lcd_cmd(unsigned char item) // Function to send command on LCD
{
dataport = item;
rs= 0;
rw=0;
en=1;
delay(1);
en=0;
return;
}void lcd_data(unsigned char item) // Function to send data on LCD
{
dataport = item;
rs= 1;
rw=0;
en=1;
delay(1);
en=0;
return;
}void lcd_data_string(unsigned char *str) // Function to send string on LCD
{
int i=0;
while(str!=’