Some time ago I had the same problem, and Andrew Warren sent me this message: ------------------------ >From fastfwd@ix.netcom.com Mon Mar 31 09:48:03 1997 Date: Tue, 23 Jul 1996 23:32:08 -0800 From: Andrew Warren To: Multiple recipients of list PICLIST Subject: Re: MPLAB stimulus file format Rusu Dan Victor wrote: > Where can I find the stimulus file format for MPLAB? Dan: Here's a message I posted to the PICLIST a month or so ago: First, make sure that you are using the latest version of the simulator (version 5.20). If you don't have it, you can obtain it from Microchip's BBS (telnet:mchipbbs.microchip.com); it's in the "Released" File Library, along with the MPSIM User's Guide and User's Guide Addendum, both of which you should also obtain. Regular, periodic clock signals can be simulated by using the "CK" command: "CK" displays the current clock assignment. "CK pin, hi, lo" defines the clock period on a pin. "CK pin, -" disables the clock on that pin. "pin" is the name of an I/O pin and "hi" and "lo" are the number of instruction cycles that the pin should be hi and lo. For instance: CK RC0, 5, 4 assigns a clock to RC0 with a 9-cycle period (5 cycles high, 4 cycles low). CK RC0, - cancels that simulated clock. If you need to simulate waveforms that are not this regular, you can do so using a "stimulus file". Stimulus files are simple ASCII text files that look like this: STEP RB7 RC0 RA2 1 0 0 0 5 1 0 0 20 1 0 1 21 0 0 0 ... etc. The headings in the first line are important: The first one must be "STEP", and the remaining ones show which pins are to be stimulated. In each of the following lines, the first number is the "step count" (more on this later) and the other numbers are the values to be placed on the pins. There is no limit to the length of a stimulus file, nor to the number of pins that it can stimulate. The "step count" defaults to the instruction step. That is, the above stimulus file will execute the first line when the first instruction is executed, the second line when the 5th instruction is executed, the third line when the 20th instruction is executed, etc. Since some instructions (GOTO, CALL, etc.) take two cycles rather than one, this may lead to unexpected results, since the simulator is using instruction counts rather than absolute time. To remedy this, Microchip has added the "IP" command. It sets the bahavior of stimulus files thusly: "IP" displays the current mode. "IP step" sets the mode to "count steps". "IP time" sets the mode to "count time". "step" and "time" are literal strings... To set the mode to "time", the command is actually "IP time". Note that, even if you use the "IP" command to set the mode to "time", the first column heading in your stimulus file must still be "STEP". After creating the stimulus file, you load your source code into MPSIM as usual, then load the stimulus file using "ST filename". Hope this helps... -Andy Andrew Warren - fastfwd@ix.netcom.com Fast Forward Engineering, Vista, California http://www.geocities.com/SiliconValley/2499 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Dan-Victor RUSU Technical University of Cluj Computer Science Department rdv@utcluj.ro Baritiu, 26 Cluj-Napoca, ROMANIA http://hercule.utcluj.ro/~rdv Fax: (+40) 64 194491 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~