Unpacking a PICkit 2 Programmer/Debugger


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi Anand,

    But, single-stepping seems to work fine.
    Because when you're single-stepping with the Step Over button it steps over the huge
    library functions. If you single-step using Step Into, it executes the library function line
    by line. Step Over runs the whole library function immediately returning to the next PBP
    BASIC statement.

    Animation works similar to Step Into - so you lose the green animation cursor when a call
    to a library function is made.

    About the port pins. What you are saying is, I'd have to watch the whole port, and then see the behaviour of the individual pins within; am i right in my understanding?
    Yep. You can watch the port or the alias you've created, but you're still essentially
    watching the same thing since the alias is just another name for the same register address.

    I must say MCS Plus has really spoilt me; this is one thing about it I miss. But like you said, there seem to be loads of other things in favour of MPLAB that makes the transition worthwhile.
    MCS+ is a great little program, but once you get the hang of using MPLAB/MPSIM with PBP
    you'll never look back.

    MPLAB has a lot of things MCS+ doesn't like the stop watch, logic analyzer, and advanced
    features like register injection. You can setup stimulus files to send analog values to A/D
    inputs, simulate external switches on pins, and a lot more.

    It goes way beyond just watching the animation cursor & viewing register values...;o}
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    MPLAB has a lot of things MCS+ doesn't like the stop watch, logic analyzer, and advanced
    features like register injection. You can setup stimulus files to send analog values to A/D
    inputs, simulate external switches on pins, and a lot more.
    By the way are there any tutorials on these?

    Ioannis

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi Ioannis,

    None that I'm aware of. I'll put one together.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  4. #4
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Here's a complete PBP application showing how to use several of the cool features built
    into MPLAB/MPSIM with PBP.

    You can run this without even owning PBP, but you can't make changes or re-compile
    without PBP - obviously, and you will want to create a directory on drive C as follows -
    C:\PBP\SIMTST to install these files in.

    If you do own PBP, and it's in C:\PBP, then create the directory as shown above, and unzip
    all files into that directory.

    What you'll need:

    Download & install MPLAB 8.15a. This is the latest/greatest version that supports PBP until
    MeLabs makes a few changes. And don't bother asking for help if you're using an earlier
    version of MPLAB since this was done with version 8.15a...;o}

    You can download 8.15a from the link below;
    http://ww1.microchip.com/downloads/e...plab_v815a.zip

    Now follow the instructions from MeLabs website on installing MPLAB at the link here;
    http://melabs.com/support/mplab.htm for your operating system.

    TIP: Anyone that owns the Microchip C18 compiler, that has installed the latest/greatest
    version, or anyone that might have installed another program that installs a new version of
    MPASM assembler, here's something to look for;

    When installing some other program that includes itself in your path statement, it may
    C18 does
    install its own entry before entries that were previously dropped in
    your path statement when installing MPLAB.

    If that's the case, you may end up with error messages when you try compiling your PBP
    program code stating it can't locate .COD files. If you see this, then edit your path
    statement placing the PBP & MPLAB entries first - like this;

    C:\PBP;C:\Program Files\Microchip\MPASM Suite;c:\mcc18\mpasm;c:\mcc18\bin, blah,
    blah.

    I ran into this problem after updating C18 to the latest version, and it was a HUGE pain in
    the butt to find/fix. MPLAB showed MPASM 5.22 on-screen, but the .LST file showed it was
    actually assembled by a much newer version 5.30.01 assembler, which was installed in my
    MCC18 directory. A BIG bug to watch out for. MPLAB pops up an MPASM assembler screen
    indicating it's using 5.22, but it's really assembling with the 5.30.01 MPASMWIN.EXE in
    another directory, so you've been warned...;o}

    Moving on:

    Once you have MPLAB version 8.15a installed, and these files unzipped into your
    C:\PBP\SIMTST directory, you're ready to go.

    Start MPLAB. Click Project >> Open, and find C:\PBP\SIMTST\SIMTST.MCP to open this
    project.

    Click the Step Into button once. If the Watch window doesn't show a value of 00000001
    on PORTB, then click on the Stimulus window > Fire button next to RB0. Then click the
    Step Into button once more. Now you should see in the Watch window PORTB = 00000001.

    Next click the Run button. It will sit & spin now until you click the > Fire button again in
    the Stimulus window.

    Once you click the Stimulus window > Fire button, it will stop on the breakpoint at the
    ADCIN command, and display the pulse stream output on RB1, and the RB0 switch input
    pulse in the logic analyzer window.

    Next click the Stimulus > Fire button again, then Step Into, and make sure it shows PORTB
    00000001 in the watch window again, then click the Run button. You should see the simulated
    A/D value passed from the Stimulus Register Injection file ADSTIM.TXT shown in the
    Output window under SIM Uart1.

    Now comment out the WHILE Switch WEND code, recompile, and just keep pressing the Run
    button to see the difference.

    Yeah, I know, it's not a complete tutorial, but it does help to show some of the cool MPLAB
    & MPSIM features you can work with in PBP.

    When I can find the time, I'll work-up a complete tutorial for this, including setup & extra
    info on our website and post a link to it here.
    Attached Files Attached Files
    Last edited by Bruce; - 14th May 2009 at 02:22.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  5. #5
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default

    Hi Bruce,

    Okay, that pretty much puts things in perspective. Wouldnt have been able to do the switch without all the inputs I got.

    Thanks,

    Anand

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default

    Hi Bruce. Thanks a lot for the quick tutorial!

    What if there is already installed the 8.30 version of the MPLAB? Will be any problem with the latest (greatest?) version?

    Ioannis

  7. #7
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    See the first section here http://melabs.com/support/mplab.htm for info on using PBP with
    MPLAB version 8.20 or later.

    MeLabs is working on it, but it's not ready yet. If you want to use MPLAB with the latest
    version of PBP, you'll need to install MPLAB version 8.15a or earlier.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  8. #8
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default

    Been making a lot of progress, Bruce.

    Now I have a question again.

    When using the simulator, my switches (which in hardware have a pull-up) show to be low; how can i change that so that I could use the stimulus to trigger these?

    Regards,

    Anand

  9. #9
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Click in the stimulus Action window for options. See attached screen capture.
    Attached Images Attached Images  
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  10. #10
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default

    Yes, I discovered that, Bruce. But does 'pulse low' mean that input would otherwise be high by default, as it would with a pull-up? Or does one have to set it high every time, before a pulse low can be used?

    Anand

  11. #11
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    See the first section here http://melabs.com/support/mplab.htm for info on using PBP with
    MPLAB version 8.20 or later.

    MeLabs is working on it, but it's not ready yet. If you want to use MPLAB with the latest
    version of PBP, you'll need to install MPLAB version 8.15a or earlier.
    Well, I asked because 1. did not read the mentioned article by Melabs and 2. I run your tutorial with no problems. I did not though compiled yet any program in 8.30...

    Ioannis

Similar Threads

  1. PICkit 2 and RBC interrupts
    By jderson in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 4th April 2009, 02:33
  2. PICkit 2 for £9.99 inc P&P
    By Agent36 in forum General
    Replies: 6
    Last Post: - 16th November 2008, 23:44
  3. PicKit 2 Questions
    By dmairspotter in forum General
    Replies: 3
    Last Post: - 11th November 2007, 21:10
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. Programming from MicroStudio to a PICKit 2
    By jblackann in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th November 2006, 03:56

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