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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/16/04 16:19
Read: times


 
#68637 - RE: 8051 and for led
Responding to: ???'s previous message
Alex per wrote:
-------------------------------

I dont have a scop at home.

about the timer I copied the wrong code
this is what I downloaded to the controller

 #include 
 
 void timer(void){
 int t;
  
 t=0;
 while(t!=100){
 t=t+1;
 TF0 = 0;
 TH0 = 0x00;
 TL0 = 0x00;
 TR0 = 1;/*turn timer on*/
 while (!TF0);
 TR0 = 0;
 
 }
}

void main (){
	while(1){
	if (P1_4==0){
		 P3=0;
		 timer();
		 P3=0;
		 P3_2=1;
		 timer();
		 P3=0;
		 P3_3=1;
		 timer();
		 P3=0;
		 P3_4=1;
		 timer();
		 P3=0;
		 P3_5=1;
		 }
	 if (P1_4==1){
	  	P3=0xff;
	 }	 
	 }
}



There still is no sign of initialising timers. Besides that in the main while loop, the first P3=0 should be put before the while loop, if you want P3_5=1 to be effective...

Are you sure P1_4 is an input?


If you have no scope and things do not work, then start by something that is much simpler. Start by switching on or of a single led, and as soon as that works, try something else. A scope would be highly recommended however. You eventually could build a simple logic tester that detects the presence of pulses (search on the web for schematics...)


regards
Patrick

List of 13 messages in thread
TopicAuthorDate
8051 and for led            01/01/70 00:00      
   RE: 8051 and for led            01/01/70 00:00      
      RE: 8051 and for led            01/01/70 00:00      
         RE: 8051 and for led            01/01/70 00:00      
            RE: 8051 and for led            01/01/70 00:00      
               RE: 8051 and for led            01/01/70 00:00      
                  RE: 8051 and for led            01/01/70 00:00      
                     RE: 8051 and for led            01/01/70 00:00      
                        RE: 8051 and for led            01/01/70 00:00      
                     on more thing            01/01/70 00:00      
                  RE: 8051 and for led            01/01/70 00:00      
                     RE: 8051 and for led            01/01/70 00:00      
                        RE: 8051 and for led            01/01/70 00:00      

Back to Subject List