Can you program the APP2 with PIC Basic Pro (from MElab)? The answer is yes.
First, download the definition file app2.bas. You'll need to include this in your PBP source file (this assumes you are using a recent enough version to support the Microchip ICD -- if not, you won't be able to find icddefs1.bas which is part of the PBP distribution).
The only other problem is that PBP will try to put code at location 2 -- part of the APP2's reserved area. If you use interrupts, however, PBP will move your code to location 4 which is fine. You can also force newer versions of PBP to do this by using a DEFINE LOADER_USED 1 statement.
If you have an older version, the trick is to make a phony interrupt handler. Here is a simple program to convert decimal to hex. It will print and read from the same terminal you use to program the APP-II. The parts that are common to all programs is in bold:
include "app2.bas" DEFINE OSC 20 ' This is the dummy interrupt handling to force PBP ' to move the main code out of the APP-II reserved area ' Of course, you could use a "real" interrupt handler ' instead if you wanted to handle interrupts DEFINE INTHAND dummy wsave var byte $20 system ssave var byte bank0 system psave var byte bank0 system ' This will set the serial port 19200 DEFINE HSER_RCSTA 90h DEFINE HSER_TXSTA 20h DEFINE HSER_BAUD 19200 num var word ' workspace main: hserout ["?"] hserin [dec num] hserout [dec num, "=", hex4 num,13] goto main ' Dummy interrupt handler to make PBP work with APP-II asm dummy retfie endasm
If you put this file in app2test.bas, simply compile this program with the command:
pbp -p16f873 app2test.bas
This will generate app2test.hex. Remove the jumper from the APP-II board, press reset, and download the hex file using the terminal program (for example, Hyperterminal). Then replace the cap and press reset. You should see a ?. Type a decimal number (you won't see any echo) and press Enter. You'll see the conversion result on the terminal screen.
Of course, if you need to actually handle interrupts, you can use your own interrupt code instead of the dummy routine and that will work just as well.
If you are using a newer version of PBP that supports the LOADER_USED directive, you can simply define it as 1 and then you don't need any special code. For example:
include "app2.bas" DEFINE OSC 20 DEFINE LOADER_USED 1 ' This will set the serial port 19200 DEFINE HSER_RCSTA 90h DEFINE HSER_TXSTA 20h DEFINE HSER_BAUD 19200 num var word ' workspace main: hserout ["?"] hserin [dec num] hserout [dec num, "=", hex4 num,13] goto main
You can use MicroCode Studio (the free IDE for Pic Basic Pro) with the APP2 if you are using Windows NT, XP, or 2000 by downloading the APP2DUMP batch file. If you prefer a Windows console program (that should work for Windows 95 and up) download the EXE version. Just add a new programmer to MCS (in the View | Options menu). Call the programmer APP2.
When MCS asks for the programmer name, use app2dump.bat (or app2dump.exe). Don't include a path. On the next screen, select the path where you stored app2dump.bat. Finally, use this string on the final screen (substitute the correct number for COMPORT):
So if you are using COM1, enter: $hex-filename$ 1.
That's it! Set MCS to PIC16F873 and follow the PBP directions above. When you tell MCS to compile and program, it will automatically prompt you to reset the APP2 and then download the program. No need for a terminal program at all.
Remember, the batch file won't work on Windows 95 or 98 (and probably not on ME, either). However, the EXE version should work with any 32-bit Windows. COM ports above COM 4 are supported (assuming you have them).
Site contents © 1997-2012 by AWC, 310 Ivy Glen, League City, TX 77573 (281) 334-4341