vdurgaidass
Junior Member level 3
- Joined
- Jul 13, 2009
- Messages
- 27
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- India
- Activity points
- 1,525
Hi All
Request help for the following code. I am trying to toggle two LEDs at GPIO0 and GPIO1 of PIC12F629 with 0.5Sec delay. Problem is If I comment out any one LED other one toggles as desired.
But when I include both LEDs only one Toggles and other one is NOT Toggling ( remains ON always ). If I change the order of switching the LEDs, the one which was toggling remains ON and the other one is now toggling.
I have tried both MPASM and HiTech C in MPLAB IDE V8.53. I have replaced the 12F629 with new one also. But problem remains same.
If I introduce a delay of 100mS the commented out lines in the code below between the two port pin operation then both LEDs Toggling but one with different interval (not equal to 0.5 Sec). Any Help is welcome.
Thanks
V Durgaidass
Request help for the following code. I am trying to toggle two LEDs at GPIO0 and GPIO1 of PIC12F629 with 0.5Sec delay. Problem is If I comment out any one LED other one toggles as desired.
But when I include both LEDs only one Toggles and other one is NOT Toggling ( remains ON always ). If I change the order of switching the LEDs, the one which was toggling remains ON and the other one is now toggling.
I have tried both MPASM and HiTech C in MPLAB IDE V8.53. I have replaced the 12F629 with new one also. But problem remains same.
If I introduce a delay of 100mS the commented out lines in the code below between the two port pin operation then both LEDs Toggling but one with different interval (not equal to 0.5 Sec). Any Help is welcome.
Thanks
V Durgaidass
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 LED bsf GPIO,pin6 ;turn off LED2 ; call Del1 bcf GPIO,pin7 ;turn on LED1 call Del bcf GPIO,pin6 ;turn on LED2 ; call Del1 bsf GPIO,pin7 ;turn off LED1 call Del goto LED //////////////////// while(1) { LED1 = 1; // __delay_ms(100); LED1 = 0; __delay_ms(500); LED2 = 1; // __delay_ms(100); LED2 = 0; __delay_ms(500); }
Last edited by a moderator: