Problems with PICKit 2 and Microcode Studio


Closed Thread
Results 1 to 11 of 11
  1. #1
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77

    Unhappy Problems with PICKit 2 and Microcode Studio

    Hi All,

    I have been using PBP for years with my trusty EPIC programmer. Finally with no more parrallel ports I deciced to buy a PICKit 2.
    I wrote a simple code using SEROUT2 and a flashing led. When I programmed the PIC16F877A using EPIC it worked perfectly, when I used that same hex file and programmed using PICKit 2 it didn't.
    I then programmed the PIC using the EPIC and when it was working I read the HEX file from the PIC using the PICKit 2 and saved the file with another name. Now if I use that code and program the pic using PICKit 2 it works perfectly but if I use the code straight from the compiler assembled with PM or MPASM it doesn't work.
    Anyone got any ideas? One difference I saw when I programmed was that the read code took longer to program than the code from the assembler. I have attached the two hex files (one that was written and programmed with EPIC and the other that was read and programs using PICKit2.
    Also I attached the little pic code

    Thanks Chris
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Problems with PICKit 2 and Microcode Studio

    Does the EPIC set the configs for you? If so, you may need to set them in the *.inc file for your setup when using the PicKit.
    http://www.picbasic.co.uk/forum/showthread.php?t=543
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Default Re: Problems with PICKit 2 and Microcode Studio

    Hi Dave,

    I tried playing with the configuration string but I must be making a mistake, please look at my code. I'm sure its something simple that I have emitted or added that is wrong.
    PS: I have to use MPASM as I am using windows 7 64 bit and PM gives an error that it cannot work oon 64bit.

    ]'************************************************* ***************
    '* Name : SEROUT2.BAS *
    '* Author : [select VIEW...EDITOR OPTIONS] *
    '* Notice : Copyright (c) 2004 [select VIEW...EDITOR OPTIONS] *
    '* : All Rights Reserved *
    '* Date : 2004/05/24 *
    '* Version : 1.0 *
    '* Notes : TEST FOR PICKIT 2 WITH 16F877A *
    '* : *
    '************************************************* ***************
    @ __config _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF

    Define OSC 20 ' Set Xtal Frequency
    trisd.0=0

    COUNTER VAR BYTE
    COUNTER=0

    LED1 VAR PORTd.1
    LED2 VAR PORTd.0
    LED1=0
    LED2=0

    start:
    pause 500
    LED2=0
    LED1=1
    pause 500
    LED1=0
    LED2=1
    SEROUT2 PORTd.2,84,["COUNTER=",DEC COUNTER,13,10] 'BAUD = 38400
    COUNTER=COUNTER+1
    goto start

    END
    ´************************************************* **************

    Regards
    Chris

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,604


    Did you find this post helpful? Yes | No

    Default Re: Problems with PICKit 2 and Microcode Studio

    Hi,
    Looking at your two files they are clearly different.
    Importing SEROUT2.HEX into MPLAB and lookin at the disasambly listing it shows adress $00F6 being the last one used while ReadSEROUT2.hex shows adress $00FC and, obviosuly, the checksum are not the same. However the CONFIG bits seems to be set the same way in both example so I don't think that's the problem even though that WAS my first guess too (I might be wrong though).

    What software are you using to run the PK2? Are you running it from within MPLAB, using the standalone application or the commandline interface? How are you telling the PK2 which the target device is? Have you tried reading back the code after it being programmed with the PK2?

    /Henrik.

  5. #5
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Default Re: Problems with PICKit 2 and Microcode Studio

    Hi Henrik,

    I have used the cmd form from Microcode studio and the stand-alone app from microchip for controlling the PICKit2, both have the same problem. I tried what you said and read back my program. They are different at the end as you will see attached. I think there is a difference in crystal speed as the program is working but sending out rubbish or incorrect rate. The one LED also does not flash.
    I am not using MPLAB, only MPASM v3.6

    Regards
    Chris
    Attached Files Attached Files

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Problems with PICKit 2 and Microcode Studio

    SEROUT2 PORTd.2,84,["COUNTER=",DEC COUNTER,13,10] 'BAUD = 38400

    84 is 9600 baud and it is True mode. If you are connecting directly to a PC you will need to use Inverted mode.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Default Re: Problems with PICKit 2 and Microcode Studio

    Hi Dave,

    That was my typo, I was messing with a RS232 converter chip to see if it was a problem with true mode and also with different speeds and forgot to change the comment.
    It doesn't matter what mode or speed I choose I get either a dead program or just junk. Sometimes it only starts when I unplug the programming plug from the programmer.

    Regards
    Chris

  8. #8
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Problems with PICKit 2 and Microcode Studio

    Sometimes it only starts when I unplug the programming plug from the programmer.
    I will assume you are not powering the chip with the PicKit?

    Is the chip still in the EPIC when you use the PicKit?

    Maybe a picture of your setup?
    Dave
    Always wear safety glasses while programming.

  9. #9
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Default Re: Problems with PICKit 2 and Microcode Studio

    Hi Dave,

    I have attached a photo of my setup. The programming cable that I use is the same as I used for the EPIC except the MCLR pin had to be swapped position.
    The PIC is powered by the board and the PICKit2 is set to Automatic power detect. It seems to be programming fine when the code is right.
    I really as stumped with this....

    Regards
    Chris
    Attached Images Attached Images  

  10. #10
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Default Re: Problems with PICKit 2 and Microcode Studio

    Hi All,

    I solved the mystery of the PICkit2 and EPIC.
    The difference was the assembler. I programmed using both programmers on my old PC which had MPLAB installed properly and directed MCstudio to the program files/microchip directory.
    On my new PC/notebook I just put MPASM in a directory and directed MCstudio there. I now installed MPLAB 8.7 on the notebook and pointed MCstudo to that and hey presto the programmer worked.
    The final tricky part was to get the programmer to work using the command driver. I just put pk2cmd.exe in a directory and pointed MCstudio to that and then added the following line to the parameters box: -pPIC$target-device$ -f$hex-filename$ -M -R -T -h2.
    Now it's "compile & program" like i had it before with the EPIC!!!
    Hooray!

    Thanks for you input Dave, you helped me find what were not problems!

  11. #11
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Problems with PICKit 2 and Microcode Studio

    Thanks for you input Dave, you helped me find what were not problems!
    Glad to have been a help!
    Dave
    Always wear safety glasses while programming.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts