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

Discussion in 'Embedded Systems and Microcontrollers' started by sathiyakumar, Jun 16, 2016.

  1. sathiyakumar

    Thread Starter New Member

    Mar 28, 2012
    3
    0
    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 (Text):
    1.  
    2. #include<pic.h>
    3. #define _XTAL_FREQ 11059200
    4. //__CONFIG (0X3FBA);
    5. __CONFIG (0X3F39);
    6.  
    7. void main()
    8. {
    9.   TRISB=0;
    10.   //for (;;)
    11.   while(1)
    12.   {
    13.   RB0=1;
    14.   RB1=1;
    15.   RB2=1;
    16.   RB3=1;
    17.  
    18.   __delay_ms(10);
    19.   RB0=0;
    20.   RB1=0;
    21.   RB2=0;
    22.   RB3=0;
    23.   //RB0=0;
    24.   __delay_ms(10);
    25.   }
    26. }
    27.  
     
    Last edited by a moderator: Jun 16, 2016
  2. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,675
    899
    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
     
  3. AlbertHall

    Well-Known Member

    Jun 4, 2014
    1,891
    375
  4. nerdegutta

    Moderator

    Dec 15, 2009
    2,515
    785
    Perhaps you have a schematic of a picture, in focus, to show us?
     
  5. JohnInTX

    Moderator

    Jun 26, 2012
    2,341
    1,023
    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.
     
  6. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,675
    899
    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
     
  7. JohnInTX

    Moderator

    Jun 26, 2012
    2,341
    1,023
    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..
     
  8. NorthGuy

    Active Member

    Jun 28, 2014
    603
    121
    Do you have the oscillator connected?
     
Loading...