Apr 11, 2013 #1 M Murugesh_89 Full Member level 5 Joined Nov 23, 2012 Messages 266 Helped 7 Reputation 12 Reaction score 6 Trophy points 1,298 Location India Activity points 3,267 Hi, Below is the code for led glowing in pic16f876a micro controller ( pin RC0 ) through positive logic. But it is not working. What else should be done? #include<16f876a.h> #fuses HS,NODEBUG,PUT,NOWDT,PROTECT #use delay(clock = 8M) void main() { int i = 0; delay_ms(2000); set_tris_b(0b11111111); set_tris_c(0b00100000); output_high(PIN_C0); while(1); }
Hi, Below is the code for led glowing in pic16f876a micro controller ( pin RC0 ) through positive logic. But it is not working. What else should be done? #include<16f876a.h> #fuses HS,NODEBUG,PUT,NOWDT,PROTECT #use delay(clock = 8M) void main() { int i = 0; delay_ms(2000); set_tris_b(0b11111111); set_tris_c(0b00100000); output_high(PIN_C0); while(1); }
Apr 11, 2013 #2 H hemnath Advanced Member level 3 Joined Jun 24, 2012 Messages 702 Helped 61 Reputation 120 Reaction score 57 Trophy points 1,308 Location Chennai Activity points 6,588 Are you using CCS c compiler??? LED blinking ... HTML: #include "16f876a.h" #fuses HS #use delay(clock = 8000000) // 8MHZ crystal void main() { while(1) { output_high(PIN_C0); // pin C0 goes output high delay_ms(1000); // delay 1000ms output_low(PIN_C0); // pin C0 goes output low delay_ms(1000); // delay 1000ms } }
Are you using CCS c compiler??? LED blinking ... HTML: #include "16f876a.h" #fuses HS #use delay(clock = 8000000) // 8MHZ crystal void main() { while(1) { output_high(PIN_C0); // pin C0 goes output high delay_ms(1000); // delay 1000ms output_low(PIN_C0); // pin C0 goes output low delay_ms(1000); // delay 1000ms } }
Apr 11, 2013 #3 D duke_pl Newbie level 3 Joined Feb 19, 2013 Messages 3 Helped 1 Reputation 2 Reaction score 1 Trophy points 1,283 Activity points 1,291 Please show your hardware setup.
Apr 11, 2013 #4 M Murugesh_89 Full Member level 5 Joined Nov 23, 2012 Messages 266 Helped 7 Reputation 12 Reaction score 6 Trophy points 1,298 Location India Activity points 3,267 Hi duke, ckt is below.
Apr 11, 2013 #5 jayanth.devarayanadurga Banned Joined Dec 4, 2012 Messages 4,280 Helped 822 Reputation 1,654 Reaction score 791 Trophy points 1,393 Location Bangalore, India Activity points 0 Current limiting resistor connected to LED has high value. Make it 330 Ohms. Why did you PROTECT the code? :shock: Last edited: Apr 11, 2013
Current limiting resistor connected to LED has high value. Make it 330 Ohms. Why did you PROTECT the code? :shock: