Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/21/03 09:07
Read: times


 
#46195 - RE: 80C320 port pins
Responding to: ???'s previous message
thanx kai, had not disabled interrupts.

also can anyone tell me why this timer routine wont work. in the main loop, i'm waiting for timerflag to be set and then restting it b4 proceeding. the timer overflows at 100 Hz. to make it a 1s interrupt , i've added timerflag, but the loop wont continue after that.. any suggestions?

#define TIMER0_COUNT 0xDC11
void timer0init(void)
{
EA = 0;
EA = 0; // disable interrupts
timertick = 0;
TR0 = 0; // stop timer 0

TL0 = (TIMER0_COUNT & 0x00FF);
TH0 = (TIMER0_COUNT >> 8);
PT0 = 0; // set low priority for timer 0
ET0 = 1; // enable timer 0 interrupt
TR0 = 1; // start timer 0
EA = 1;
}

static void timer0delay(void)interrupt 1 using 1 // 100 Hz interrupt
{
TR0 = 0; // stop timer 0
TL0 = TL0 + (TIMER0_COUNT & 0x00FF);
TH0 = TH0 + (TIMER0_COUNT >> 8);
TR0 = 1; // start timer 0
timertick++;
if(timertick >= 100 )
{
timerflag = 1;
timertick = 0;
}

}

List of 7 messages in thread
TopicAuthorDate
80C320 port pins            01/01/70 00:00      
   RE: 80C320 port pins            01/01/70 00:00      
   RE: 80C320 port pins            01/01/70 00:00      
   RE: 80C320 port pins            01/01/70 00:00      
      RE: 80C320 port pins            01/01/70 00:00      
   RE: 80C320 port pins            01/01/70 00:00      
   RE: 80C320 port pins            01/01/70 00:00      

Back to Subject List