USING PIN STIMULUS

15.2 USING PIN STIMULUS

Pin Stimulus is user-defined. It may be: • Asynchronous – Fired by the user.

• Synchronous – Regular, repeating series of high/low voltages with adjustable duty cycle set by number of clock cycles per high/low time.

Pins can be set high or low at program counter addresses. Addresses in the list will be looked for sequentially.

The contents of the pin stimulus list can be edited, saved and restored from a file. Note: Changing stimulus files outside the Stimulus dialog is NOT recommended.

• Creating/Editing Pin Stimulus • Applying Pin Stimulus • Pin Stimulus Display

15.2.1 Creating/Editing Pin Stimulus

1. Select Debugger>Stimulus Controller and then click the Pin Stimulus tab.

2. To create a new file, click Add Row to create a new row for entering data. To open an existing pin stimulus file for editing, click Load and select the file using the Open dialog.

3. Click in the “Type” column of the table row for which you wish to add or change data. Select or change the type of stimulus (Async or Synch). Depending on the stimulus type chosen, each cell gets an appropriate control which allows you to specify the value of that cell.

 2005 Microchip Technology Inc.

DS51519A-page 197

MPLAB ® IDE User’s Guide

Asynchronous Setup

a) Click on “Pin” to select or change the pin on which stimulus will be applied. Available pin names are listed. The actual names depend on the device selected in the IDE.

b) Click on “Action” to select or change a stimulus action. You may choose

Pulse, High, Low or Toggle.

c) Click on “Comments” to specify or change a comment which will be saved

and restored in the pin stimulus file. Synchronous Setup

a) Click on “Pin” to select or change the pin on which stimulus will be applied. Available pin names are listed. The actual names depend on the device selected in the IDE.

b) Click on “High Cycles” to set or change the number of Clock cycles till the high state is applied. Then click on “Low Cycles” to set or change the number of Clock cycles till the low state is applied.

c) Click on “Invert” to set or change whether high and low cycles are inverted.

d) Click on “Comments” to specify or change a comment which will be saved

and restored in the pin stimulus file.

4. When you have completed adding or editing data in a row, click Edit Complete.

5. Continue adding or editing other rows of data till your pin stimulus is complete. If you wish to remove a row, click on a cell in the row to select the row and then click Delete Row.

6. When you are done, click Save and save the pin stimulus file (.psti).

15.2.2 Applying Pin Stimulus

Once you have created/edited a pin stimulus file, you may apply the stimulus as follows:

• Asynchronous stimulus (Type = Asynch): Press the Fire button. The designated event occurs on the designated pin.

• Synchronous stimulus (Type = Synch): Check the enable field. A message is sent to MPLAB SIM to update the stimuli. Thus whatever is displayed is current.

Note: The Stimulus dialog must be open for stimulus to be active.

DS51519A-page 198

 2005 Microchip Technology Inc.

Using Stimulus – PIC17 Devices

15.2.3 Pin Stimulus Display

Select Debugger>Stimulus and then click the Pin Stimulus tab to set up pin stimulus. Closing the Stimulus dialog disables stimulus.

Note 1: If any files are changed externally while in use by this dialog tab, the changes will NOT be reflected in the stimuli passed to the simulator. Changing stimulus files outside the Stimulus dialog is NOT recommended.

2: Unsaved changes will be lost without notice when you close this dialog.

Buttons – Row Edit • Add Row – allows you to add a new pin stimulus. A default pin row at the bottom

of the pin list will be created and the cursor will be moved there for editing. • Delete Row – removes the row at the cursor from the list. • Edit Complete – turns off the display of any list boxes, so all the data appear

clearly. Buttons – Pin Stimulus File

• Load – allows you to specify a previously-saved pin stimulus file and add its contents to the stimulus list.

• Save – allows you to save the current contents of the stimulus list to a pin stimulus file of your choice.

Table Entries • Type – has a choice list containing “Asynch” and “Synch”. The Type you select

determines what is available in some of the remaining cells in that row. • Enable – has a check box for Synch stimulus, a Fire button for Asynch Stimulus.

This is not a data cell. • Pin – contains the names of the available pins. The actual names depend on the

device selected in the IDE.

 2005 Microchip Technology Inc.

DS51519A-page 199

MPLAB ® IDE User’s Guide

• Action Type = Asynch: Pulse: Change the state of the pin to its opposite and return. High: Change the state of the pin to high. Low: Change the state of the pin to low. Toggle: Change to state of the pin to its opposite. Type = Synch: Clock

• High cycles – number of cycles high state will be applied for Synch stimulus. • Low cycles – number of cycles low state will be applied for Synch stimulus. • Invert – inverts high and low cycles when checked for Synch stimulus. • Comments – allows you to specify a comment which will be saved and restored if

you maintain Pin Stimulus in a file.