Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

digital clock using 18F4550

Status
Not open for further replies.

akhter900

Junior Member level 1
Joined
Jun 7, 2009
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,456
hie....

I tried to count the second but its not working.
I just take a look on some examples that is given in the CCS compiler but my program does not count the second properly. It becomes slow.

Any body can give me some tips about this?

==========================
#define INTS_PER_SECOND 76
.......
#int_rtcc
void clock_isr() {

if(--int_count==0)
{
++seconds;
int_count=INTS_PER_SECOND;

TIME[S_]++;
if(TIME[S_] >= 60)
{
TIME[S_]=0;
TIME[M_]++;
}
if(TIME[M_] >= 60)
{
TIME[M_]=0;
TIME[H_]++;
}
if(TIME[H_] >= 12)
{
TIME[H_]=0;
}
}
}

void main()
{
..........
int_count=INTS_PER_SECOND;
set_timer0(0);
setup_counters( RTCC_INTERNAL, RTCC_DIV_256 | RTCC_8_BIT);
enable_interrupts(INT_RTCC);
enable_interrupts(GLOBAL);
......
}
==========================

Added after 1 hours 7 minutes:

How can I count the value for....
INTS_PER_SECOND
???
 

I use the line.... and its working well...

#define INTS_PER_SECOND 183

thanks
 

Hi. what crystal oscillator are you using because from your code, for 183 to be accurate for 1second generation,(999424uS), you must use 48MHz oscillation. I like the coding.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top