| ??? 06/06/02 10:09 Read: times |
#23996 - LED not blinking.... |
Here is the program i wrote with the help of some material on internet. this program supposed to blink a LED on pin of 89c2051 uC. Now this is absolutely doing nothing. i checked the pin with the multimeter, no sign of activity on the port just constant 5V. i got a similar program in HEX compiled format and download it in my 8051. it run fine and LED blinks with 1 sec interval and multmeter also shows a lot of activity on the output pin. in case of my program there is absolutely no activity on multimeter. i suspect there is some thing i am missing in my program. i am using KEIL C51 uVision evaluation version which has a limitation of 2K program.
Also my LED is conneted on pin 1 of port 1 of 89c2051 with a resister between +5v and the output pin so LED becomes on when 0 is on the output. any help will highly appriciated as these are my early experiments with 8051. #include <reg52.h> void Simple_Delay_init(void); void Simple_Delay_Fifty_Milliseconds(void); void Simple_Delay_N_Seconds(int); #define Led_On (1); #define Led_Off (0); sbit Led_G = P1^0; void main(void) { Simple_Delay_init(); while(1) { Led_G = Led_On; Simple_Delay_N_Seconds(1); Led_G = Led_Off; Simple_Delay_N_Seconds(1); } } void Simple_Delay_N_Seconds(int i) { int j; for(j=1;j<i*20;j++) { Simple_Delay_Fifty_Milliseconds(); } } void Simple_Delay_Fifty_Milliseconds(void) { TR0 = 0; TH0 = 0x4B; TL0 = 0xFD; TF0 = 0; TR0 = 1; while(TF0 == 0); TR0 = 0; } void Simple_Delay_init(void) { TMOD |= 0x01; ET0 = 0; } |
| Topic | Author | Date |
| LED not blinking.... | 01/01/70 00:00 | |
| RE: LED not blinking.... | 01/01/70 00:00 | |
| RE: LED not blinking....,sorry | 01/01/70 00:00 | |
| RE: LED not blinking.... | 01/01/70 00:00 | |
| RE: LED not blinking.... | 01/01/70 00:00 | |
| RE: LED not blinking.... | 01/01/70 00:00 | |
| RE: LED not blinking.... | 01/01/70 00:00 | |
| RE: thanks all of u | 01/01/70 00:00 | |
RE: thanks all of u | 01/01/70 00:00 |



