having error in Burning Hex file to PIC16F877a

Discussion in 'Embedded Systems and Microcontrollers' started by bobparihar, Oct 17, 2014.

  1. bobparihar

    Thread Starter Member

    Jul 31, 2014
    93
    0
    Iam using Pic kit 2 burner
    on my pic board there is a 8 Mhz crystal oscilator
    iam using Mikro C for devloping code and i have selected 8Mhz frequency at the starting of new project
    previously i was selecting 20Mhz for the code( i got to know that i was wrong)

    i did select edit project from the project tool and in the oscillator section i have selected XT( coz someone had told me that if we use crystal of below 8 Mhz we have to select Xt and above that Hs is selected)

    before that i was using default Hs for 8 Mhz and now when

    i did the same i was instructed and when i burned it into the MCU using Pic Kit 2 what i see that it says device error after once it had
    burned the hex file into it( and same with the another controller) and the device not found error on PIC kit 2

    iam confused please somebody correct me
     
  2. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    You should learn how to find the information for oscillator configuration in the datasheet. For this particular PIC, it's under 'Special features of the CPU', Oscillator Configurations (section 14.2 page 145). This section tells you what you need in order to configure for a particular oscillator configuration (not surprising considering the section title :)). As always, you cannot hope to use a microcontroller without first looking at the datasheet.

    This is probably a hardware issue. Please post a picture of your schematic and your actual hardware, so we can see what you are doing.

    In order to help hasten the process, do you have both power and ground pairs connected? Is there anything else on your ICSPCLK and ICSPDAT lines? If so, have you properly isolated them? Are you attempting low-voltage programming (LVP)?
     
    Last edited: Oct 17, 2014
  3. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,392
    1,606
    The PICkit 2 can connect to a device no matter what is inside the hex file, in fact it doesn't even need a hex file. So you have a problem aside from the actual code.

    Did you ever successfully connect between the PICkit and the PIC? If not, there is your problem.

    Look inside the PICkit user's guide and find the connections for the 5 pins and make sure these are good.

    The PICkit 2 has a stand alone program that allows you to test each connection. Get a copy and try each pin.

    My big mistake is getting the clock and data lines reversed. That causes no damage but programming will not work.
     
  4. bobparihar

    Thread Starter Member

    Jul 31, 2014
    93
    0
    previously when i program my PIC16f877a on the board(not breadboard.. its a developing kit PCB) using pickit2 it was working fine..
    but now when i selected XT from project editor as i am using 8Mhz crystal on the board.... since then every thing is working in the wrong way.. my 2 Micro controller gets damaged.

    the code is simple for a seven segment showing0 - 9 using Mikro C software
    ----------------------------------------------------------------------------------------------------------------
    //using common anode seven segment
    void main()
    {
    unsigned int i,a;
    unsigned int ar[]={~0x3f,~0x06,~0x5B,~0x4F,~0x66,~0x6D,~0x7D,~0x07,~0x7F,~0x6F};
    TRISB=0;
    TRISC=0;
    PORTC.F0=1;
    while(1)
    {
    for(a=0;a<10;a++)
    {
    PORTB=ar[a];
    Delay_ms(500);
    }
    }
    }
     
    Last edited: Oct 18, 2014
  5. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    Did you check out the portion of the datasheet regarding oscillator configurations? I'd image not, considering Table 14-2 says you need to use HS for an 8MHz crystal:
    Screenshot_2014-10-17-22-23-01~2.jpg

    Either way, this shouldn't affect your ability to program the device.

    Again, please provide information regarding the hardware...
     
    bobparihar likes this.
  6. bobparihar

    Thread Starter Member

    Jul 31, 2014
    93
    0
    ok i did read the data sheet now and i got to know that have to use HS as i use previously but this time when i use Hs still iam having a device error even with a new controller..i think i damaged this one also..
    i lost three microcontroller now.. and its hard to afford another ic some body please tell me whats wrong??

    had successfully burned and run the code previously with 20mhz and 8Mhz with same hardwares
     
  7. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    How can we!? You actively refuse to give us the information we would need! I have asked you twice now to provide us with some information on your hardware setup and you have completely ignored these requests.

    I doubt your controllers are dead. You probably just hooked them up wrong, especially since it used to work on the development board. Are you using a breadboard now?
     
Loading...