This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

timer counting in AT89s8252

i'm currently doing a code on counting timer but there are error while my port3^2 and port^2(START==0&&STOP==0)and port3^2 and port^2(START==0&&STOP==1) and then it goes into the disassembly then cant debug
anyone can help me to correct my error please and thank you...^^
my code goes like this:
#include <AT898252.H>
unsigned char pulse_low=0,pulse_high=0 ;
unsigned int overflow_count=0,int_count=1,pulse=0;
long int pulse_width=0;
sbit STOP=P3^2;
sbit START=P3^3;
void main()
{ TMOD=0x90;
TF1=0;
IT1=1;
IE=0x8c;
while(1) {
unsigned int a; if(START==1&&STOP==0)
{ a=0;
} else if(START==0&&STOP==1)
{ a=1;
} else if(START==0&&STOP==0)
{ a=2;
} else if (START==1&&STOP==1)
{ a=3;
} switch(a) {
case 0:
{ TR1=1;
break;
} case 1:
{ pulse_low=TL1;
pulse_high=TH1;
pulse=(TH1<<8)+TL1;
pulse_width=(overflow_count)*65536+pulse;
TH1=0x00: TL1=0x00; overflow_count=0; break;
} default:
{ break;
} }
} }
void timer1_int()interrupt 3
{ overflow_count++;
}

0