pic16f877 has been programmed using pickit 3 but its not working in target board

Thread Starter

sathiyakumar

Joined Mar 28, 2012
3
i am using mplab and execute the below program for sample and has been loaded in pic 16f877A . it was programmed without error by pic kit 3 . but when we check in target board its not working.

i also test by check read option . that time its working.

please let me know the solution
Code:
#include<pic.h>
#define _XTAL_FREQ 11059200
//__CONFIG (0X3FBA);
__CONFIG (0X3F39);

void main()
{
  TRISB=0;
  //for (;;)
  while(1)
  {
  RB0=1;
  RB1=1;
  RB2=1;
  RB3=1;

  __delay_ms(10);
  RB0=0;
  RB1=0;
  RB2=0;
  RB3=0;
  //RB0=0;
  __delay_ms(10);
  }
}
 
Last edited by a moderator:

jpanhalt

Joined Jan 18, 2008
11,087
i also test by check read option . that time its working.
Not quite sure what the underlined sentence means. Do you mean you read the chip and were able to see that it had been programmed?

It looks like your program is toggling 4 pins on PortB. Have you checked those pins with an oscilloscope? If you are using LEDs, a 10 ms delay may not allow you to see a flicker. Try 100 ms.

John
 

JohnInTX

Joined Jun 26, 2012
4,787
It should run - the config bits are OK but specifying the CONFIG bits like you have makes for difficult and error-prone reading. Using symbolic values for CONFIG bits (or at least comments) is much better.
Make sure you have Vdd/GND on the 4 pins, that MCLR/ is pulled up and that you have an external crystal properly connected.
Instead of individual LED operations, try something like
while(1){
PORTB = 0xff;
delay
PORTB = 0x00;
delay
}
Good luck.
 

jpanhalt

Joined Jan 18, 2008
11,087
Since the TS has not responded, maybe it worked with longer delays so he could see the LED's.

My first concern was whether he had confirmed successful programming, which was not clear to me. RB3 is the PGM pin for ICSP on that chip. There was no mention of the circuit he was using nor whether it was truly in circuit, rather than a bare chip on a breakout board. If that pin were connected via a low value resistor to a diode, it might interfere with programming.

John
 

JohnInTX

Joined Jun 26, 2012
4,787
Since the TS has not responded, maybe it worked with longer delays so he could see the LED's.

My first concern was whether he had confirmed successful programming, which was not clear to me. RB3 is the PGM pin for ICSP on that chip. There was no mention of the circuit he was using nor whether it was truly in circuit, rather than a bare chip on a breakout board. If that pin were connected via a low value resistor to a diode, it might interfere with programming.

John
Good thought on longer delays. He should not be having problems with RB3 since LVP is disabled in his config word (bit 7 = 0). Hard to see from the code though..
 
Top