Pic programming at the REC

Back to the REC home page


Using the assembler

We have our own UNIX-based assembler for the PIC microcontroller series. It currently only runs on decstations, but if you need it on another platform, just write me e-mail (rsargent@mit.edu).

To use the UNIX-based assembler from Athena, simply type:

% add rec
% picasm filename.asm

Note that M-X goto-line can be a useful emacs command for finding an error mentioned by picasm. When there are no errors, picasm will produce an output file with suffix ".hex".


Using the programmer

We have a PICstart programmer, donated by Microchip, which is hooked up to a PC-compatible in the lab. In order to program your PIC from the PC, you must copy the ".hex" file to a 3.5" MS-DOS floppy. From an athena DECstation, use dosread, doswrite, and dosdir. Here's an example of using doswrite:

Now, bring your floppy over to the PC-compatible, and start the "PICstart" software. Just type:

mpstart

Note that if the computer can't find mpstart, the program probably isn't in the path, and you'll need to find it inside a directory also called mpstart. On one machine this dirctory is at the top level of C: drive, and on the other this directory is on the D: drive.

Once you get mpstart running, you will need to do the following things:

Make certain to program the congiguration fuses correctly: if you don't turn off the watchdog timer, for example, your project won't work (unless you deal with the watchdog timer explicitly in your software).


Using the simulator

We also have an experimental simulator for the PIC16C71 and PIC16C84 written by Anne Wright (anarch@ai.mit.edu). You can try running it on your code like this:

% picsim filename.hex
picsim>
Simulator command list

load filename.hex
     This reloads code from filename.hex
trace 1
     Turn on tracing (printing of each instruction as it executes)
trace 0
     Turn off tracing
go
     Start execution at current PC.  Stops at next breakpoint, if any.
go address
     Start execution at address.  Stops at next breakpoint, if any.
step
     Executes one instruction at current PC.
break address
     Sets breakpoint at address
delete num
     Deletes breakpoint #num
disasm from to
     Disassembles instructions from address "from" to address "to"

rd Displays PC and W registers md addr Dumps memory (register file) starting ad address addr mm addr syms Print out symbol table reset Sets clock and PC back to zero


Randy Sargent <rsargent@mit.edu>