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:37
Read: times


 
#46199 - RE: 80C320 port pins
Responding to: ???'s previous message
The logic in your timer interrupt routine looks incorrect. I'm not so sure you want to add the halves of TIMER0_COUNT to TL0 & TH0 like you are. It would seem to be more correct to write it as....
static void timer0delay(void) interrupt 1 using 1 
{ 
    unsigned int tmr_ovf;

    TR0 = 0;         // stop timer 0
    tmr_ovf = (unsigned int)(TH0 << 8) + TL0;
    tmr_ovf += TIMER0_COUNT;
    TL0 = tmr_ovf & 0x00FF;
    TH0 = tmr_ovf >> 8;
    TR0 = 1;        // start timer
    timertick++; 
    if(timertick >= 100) 
    { 
        timerflag = 1; 
        timertick = 0; 
    } 
}


Michael Karas


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