akhter900
Junior Member level 1
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 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
???