tag:blogger.com,1999:blog-2190029239849113272.post7456443881759827795..comments2023-09-24T07:53:17.180-07:00Comments on ELECTRONICS LAB: How To Read The Timer Value Of 89c51 When Program RunningAnonymoushttp://www.blogger.com/profile/13526216155838659104noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-2190029239849113272.post-30742288326131170792014-06-14T09:17:05.416-07:002014-06-14T09:17:05.416-07:00Hello Muhammad,
I need your little help.
I'm ...Hello Muhammad, <br />I need your little help.<br />I'm currently working on 8951, there I am getting problem to read timer value.<br />I am here explaining algorithm<br />can you please help me for this,i will be grateful to you.<br />ALGORITHM:<br />1.Using external interrupt<br />2.If 1st interrupt goes high from external interrupt then start timer<br />3.If 2nd interrupt goes high from external interrupt then stop timer<br />4.Read timer value on any pin.<br /><br />here is code i tried.<br /><br />#include <br /><br />sbit V=P3^4;<br />sbit C=P3^5;<br />sbit Led1=P1^1;<br />sbit Led2=P1^2;<br />void timer1(void);<br />void main()<br />{<br /> P3=0x00;<br /> P2=0x00;<br /> P1=0x00;<br /> EA=1;<br /> EX1=1;<br /> IE=1;<br /> timer1();<br />}<br />void tiemr1 ();<br />void timer1 (void) interrupt 1<br />{<br /> TMOD=0x01;<br /> TH0=0x00;<br /> TL0=0x00;<br /> if(V==1)<br /> {<br /> TR0=1;<br /> while(TF0==0);<br /> }<br /> else if(C==1)<br /> {<br /> TR0=0;<br /> TF0=0;<br /> }<br /> else<br /> {;}<br /> Led1=TL0;<br /> Led2=TH0; <br />}Anonymoushttps://www.blogger.com/profile/05741356033563366834noreply@blogger.com