Keil 8051 Tools
  Program

Post New Topic  Post A Reply
profile | register | preferences | faq | search

UBBFriend: Email This Page to Someone! next newest topic | next oldest topic
Author Topic:   Program
rohanmartin08
New Member
posted August 02, 2010 02:34 AM     Click Here to See the Profile for rohanmartin08   Click Here to Email rohanmartin08     Edit/Delete Message
Hi. I am writing a code for digital clock. Can anybody please find the bug for me in the following code?


void Timer0(void) interrupt 1
{
TF0=0;
TR0=0;
TH0=0xF8;
TL0=0x30;
TR0=1;


mscount++;
Dispcount++;
if(mscount>=1000)
{
mscount=0;
Seconds++;
}
if(Seconds>=59)
{
Seconds=0;
Minutes++;
}
if(Minutes>=59)
{
Minutes=0;
Hours++;
}
if(Hours>=12)
{
Hours=1;
}


{
if(Dispcount==29)
{
CS1=0;
CS2=0;
CS3=0;
CS4=0;
}
if(Dispcount==30)
{

DataWrite=Lookup[Display_Buffer[0]-0x30];

}



if(8>i)
{
i++;
if (Dispcount==32)
{
PIN_P11=1;
}
if (Dispcount==34)
{
Temp=DataWrite;
}
if (Dispcount==36)
{
PIN_P10=Temp^7;
}
if (Dispcount==38)
{
PIN_P11=0;
}
if (Dispcount==40)
{
DataWrite=_crol_(Temp,1);
}

}
PIN_P12=0;

if(Dispcount==48)
{
CS1=1;
}
}


{
if(Dispcount==49)
{
CS1=0;
CS2=0;
CS3=0;
CS4=0;
}
if(Dispcount==50)
{

DataWrite=Lookup[Display_Buffer[1]-0x30];

}

{

if(8>i)
{
i++;
if (Dispcount==52)
{
PIN_P11=1;
}
if (Dispcount==54)
{
Temp=DataWrite;
}
if (Dispcount==56)
{
PIN_P10=Temp^7;
}
if (Dispcount==58)
{
PIN_P11=0;
}
if (Dispcount==60)
{
DataWrite=_crol_(Temp,1);
}

}
PIN_P12=0;
}

if(Dispcount==68)
{
CS2=1;
}
}


{
if(Dispcount==69)
{
CS1=0;
CS2=0;
CS3=0;
CS4=0;
}
if(Dispcount==70)
{

DataWrite=Lookup[Display_Buffer[2]-0x30];

}

{

if(8>i)
{
i++;
if (Dispcount==72)
{
PIN_P11=1;
}
if (Dispcount==74)
{
Temp=DataWrite;
}
if (Dispcount==76)
{
PIN_P10=Temp^7;
}
if (Dispcount==78)
{
PIN_P11=0;
}
if (Dispcount==80)
{
DataWrite=_crol_(Temp,1);
}

}
PIN_P12=0;
}

if(Dispcount==88)
{
CS3=1;
}
}

{
if(Dispcount==89)
{
CS1=0;
CS2=0;
CS3=0;
CS4=0;
}
if(Dispcount==90)
{

DataWrite=Lookup[Display_Buffer[3]-0x30];

}

{

if(8>i)
{
i++;
if (Dispcount==92)
{
PIN_P11=1;
}
if (Dispcount==94)
{
Temp=DataWrite;
}
if (Dispcount==96)
{
PIN_P10=Temp^7;
}
if (Dispcount==98)
{
PIN_P11=0;
}
if (Dispcount==100)
{
DataWrite=_crol_(Temp,1);
}

}
PIN_P12=0;
}

if(Dispcount==108)
{
CS4=1;
}
}


if(Dispcount==821)
{
CS1,CS2,CS3,CS4=0;

}
}
RETI;

IP: Logged

Scotty
Member
posted August 02, 2010 04:58 AM     Click Here to See the Profile for Scotty     Edit/Delete Message
Answered here:
http://www.cygnal.org/ubb/Forum1/HTML/003324.html

Regards,

Scotty

IP: Logged

erikm
Member
posted August 02, 2010 06:31 AM     Click Here to See the Profile for erikm   Click Here to Email erikm     Edit/Delete Message
you show some scribbles, where is the program you refer to in the title?

a program is indented and has comments.

Erik

IP: Logged

pathipatijyothi
New Member
posted September 13, 2010 12:34 AM     Click Here to See the Profile for pathipatijyothi     Edit/Delete Message
Plz sir, I want GPIO interrupt programming code sir.Before 2 days I posted my question,but I did n't get answer till now. I don't know how to check the answer through this website.I checked in my mail. better to send to my mail(pathipatijyothi@gmail.com) sir.

IP: Logged

vanmierlo
Member
posted September 13, 2010 03:39 AM     Click Here to See the Profile for vanmierlo   Click Here to Email vanmierlo     Edit/Delete Message
pathipatijyothi,

You're only hijacking other peoples threads with unrelated questions. If you feel ignored, that is because you are (at least by me).

Maarten

IP: Logged

hero_hont
New Member
posted September 19, 2010 09:18 PM     Click Here to See the Profile for hero_hont   Click Here to Email hero_hont     Edit/Delete Message
I thinks long code, you can write small function and add program main code. when we can looking for error and run program

------------------
Vietnam Travel, Vietnam tours-Vietnam beaches- Hanoi tour and excursion

IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | MCU User Forum

Have you seen our MCU Knowledge Base?


Ultimate Bulletin Board 5.47b