Connecting programmer to MicroCode Studio


Closed Thread
Results 1 to 34 of 34
  1. #1

    Default Connecting programmer to MicroCode Studio

    New to this forum, and new to PIC programming as well.

    I have just started to learn about PIC programming. I started by downloading MPLAB and doing some of the tutorials. Then I purchased this programmer http://www.futurlec.com/PIC_Programmer.shtml , built a development board to blink LED’s and started having some success.

    But developing in ASM is not my cup of tea, so I have downloaded the demo version of PICBasic Pro and I am trying to use it.

    The problem is I cant’t seem to figure out how to connect the programmer to MicroCode Studio. I know I can just use the files generated by PBP to use in MPLAB to program the PIC, but I want to program directly from MCS.

    The programmer says it is Pickit2 compatible if that helps.

    Any help would be appreciated, but it needs to be tailored to a complete novice.

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    In MCS, select menus -> "View" -> "Compile and Program Options..."
    Point MCS to the PBP directory (or let it find it automatically) under the Compiler tab
    Point MCS to the MPLAB directory (or let it find it automatically) under the Assembler tab
    Point MCS to the PICKIT2 by creating a custom programmer entry and point MCS to the PICKIT2 executable.
    Press F9 in the main MCS window to compile the source code, assemble the source code, and start the PICKIT2 programmer.
    Not sure if it works with the PICKIT2 clones though.
    My advice... Spend the $50 and buy the real PICKIT2...

  3. #3
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA.
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    I'll try. Under the MicroCode Studio menu select View, then select Compile and Program Options..., then click the Programmer tab, and press the Add New Programmer... button. Then select the Create a Custom Programmer Entry radio button and press Next. Enter the name you want to call your programmer, it can be anything you want, and press Next. Then enter the name of the executable file that you use to run the programmer, it will be something.exe, and press next, then either select the find automatically for find manually buttons, and press next. When your finished, just go back to the View menu and make sure that your new programmer is set as the default in the little window, and you should be good to go.

    Any more problems, just let us know, there are a lot of pretty smart folks around here who'll do their best to get you going.

    Welcome to the forum!
    Jerry
    If your oscilloscope costs more than your car...

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Not sure if it works with the PICKIT2 clones though.
    My advice... Spend the $50 and buy the real PICKIT2...
    The clones on eBay run $34.99, the real PICKIT2 programmer by itself from Microchip is presently $34.99 The kit with a Developers board is $49.99.
    http://www.microchipdirect.com/produ...words=DV164120
    http://www.microchipdirect.com/produ...words=PG164120
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Thanks. I got it.... now where can I find a good basic tutorial for PICBasic?? I only have PIC16F876A, but I can buy some different PIC's if they are necessary.

    Thanks for the help.

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


    Did you find this post helpful? Yes | No

    Default

    Welcome,

    Sample programs can be found here
    http://www.melabs.com/
    and here
    http://rentron.com/
    Bruce is working on a book also.

    The manual has the basics and read this forum for the trickier stuff.

    This is also a good place to go
    http://www.picbasic.co.uk/forum/forumdisplay.php?f=16
    At the bottom of the page select "From the Beginning" to see all of the threads.
    Dave
    Always wear safety glasses while programming.

  7. #7


    Did you find this post helpful? Yes | No

    Default

    OK, I thought I had it, but I don’t. Although my programmer is working, the files created in MCS are not being loaded into the PICkit 2 program.

    When "compile and program" is selected in MCS, the file is compiled with no errors and the PICkit 2 programmer window opens. Then my programmer lights up and the PICkit 2 programmer shows a successful program loaded into the PIC. Unfortunately, all that is loaded is blanks (all “3FFF”).

    Somehow the HEX file is not being loaded into the PICkit 2 software.

    I don’t know if I am explaining this well, but can anyone help? Could this be that I left the last step out during the programmer setup? It was a blank box that had somthing to do with linking the HEX code. I didn't know what to enter there.
    Last edited by KrashKaloop; - 7th September 2008 at 02:13.

  8. #8
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Smile Where did I put that file?

    Quote Originally Posted by KrashKaloop View Post
    OK, I thought I had it, but I don’t. Although my programmer is working, the files created in MCS are not being loaded into the PICkit 2 program.

    When "compile and program" is selected in MCS, the file is compiled with no errors and the PICkit 2 programmer window opens. Then my programmer lights up and the PICkit 2 programmer shows a successful program loaded into the PIC. Unfortunately, all that is loaded is blanks (all “3FFF”).

    Somehow the HEX file is not being loaded into the PICkit 2 software.

    I don’t know if I am explaining this well, but can anyone help? Could this be that I left the last step out during the programmer setup? It was a blank box that had somthing to do with linking the HEX code. I didn't know what to enter there.
    Hi KrashKaloop,

    Welcome to the forum.

    Just went through the same problem. The PICkit2 is new to me too.

    I found that the top box, of the three boxes, in the lower right-hand corner, of the single screen, PICkit2 programming window, labeled [“Auto Input Hex + Write Device”] worked.

    But, you have to know (remember) where MCS put the hex file and what it is called.

    You know you have the hex file loaded (ready to progam) when it shows up in the PICkit2 [Source:] window.

    -Adam-
    Ohm it's not just a good idea... it's the LAW !

  9. #9


    Did you find this post helpful? Yes | No

    Default

    Thanks Pic User,

    Yes, I knew that the upper button would import and write the file to the PIC and you can also use the file menu to open a HEX file and then program the PIC. But I thought there was a way to compile and load the current file from MCS into PICkit2. I guess if I have to load the file manually each time, I certainly can, but I thought there was a one click procedure available to get the file over to the PICkit2.

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


    Did you find this post helpful? Yes | No

    Default

    You are some how using the PICKIT2 software with the clone you have?

    When you get a real PICKIT there is no reason to mess with MCS like you are trying, Just follow Adam's instructions. Works great.
    Dave
    Always wear safety glasses while programming.

  11. #11
    Join Date
    Dec 2003
    Location
    San Diego
    Posts
    35


    Did you find this post helpful? Yes | No

    Question Auto program for PICkit2 ?

    I just installed a new PICkit2 and would like to know if the auto start and program will work.
    When I select compile and program in the IDE, the programmer app starts but I have to manually grab the hex file and do the load from the PICkit2 application (2 steps).
    Some other programmers will accept a script file in the IDE that will allow them to compile and program your PIC with one click...
    Does anybody know the correct script to make the PICkit2 program the PIC when started by the IDE?
    Thanks,
    ....Microcode studio plus 3.0.0.5
    ....18F252

  12. #12
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    With the PicKIT2, you don't need a script for one-step programming - use the circled feature (works with any compiler/IDE):

    Attached Images Attached Images  

  13. #13
    Join Date
    Dec 2003
    Location
    San Diego
    Posts
    35


    Did you find this post helpful? Yes | No

    Default PICkit2 script?

    Yes I use it that way now.
    I would like to use the programmer as I use the MEL USB unit and make it a one click use.
    Once you go one click.... you don't want to go back...
    Do you know if the PICkit2 can even be driven to do "one click" form the IDE like the MEL programmers?

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


    Did you find this post helpful? Yes | No

    Default

    Use the suggestion rmteo gave.

    Whenever the hex is changed, PICKIT2 software will see it, reload it, and then program the PIC. You have to do nothing.
    Dave
    Always wear safety glasses while programming.

  15. #15
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    What you need is the "PICKit2 Command Line Interface".

    http://ww1.microchip.com/downloads/e...K2CMDv1-12.zip

    1 click from Microcode Studio (compile and program).
    DT

  16. #16
    Join Date
    Dec 2003
    Location
    San Diego
    Posts
    35


    Did you find this post helpful? Yes | No

    Default PICkit2?

    Maybe I did not ask my question in the correct way...
    The IDE has a button that will compile and program(flash) your PIC with one click (if you have the correct script installed). It starts the programmer application if it is not running and then the programmer programs the PIC... you do not have to touch anything in the programmer GUI... it basically runs in parallel with the microcode IDE.... I mean ONE click to do everything. It is very fast and it is a part of the Microcode studio IDE to programmer interface.
    The MEL programmers all can read a script and be automated.... I do not know if the PICkit2 has this feature where it can be totally remote controlled from the IDE.
    Perhaps I should ask this on the Microchip forum??
    **************

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    What you need is the "PICKit2 Command Line Interface".

    http://ww1.microchip.com/downloads/e...K2CMDv1-12.zip

    1 click from Microcode Studio (compile and program).
    ???
    The Auto Import Hex from the PICKIT2 software already does this once the hex is selected.
    Dave
    Always wear safety glasses while programming.

  18. #18
    Join Date
    Dec 2003
    Location
    San Diego
    Posts
    35


    Did you find this post helpful? Yes | No

    Red face PICkit2?

    Thanks Darrel,
    I will check it out...
    tcbcats

  19. #19
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    ???
    The Auto Import Hex from the PICKIT2 software already does this once the hex is selected.
    I've never tried it that way.
    Perhaps it works fine ...

    But I know the Command Line Interface gives one click from MicroCode Studio to PIC.
    It's what I use for the PICkit2. I also have an EPIC, and a meLabs U2.

    It's been awhile since the installation, I don't remember if it was automatic or if I had to figure it out.
    But these are the parameters for the PICkit2 programmer.
    Code:
    -pPIC$target-device$ -f$hex-filename$ -M -R -T -h2
    1Hr left this year
    Well, In my time zone.

    Happy new year!
    Kiss someone next to you.
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    I've never tried it that way.
    Perhaps it works fine ...

    But I know the Command Line Interface gives one click from MicroCode Studio to PIC.
    It's what I use for the PICkit2. I also have an EPIC, and a meLabs U2.

    It's been awhile since the installation, I don't remember if it was automatic or if I had to figure it out.
    But these are the parameters for the PICkit2 programmer.
    Code:
    -pPIC$target-device$ -f$hex-filename$ -M -R -T -h2
    When I use windows I just use the PICKIT2 soft ware.
    On Linux I use this
    http://www.cannasoftware.com/content/view/32/1
    Both work well.

    1Hr left this year
    Well, In my time zone.

    Happy new year!
    Kiss someone next to you.
    I am in the shop by myself, a real party animal
    HAPPY NEW YEAR!!!
    Dave
    Always wear safety glasses while programming.

  21. #21
    Join Date
    Dec 2003
    Location
    San Diego
    Posts
    35


    Did you find this post helpful? Yes | No

    Question PICkit2?

    Darrel...
    Did this give you the one click flash function from the IDE?
    -pPIC$target-device$ -f$hex-filename$ -M -R -T -h2

    I tried this and several variants with no luck.
    The programmer application starts... no problem... but does not do it's thing without clicking the auto import button.

  22. #22
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit
    Quote Originally Posted by Darrel Taylor
    Happy new year!
    Kiss someone next to you.
    I am in the shop by myself, a real party animal
    HAPPY NEW YEAR!!!
    Then kiss your DrillPress.
    I would if I had one ...
    But, right now, the mop looks pretty good too.

    tcbcats: Thru my blurry eyes tomorrow, I will attempt to verify the process.
    It works, It's sweet.

    Hflppy Neflear!
    DT

  23. #23
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Installing the PICkit2 Command Line Interface

    Download the latest PICkit2 GUI, and the "PICKit2 Command Line Interface" from Microchip.
    http://www.microchip.com/stellent/id...cName=en023805

    Extract all files from PK2CMD to your "C:\Program Files\Microchip\PICkit 2 v2" folder.
    It's the same folder as the PICkit2 programmer software.

    In Microcode Studio View | Compile and Program Options... | programmer tab,
    click Add New Programmer, select "Create a custom programmer entry" then click "Next".
    Enter any name you wish to call it and click "Next".
    Enter pk2cmd.exe as the "Programmer Filename" and click "Next".
    Click the "Find Manually" button and point it to C:\Program Files\Microchip\PICkit 2 v2 and click "Next".
    Enter this parameter line

    -pPIC$target-device$ -f$hex-filename$ -M -R -T -h2

    Then click Finished.

    Pressing Compile and Program or F10 in MicroCode Studio will now do it all.

    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=3146" /><!-- Name:  PicKit2_CMD.JPG
Views: 4436
Size:  120.3 KB -->

    Descriptions of those, and additional command-line parameters can be found in the "Readme For PK2CMD.txt" file from the .zip above.
    <br>
    DT

  24. #24
    Join Date
    Dec 2003
    Location
    San Diego
    Posts
    35


    Did you find this post helpful? Yes | No

    Default PICkit2?

    Darrel,
    I set up my programmer as you directed and still get the same results...
    The PICkit2 application starts and and just shows that it found the connected PIC... thats all. I have to manually click the putton and then select the hex to get it to program the target PIC.
    Just before the application starts the programmer shows activity but that is maybe just reading the target PIC to confirm a connection.
    I tried many of the other commands in the readme file with no luck.
    It looks like the command never actually runs or has some other error.
    The PICkit2 application gets started from the programmer path you enter in the IDE so its the script that is not working.
    My new USB U2 came today and it works with the script... so I guess I will scrap the PICkit... too bad the price is right and it does work if manually directed. It also works as stand alone.
    Maybe MEL has some other info on how to get the PICkit2 to work with the script.

  25. #25
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Are you sure you entered pk2cmd.exe as the Programmer Filename.
    It opens a DOS window, not the PICkit2 GUI program.

    If it's opening the GUI, something's definitely not right.
    <br>
    DT

  26. #26
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default programmer launch from Microcodestudio

    Hi to you all !
    I do have to launch the MPLAB in order to programm the PIC directly from the MCS. At the moment I use the MCS and MPASM and then i call the MPLAB to program the chip. I will like to do it in a single action.
    Thanks for any suggestion .
    Regards,
    Ambrogio
    IW2FVO
    North Italy

  27. #27
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    See posts #8,12,14,17.

  28. #28
    Join Date
    Dec 2003
    Location
    San Diego
    Posts
    35


    Did you find this post helpful? Yes | No

    Default PICkit2?

    Darrel,
    I changed the programmer exe and now I get a dos window for a short instant... then it goes away... It is so fast that I cnnot see anything in the window.... programmer does nothing and target PIC is not read or programmed.
    So...the dos is starting but not reading any script.

    Are you actually using the script and one click programming from the IDE?
    I have configured my IDE to place my compiled code in the PICkit2 folder.

  29. #29
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    The -h2 parameter causes it to pause for 2 seconds before closing the window.
    But since you didn't do the "Programmer Filename" step, I assume you didn't do the parameters either.

    What I showed above was a series of steps that must be completed for it to work. ALL steps must be completed exactly as shown. Miss one, it won't work.

    I have configured my IDE to place my compiled code in the PICkit2 folder.
    Not sure how you did that. As far as I know, that's not an option in Microcode Studio.
    You can set the default folder that comes up for a File|Save, but if you're saving everything in your PICkit2 folder, that's just plain silly.
    DT

  30. #30
    Join Date
    Dec 2003
    Location
    San Diego
    Posts
    35


    Did you find this post helpful? Yes | No

    Default PICkit2?

    I just set the IDE default file to the PICkit2 folder for my testing.... with a LED light blinker test program.
    The -h2 does nothing I tried -h5 ....+ all combos etc with no change in the way the dos window flashes by.
    I can only conclude that the script is not being read, is in the wrong place, or not constructed correctly.Is there something in the PICkit2 ini file that needs to be changed if you use the dos script vs the programer GUI?

    It would help if I could get an actual screen copy of the working script from a working machine.

    I assume that you are not actually using the PICkit2 with one click commands from the Microcode studio plus GUI.(that is the compile and program button)

    The steps outlined in your post and confirmed in the IDE and programmer help files do not work on my system.

    The example script files in the programmer help files are not in the same format as your example but I tried the examples and got the same results.

    I was able to see that the dos popup displays an "\" and then quits in 1/2 second. There is no other text shown on the DOS screen... I assume I should see the script run and some delay before the dos screen closes.

  31. #31
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    I'm sorry that you were unable to make it work.

    Other than taking a video of me actually compiling a program and downloading with 1-click, I don't know how to convince you that it does work.

    It's totally possible I've missed a step, but after deleting everything and going through the process from scratch, I see nothing that would help.

    Best bet ... Use the instructions from posts #8,12,14,17.
    <br>
    DT

  32. #32
    Join Date
    Dec 2003
    Location
    San Diego
    Posts
    35


    Did you find this post helpful? Yes | No

    Red face PICkit2?

    Darrel,
    I got it to work....
    I had to remove the PICkit2 programmer from the IDE list of programmers and then re make the custom programmer again from scratch.
    It seems that you cannot edit both the path and script without dumping the old setings.
    It was an IDE problem.... If you have to edit the extsting path or programmer .exe, then you must dump the old programmer entry totally and start over.
    Thanks for the help.....

  33. #33
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    EXCELLENT!

    That must be the Step I was missing.

    Thanks tcbcats.
    DT

  34. #34
    Join Date
    Jul 2014
    Posts
    1


    Did you find this post helpful? Yes | No

    Default Re: Connecting programmer to MicroCode Studio

    I have a PICkit2 clone and DT explanation works if followed to the letter, the only thing I changed was the cmd line to one suggested in another post: -PPIC$target-device$ -F$hex-filename$ -E -M -Y -Y -h9, then the dos cmd box will open with erasing device followed by three msg's and waiting 9 sec before closing allowing user time to view error's if any.

    Note:if dos cmd box closes quickly then you have made a mistake during installation or the choosen device in Microcode Studio
    selection box is incorrect(example 16F877A when should be 16F877)

Similar Threads

  1. Connecting PICSTART to Microcode Studio
    By OzGrant in forum General
    Replies: 8
    Last Post: - 2nd February 2010, 10:20
  2. Connecting PICSTART to Microcode Studio
    By OzGrant in forum General
    Replies: 0
    Last Post: - 30th January 2010, 20:40
  3. Microcode studio programmer question
    By zk_bamx2 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 4th February 2008, 10:20
  4. Microcode studio loader problem
    By woodygjw in forum General
    Replies: 2
    Last Post: - 10th September 2007, 01:18
  5. Replies: 2
    Last Post: - 25th February 2006, 02:53

Members who have read this thread : 1

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