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.




Bookmarks