Code not working in PIC

Status
Not open for further replies.

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);
}
 

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
   }
}
 

Please show your hardware setup.
 

Current limiting resistor connected to LED has high value. Make it 330 Ohms.

Why did you PROTECT the code? :shock:
 
Last edited:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…