EX FILE IMPORT .........................................................................................................................................21
EX FILE EXPORT.........................................................................................................................................21
LANK CHECK..............................................................................................................................................24
ART PARAMETERS ......................................................................................................................................32
This document covers design and theory of the PICkit 2 version 2 firmware and PC application software. Version 2
implements a script-based design to allow maximum flexibility for programming any type of device without
requiring frequent, part-specific changes and updates. All part-specific information is kept in a device file, allowing
new parts and families with new algorithms to be implemented without frequent changes to the software or
firmware.
2.0Guiding Design Goals
The guiding design goals of the version 2 firmware
1.Allow the firmware and software to be as generic as possible so adding new part & family support requires
little to no changes.
2.Remain compatible with bootloader commands for the existing Pk2.
3.All device specific information should be kept in the device file.
4.The scripting and firmware should be flexible enough to allow other tasks besides programming to be
accomplished, such as ICD.
3.0Architecture Overview
The PICkit 2 is organized into 4 functional blocks.
1.Bootloader
2.Programmer Firmware
3.PC Application
4.Device File
The Bootloader is designed to be autonomous i.e. does not require programmer firmware for operation.
The Programmer firmware, however, has its own USB stack, and does not rely on the bootloader for communication
while running. This allows the USB stack used during normal execution to be updated over USB using the
bootloader.
The programmer firmware is largely a script execution engine, with basic commands for management of scripts and
data. Data is program code, EE contents, and other information for which the programmer only acts as a conduit.
The PC application is responsible for the user interface portion of the system. Its function is to respond to user
requests by packaging data and scripts for execution by the firmware.
The device file contains all scripts and descriptions of each part supported. It is divided into 3 main sections. The
first is the family description section, which sets up some parameters common to all family members. The second is
the part description section, with an entry for each part supported. This description references scripts contained in
the third section, and defines membership in a family defined in section 1. The third section contains an indexed
listing of all scripts used by the supported parts.
The firmware consists largely of commands to store and retrieve data from 2 data buffers, and to store and execute
scripts from an indexable script buffer.
The names & uses of the buffers are:
Download Data Buffer
256 byte circular buffer. Stores data sent by the PC host for use by script commands. This is
where code and data to be programmed by a script is stored. The write pointer is advanced by
USB commands that write to the buffer, and the read pointer is advanced by scripts that use the
data.
Upload Data Buffer
128 byte circular buffer. Data retrieved by a script is stored here to be read over USB by the PC
host. Data and code read from a part by a script is stored here. The write pointer is advanced by
scripts that place data into the buffer, and the read pointer is advanced by USB commands to
retrieve the data.
Script Buffer
768 byte indexed buffer. This buffer stores up to 32 scripts of variable sizes up to 768 bytes total.
The Script Index Table stores the beginning location and length of each script 1 through 32.
Currently scripts are limited in length to 62 bytes as that is the longest script than can be sent
via a DOWNLOAD_SCRIPT command in a 64-byte USB packet.
5.1Firmware Commands
A command packet starts with the command byte and is followed by the command data bytes in order starting with
data[1]. Response data bytes are returned via USB starting at data[1].
Any command not defined is treated as a “No Operation”.
argument value.
0x85 READ_BANDGAPCommand:0Reads the bandgap of 12F629 family devices
0x86 WRITE_CFG_BANDGAPCommand:0Writes the Config word of 12F629 family
devices with the read badgap value.
0x87 CHANGE_CHKSM_FRMTCommand:2data[1] = Format
data[2] = 0
Format = 0 for most devices
= 1 for Baseline / Midrange flash
= 2 for Baseline / Midrange EE
* If a script attempts to use data from the download buffer and it is empty, the script will abort and generate a status
error. If a script attempts to place data in the upload buffer and it is full, the script will abort and generate a status
error.
Each command that provides a response will generate a separate USB read packet with only the data from that
command. Each packet is set up as a blocking USB read. Thus, multiple commands may be stacked into a single
USB Write packet, but a seperate USB read must be completed to retrieve the result for each command that returns a
response. The response packets will be read in the order in which the commands appear in the Write packet.
Results from multiple commands in a single Write packet are not appended to a single Read packet.
This allows data to immediately available from a command after it has executed, without waiting for the entire USB
Write packet to be processed. Data can be read as it is available even if a script with a long execution time (such as
bulk erase) appears later in the command list.
5.1.2UART Mode
UART Mode allows the PICkit 2 to be used as a simple UART.
ICSPCLK = TX (data transmitted from the PICkit 2)
ICSPDAT = RX (data received from target UART)
Signal levels are inverted (ie Start Bit = GND) logic level signals between GND and VDD.
A bit in the high status byte returned by the READ_STATUS command allows determination if the PICkit 2 is in
UART Mode or not.
Restrictions:
VPP will be shut off when UART mode is entered.
Scripts will not be run in UART mode if script commands are received.
The PICkit 2 VDD pin needs to be connected to the target VDD so the ICSP signals are clamped to the
proper voltage, regardless of whether PICkit 2 is powering the target or not.
In UART mode, any data written to the Download Data Buffer will be transmitted on the TX pin at the specified
baud rate.
Any received data on the RX pin will be placed in the Upload Data Buffer. The PC host should poll the buffer for
data using the UPLOAD_DATA command. The Length byte in the response packet allows determination if any
data was received.
Note that the Upload Data Buffer may be overrun if the host does not keep up with the received data rate. Overflow
data will be lost.
Data Buffers should be cleared before putting the unit in UART Mode
The BUSY LED acts as an activity light (for both RX and TX).
Baud rates faster than 38400 may not work reliably.
5.1.3Unit IDs
A PICkit 2 unit may be assigned a unique Unit ID string of up to 15 characters. This string is stored in 16 bytes of
internal EEPROM on the PICkit 2 PIC18F2550. A value string is always preceded by the char byte ‘#’ to indicate a
valid string. If this first byte is not ‘#’, the Unit ID is assumed to be blank.
Starting with PICkit 2 Firmware v2.32.00, the Unit ID is returned in the PICkit 2USB Descriptor for Serial Number
String. This allows the Unit ID to be read from the USB descriptors without sending any HID commands, so
software may detect and list all attached PICkit 2 units without risking corrupting any current communications with
a PICkit 2 unit if it were to send HID commands.
Execution of a script will abort on the following conditions:
-Script is attempting to use bytes from the Download Data Buffer and the buffer is empty.
-Script is attempting to store bytes in the Upload Data Buffer, and the buffer is full.
-ICD Timeout or BusError bit is set.
RUN_SCRIPT and EXECUTE_SCRIPT commands will be ignored when any of StatusHigh bits 7:1 are set (i.e. a
script error exists) until the error is acknowledge and cleared by a READ_STATUS command.
Some script control bytes require arguments. Argument bytes follow the control byte directly, in the order given in
the table. All undefined byte values will be interpreted as “no operation.”
IDControl ByteArgumentsDescription.
0xFFVDD_ON-Turns on VDD PFET pass transistor.
0xFEVDD_OFF-Turns off VDD PFET pass transistor.
0xFDVDD_GND_ON-Turns on VDD NFET ground.
0xFCVDD_GND_OFF-Turns off VDD NFET ground.
0xFBVPP_ON-Turns on VPP PNP pass transistor.
0xFAVPP_OFF-Turns off VPP PNP pass transistor.
0xF9VPP_PWM_ON-Start up VPP PWM. Allow 100ms to
come up to voltage.
0xF8VPP_PWM_OFF-Shut down VPP PWM. Q4 is off
(VPP_PUMP low).
0xF7MCLR_GND_ON-Turns on VPP NPN ground.
0xF6MCLR_GND_OFF-Turns off VPP NPN ground.
0xF5BUSY_LED_ON-Turns on BUSY LED
0xF4BUSY_LED_OFF-Turns off BUSY LED
0xF3SET_ICSP_PINSarg[1] = pin states
0xE4GOTO_INDEX*arg[1] = Index offset for gotoBranch to the given offset from the
GOTO control byte. The branch offset
is signed 2’s complement.
0xE3EXIT_SCRIPT-The script stops executing immediately.
Normally, execution ends when the end
of the script is reached.
0xE2PEEK_SFRarg[1] = 8 LSbs of SFR addressThe contents of the given SFR are
placed in the Upload Buffer
0xE1POKE_SFRarg[1] = 8 LSbs of SFR address
arg[2] = byte to write to SFR
0xE0ICDSLAVE_RX-Handles the ICD handshake and
0xDFICDSLAVE_TX_LIT***arg[1] = byte to be transmittedHandles the ICD handshake and allows
0xDEICDSLAVE_TX_BUF***-Handles the ICD handshake and allows
0xDDLOOPBUFFERarg[1] = Index offset to loop toThe index offset is unsigned (always
0xDCICSP_STATES_BUFFER-Puts the ICSP pin states in the Upload
0xDBPOP_DOWNLOAD-Reads and discards a byte from the
0xDACOREINST18arg[1] = lsb
arg[2] = msb
0xD9COREINST24arg[1] = low byte
arg[2] = mid byte
arg[3] = upper byte
0xD8NOP24Shifts out 22 bits of zeroes.
0xD7VISI24Shifts out 4 bits b0001, a byte of zeroes,
Writes the given literal into the given
SFR.
receives a byte of data from the DE,
which is placed in the Upload Buffer.
the argument byte to be clocked out by
the DE.
the next byte in the download buffer to
be clocked out by the DE.
backwards), and is the number of bytes
back from the 0xDD control byte to
loop. Value ‘1’ will loop to the byte
prior to the 0xDD.
iterations is taken from the download
buffer as a word – the LSB is first in the
buffer. 0x0000 = NO iterations. This is
different from the LOOP command.
These bytes are read from the download
buffer when the LOOPBUFFER control
byte is first reached.
NOTE: LOOPBUFFER commands may
NOT be nested, but may be nested with
a LOOP command. – provided
interation values exist in the download
buffer for each LOOP iteration.
0xD6RD2_BYTE_BUFFER-Clocks in a byte of data and stores it in
the Upstream Data Buffer, advancing
the write pointer. Byte is shifted in LSB
first. Data is latched on rising edge of
clock
PGC must be set to output. PGD is
automatically set an input, and restored
to previous state after read.
0xD5RD2_BITS_BUFFERarg[1] = N bits (1-8)Clocks in the first N LSbits into the next
byte in the Upstream Data Buffer and
increments the write pointer. Data is
latched on rising edge of clock
PGC must be set to output. PGD is
automatically set an input, and restored
to previous state after read.
0x200yyn : MOV #00yy, Wn
Where n= arg1
yy = first byte in download buffer
(includes SIX command)
0xD2CONST_WRITE_DLarg[1] = byte constantWrites arg[1] byte to the Download
Buffer.
0xD1WRITE_BITS_LIT_HLDarg[1] = N bits (1-8)
arg[2] = literal
0xD0WRITE_BITS_BUF_HLDarg[1] = N bits (1-8)Clocks out the first N LSbits of the next
Clocks out the first N LSbits of ‘literal’
PGD and PGC must be set to outputs
before calling.
Differs from WRITE_BITS_LITERAL
in that the instead of setting data, delay,
clock high, delay, clock low, this routine
works as setting data, clock high, delay,
clock low, delay. – for when hold time
after clock falls is important.
byte in the Downstream Data Buffer and
increments the read pointer.
PGD and PGC must be set to outputs
before calling.
Differs from WRITE_BITS_BUFFER
in that the instead of setting data, delay,
clock high, delay, clock low, this routine
works as setting data, clock high, delay,
clock low, delay. – for when hold time
after clock falls is important.
0xC4SPI_RDWR_BYTE_LITarg[1] = Byte to be sent[Setup applies]
Write byte is clocked out MSb first,
with MSB bit clock edge the first rising
edge.
Read byte is read MSb first, with first
byte clocked in on first rising edge of
clock, into upload buffer.
0xC3SPI_RDWR_BYTE_BUF-[Setup applies]
Write byte from download buffer is
clocked out MSb first, with MSB bit
clock edge the first rising edge.
Read byte is read MSb first, with first
byte clocked in on first rising edge of
clock, into upload buffer.
0xC2ICDSLAVE_RX_BL-Handles the ICD handshake and
receives a byte of data from the DE,
which is placed in the Upload Buffer.
0xC1ICDSLAVE_TX_LIT_BLarg[1] = byte to be transmittedHandles the ICD handshake and allows
the argument byte to be clocked out by
the DE.
0xC0ICDSLAVE_TX_BUF_BL-Handles the ICD handshake and allows
the next byte in the download buffer to
be clocked out by the DE.
0xBFMEASURE_PULSE-Measure up to 700ms positive pulse on
PGD pin (must be set as input
previously). Pulse must start within
700ms of measure start or it times out.
Pulse length is stored in UploadBuffer
as a Word in 21.333us increments. If
value is zero, no pulse detected. If value
is 0xFFFF pulse is longer than 700ms.
Measurement offset of up to +12/-16
counts.
0xBEUNIO_TXarg[1] = Device Address
arg[2] = N bytes to transmit
0xBDUNIO_TX_RXarg[1] = Device Address
arg[2] = N bytes to transmit
arg[3] = X bytes to receive
0xBCJT2_SETMODEarg[1] = number of bits
arg[2] = TMS value
Transmits N bytes from DL buffer on
AUX pin, after transmitting a Start
Header (with TSS) & Device Address.
NoMAKs the last byte. AUX pin set to
output at start, input when done. If
NoSAK received on transmit byte, sets
status bit ICD transfer timeout/Bus
Error. Bytes sent MSb first
Transmits N bytes from DL buffer on
AUX pin, after transmitting a Start
Header (with TSS) & Device Address.
AUX pin set to output at atart, input
when done. Then receives X bytes into
UL buffer, NoMaks the last byte. If
NoSAK received, sets status bit ICD
transfer timeout/Bus Error. Bytes
received MSb first
JTAG 2-Wire SetMode([1]’[2])
Bits in arg[2] sent LSb first. TDI = 0.
0xBAJT2_XFERDATA8_LITarg[1] = byte value to transferUses the XferData pseudo op to send 8
bits of data. Received data is placed in
the Upload Buffer.
0xB9JT2_XFERDATA32_LITarg[1] = LSB of value to transfer
arg[2] =2
arg[3] = 3
nd
rd
byte
byte
Transmits the given 32-bit value and
places the received 32-bit value in the
Upload buffer, LSB first.
arg[4] = MSB
0xB8JT2_XFRFASTDAT_LITarg[1] = LSB of value to transfer
arg[2] =2
arg[3] = 3
nd
rd
byte
byte
Transmits the given 32-bit literal value.
If PrAcc= 0, sets Status -> BusError
arg[4] = MSB
0xB7JT2_XFRFASTDAT_BUF-Transmits a 32-bit value from the
Download Buffer.
If PrAcc= 0, sets Status -> BusError
0xB6JT2_XFERINST_BUF-Completes the XferInstruction pseudo
op. 32-bit <instruction> is pulled from
the Download Buffer.
0xB5JT2_GET_PE_RESP-Completes the GET PE RESPONSE
pseudo op and places the 32-bit value in
the Upload Buffer.
0xB4JT2_WAIT_PE_RESP-Completes the GET PE RESPONSE
pseudo op but dumps the received data.
0xB3JT2_PE_PROG_RESPCompletes the GET PE RESPONSE
pseudo op but dumps the received data
and skips the “Tell CPU to execute inst”
commands.
*GOTO statements may NOT be placed within LOOPs.
** It is expected that for writes of baseline and midrange 12/14-bit instructions will be packaged by the host
software into a word with start and stop bits, which will be split between 2 subsequent bytes. On reads, the host
software will need to unpack the instructions from two subsequent bytes which include start and stop bits.
*** These routines leave ICSPDAT pin (RA2) as an output in the state of the last bit transmitted. This is so that
very slow debug targets will not miss the last bit.
The PC application loads the Device File into memory during startup. All families are loaded into an array of
structures, indexed by family ID. All part parameters are loaded into a linked list of structures. All scripts loaded
into an array which is indexed by script number.
NOTE: All references in following sections to “Check for connected device” include checks for voltage errors and
self-powered/unpowered target devices.
7.1Application Menus
PC application menus and menu items:
File
Import File- Loads memory arrays from hex file
Export File- Saves memory arrays into hex file
1 C:\TEMP\project.hex- up to 4 hex file “history” documents
Exit- Quits Application
Device Family
< Dynamic> - menu generated when loading the Device File.
Will have 1 entry for each device family supported.
Clicking a family entry looks for an attached device in that family.
Verify On Write- Check/Uncheck. If checked, verifies immediately after write.
Hold Device in Reset- Check/Uncheck. When checked, sets nMCLR/VPP pin = GND.
When unchecked, tri-states the pin.
Write on PICkit Button- Check/Uncheck. When checked, a Write can be initiated by
pressing the PICkti 2 button.
Manual Device Select- Sets the “Part Detect” property of all families to False
PICkit 2 Programmer-To-Go- Opens the Programmer-To-Go wizard
Enable Code Protect- Enables Code protect bits in configuration.
Enable Data Protect- Enables Data protect bits in configuration.
OSCCAL- Only enabled for devices with an OSCCAL instruction at the end of
Program Memory.
Set Manually- Erases device and sets OSCCAL instruction to given value.
Auto Regerate- Downloads and runs a calibration program on the target PIC
Target VDD Source- (submenu)
Auto-Detect- PICkit 2 checks for powered/unpowered target on each operation.
Force PICkit 2- PICkit 2 always attempts to power the device
Force Target- PICkit 2 always assumes the target is self-powered.
Calibrate VDD & Set Unit ID…- Opens a wizard to allow calibration of PICkit 2 voltages, and set
a Unit ID (Identifying string for PICkit 2 unit.)
Use VPP First Program Entry- For applicable families, use an alternate Program Entry script which
applies VPP before VDD
Fast Programming- When unchecked, uses slower programming.
UART Tool- Switches the application to the UART tool GUI.
Logic Tool- Switched the application to the Logic Tool GUI
Check Communication- Looks for PICkit 2 and a target device.
Troubleshoot…- Opens a wizard to exercise the PICkit 2 pins for operational
and connectivity troubleshooting.
Download PICkit 2 Operating System- Downloads firmware to PICkit 2 using bootloader
View
Help
Single Window- The default & legacy view format
Multi-Window- Displays memories in separate windows. Enables following:
Show Program Memory- Toggles whether Program Memory window is displayed or not
Show EEPROM Data- Toggles whether EEPROM Data window is displayed or not
Associate / Memory Displays in Front
- When enabled, memory windows move with main window, and
minimize, and come to front together. Memory windows will always
display in front of Main window (as they are owned by it)
PICkit 2 User’s Guide- Launches PDF file.
44-Pin Demo Board Guide- Launches PDF file
LPC Demo Board Guide- Launches PDF file.
PICkit 2 on the web- Opens www.microchip.com/pickit2
ReadMe- Launches Readme.txt file.
About- Pops dialog with license agreement and GUI, Device File, &
The GUI Status window lists the following information, some of which may be only appear for relevant parts. Other
times it will not be visible.
LabelExampleNotes
DevicePIC16F629“Not Present” if no device detected.
User ID’s7F 7F 7F 7FVisible if
Displays 7 LSBs of each word as 2 char hex
ChecksumNNNNSum of program memory plus masked config words.
Config Words1234 1234 1234 1234Displays up to 8 config words, based on
1234 1234 1234Config1 is upper left, Config 2 is directly to the right.
Each word displayed as 4 character hex.
OSCCAL3444Visible if
Displays last word of program memory as 4 char hex.
BandGap3000Visible if
< ><01>Revision brackets display revision code for active device
(excludes baseline). Only visible if REVS: is added
to INI file.
UserIDWords > 0
ConfigWords.
OsccalSave = ‘Y’
BandGapMask > 0000.
7.3PC Application Startup
On startup, the PC application performs the following tasks:
1. Look for PICkit2. If not found, display an error and disable all functions. If found, check firmware version
is minimum required. If not, disable all functions except to download new firmware.
2. Check the device file version for minimum. If not valid or no device file, display error and disable all
functions.
3. Load Device File. When loading the Device File, the PC application loads the families in index order.
Each becomes a menu option under Menu “Device Family”, with the menu text being
duplicate
status window. Ex “Midrange Device Configuration.”
4. Search for Devices. The GUI will search for devices in order of the
device is found, the application will default to last the family setting from the INI file.
5. Initialize all memory arrays. Program memory blank value set according to device family found.
6. Set form appropriately for family and device found.
FamilyIDs will overwrite earlier entries. The FamilyName parameter is also used to title the
4. Load all data with addresses from (
memory array.
5. Load all data with addresses from (
memory array.
6. Update “Source” line on GUI.
7. Close file & clean up.
ProgMem – 1) into the program memory array.
EEAdr) to (EEAdr + EEMem) into the EE data array.
UserIDAddr) to (UserIDAddr + UserIDWords) into the User ID
ConfigAddr) to (ConfigAddr + ConfigWords) into the configuration
7.5Hex file Export
Menu option
File -> Export File
On selection, this menu item will:
1. Bring up dialog to select file name & location.
2. Save data from program memory array to addresses (0) to (
3. Save data from the EE data array to addresses (
4. Save data from the User ID memory array to addresses (
5. Save data from the configuration memory array to addresses (
6. Close file & clean up.
EEAdr) to (EEAdr + EEMem.
ProgMem – 1).
UserIDAddr) to (UserIDAddr + UserIDWords).
ConfigAddr) to (ConfigAddr + ConfigWords).
7.6 Read Device
Menu option
Programmer -> Read Device
“Read” Button
1. Check for a connected device in the currently selected Device Family. If none found, abort and update
status.
2. Read program memory into program memory array using
ProgMemRdScript, and ProgExitScript.
3. If
EEMem > 0, read EE data in to EE data array using ProgEntryScript, EERdPrepScript, EERdScript, and
ProgExitScript.
4. If
UserIDWords > 0, read User IDs using ProgEntryScript, UserIDRdPrepScript, UserIDRdScript, and
ProgExitScript.
5. If
ConfigWords > 0, read configuration words using ProgEntryScript, ConfigRdPrepScript,
1. Check for a connected device in the currently selected Device Family. If none found, abort and update
status.
2. Check for
3. Check for date-time change on hex file, if loaded. If so, reload file.
4. If
OsscalSave = ‘Y’, read OSCCAL from ProgMem-1 using ProgEntryScript, OSCCALRdScript, and
ProgExitScript.
5. Store OSCCAL into last word of program memory array.
6. If
BandGapMask > 0, read BandGap config word using ProgEntryScript, ConfigRdPrepScript,
ConfigRdScript, and ProgExitScript.
7. Store BandGap bits in first word of configuration array.
8. Perform a chip erase using
9. Going backwards from ProgMem in the program memory array, find the last non-blank memory address.
10. Write program memory array contents up to the last address found in (4) using
ProgMemWrPrpScrpt, ProgMemWrScript, and ProgExitScript. A 3-byte address is always sent as the first
bytes in the download buffer for each execution of the script.
11. If
EEMem = 0, skip steps 11 & 12.
12. Going backwards from
13. Write EE data array contents up the address found in (11) using
EEWrScript, and ProgExitScript.
14. If UserIDWords = 0, skip step 15.
15. Write User ID words using
16. Verify device Code, EE, & UserIDs.
17. If verify fails, display error section & address and abort.
18. If menu Tools->Code Protect Device is selected, apply
19. If (
20. Write configuration words using
ProgExitScript.
21. Display “write successful”
VddErase. If Vdd below, pop warning allowing user to continue or cancel.
ProgEntryScript, ChipEraseScript, and ProgExitScript
ProgEntryScript,
EEMem in the EE data array, find the last non-blank EE byte address.
ProgEntryScript, EEWrPrepScript,
ProgEntryScript, UserIDWrPrepScript, UserIDWrScript, and ProgExitScript.
CPMask to CPConfig to enable all CP bits
ConfigWords = 0) OR (ConfigAddr < ProgMem), skip step 20.
ProgEntryScript, ConfigWrPrepScript, ConfigWrScript, and
The PC Application uses a text .ini file. This file will be read at startup, and saved when the application is closed. If
no file exists at startup, then all parameters will default. (The file may simply be deleted when the application is
closed to restore all settings to defaults.)
The parameters in the file allow various GUI options to be “remembered” from one session to another.
Comments are indicated with a semicolon. The following comments will be present at the start of the file:
Application version, date & time saved.
Parameters:
All parameters are four characters followed by a colon. The colon is followed by a space and the value.
ADET: <Y, N>
-‘Y’ (default) to auto-detect parts of applicable families
-‘N’ to disable auto-detect, and select all parts manually.
PDET: <Y, N>
-‘Y’ (default) to auto-detect parts on starting application
-‘N’ to disable auto-detect on startup (If ADET = N, this is set to N)
LFAM: <family string from device file>
-last family used. If no part is found on startup, will default to LFAM
VRFW: <Y, N>
-‘Y’ if verify on write menu option is checked.
WRBT: <Y, N>
-‘Y’ if write on button menu option is checked.
MCLR: <Y, N>
-‘Y’ if Hold Device in Reset menu option is checked.
TVDD: <Auto, PICkit, Target>
-which Target VDD Source option is selected.
FPRG: <Y, N>
-‘Y’ if Fast Programming is checked.
PCLK:< 2 - 16>
-
SET_ICSP_SPEED argument for “slow” (Fast Programming unchecked)
PASC: <B, Y, N>
-‘Y’ if program memory view is hex & word ASCII
-‘B’ if program memory view is hex & byte ASCII
EASC: <B, Y, N>
-‘Y’ if EEPROM memory view is hex & word ASCII
-‘B’ if program memory view is hex & byte ASCII
EDIT: <Y, N>
-‘Y’ to allow editing of program and EE memory data.
REVS: <Y>
- When label exists, it enables display of device revision <nn> in Status Window. Delete label to disable.
The device file is divided into 4 main sections. The first section gives general information about the device file
itself. The second section lists and defines device families, which contain parameters common to all parts in the
family. The third section contains parameters for each supported part, including which family a part belongs to.
The final section defines scripts that may be referred to in each part’s parameters.
NOTE: This section contains a listing of parameters and descriptions of their function. It is not intended to describe
the binary file format or order of parameters in such file. See the Source Code for file structure information.
8.1Device File Parameters
Parameter
Name
VersionMajor0-99‘1’Device File major version
VersionMinor0-99‘0’Device File minor version.
VersionDot0-99‘2’Device File development version.
VersionNotesString‘Initial Release’Text notes for version
NumberFamiliesInteger‘5’The number of Family Parameter sets in
NumberPartsInteger‘187’The number of Part Parameter sets in the
NumberScriptsInteger‘170’The number of Scripts in the device file.
Compatibility0-255‘1’A number that allows the PC Application
RangeExamplesDescription
the device file.
device file
to determine if it can use this Device File
version.
FamilyID0-255‘1’Each family has a unique ID that is used to
FamilyType0-255‘3’This is actually used as the “Device
SearchPriority0-255‘2’This is the order in which the GUI will
FamilyNameString‘PIC18_J_’, ‘Baseline’,
Vppfloat“12.0”Vpp voltage. If set to zero (0), then Vpp =
ProgEntryScript0-65535‘1’Number of script to enter programming
ProgEntryVPPScript0-65535‘1’Number of script to enter programming
ProgExitScript0-65535‘2’Number of script to exit programming
ReadDevIDScript0-65535‘5’Number of script used for reading the
DeviceIDMaskUp to 8 hex
BlankValueUp to 8 hex
BytesPerLocation0-255‘2’# bytes per memory array location.
AddressIncrementByte‘2’Address increment per array location.
ProgMemHexBytesbyte‘4’# bytes in hex file per array location.
EEMemHexBytesbyte‘1’# bytes in hex file per array location.
EEMemBytesPerWordbyte‘2’# bytes per EE location for script data
EEMemAddressIncbyte‘1’For display purposes, the address per
UserIDHexBytesbyte‘2’# bytes per UserID location in the hex file.
UserIDBytesbyte‘2’# bytes per User ID location in part.
ProgMemShiftbyte‘1’# bits positions to left shift program
PartDetectY/NYAutodetects a part and verifies the ID when
RangeExamplesDescription
reference it in the Part Parameter section.
Family” menu display order in the GUI,
with ‘0’ being the first displayed family.
search for parts on startup. Lower numbers
first.
The text appears both on the GUI and as a
‘EEPROMS/24LCxx’
‘3FF0’Mask of significant bits in Device ID
characters
‘3FFF’The value of a word in an erased part.
characters
menu selection under “Device Family”.
“submenus” of families can be created
under the “Device Family” menu by using
a “/” slash to separate the submenu name
from the family name.
VDD.
mode.
mode VPP first.
mode.
device ID.
word. Usually masks out the version bits.
handling purposes (ex 16F is 2, 18F is 1)
location (word).
memory word before downloading, and
right shift after uploading. (for Midrange,
which data includes start/stop bits.)
an operation is selected if ‘Y’.
When ‘N’, detection and ID checking is
disabled. Instead a combo box list of
available parts is displayed.
TestMemoryStartUnsigned IntegerNot presently used
TestMemoryLengthUnsigned IntegerNot presently used
8.3Part Parameters
There should be one “default” parameter set for each device family. This part will have a PartID of ‘0000’ and a
PartName of “Not Present.”
Any script number value of ‘0’ will be interpreted as the part does not use that script (no script assigned).
Parameter
Name
PartName20 chars max‘PIC18F24J10’The name of the part to appear in the
Family0-255‘4’This part uses the common parameters
DeviceIDUp to 8 hex
ProgramMem0 to 262144
EEMem0 to 4096
EEAddrunsigned int‘2100’Starting address of EE data in a hex file.
ConfigWords0-255‘4’Number of configuration words.
ConfigAddrunsigned int‘1FFC’Starting address of configuration words
UserIDWords0 to 255‘0’Number of User ID words. ‘0’ indicates
UserIDAddrunsigned int‘2000’Starting address of User ID words in a
BandGapMaskUp to 8 hex
ConfigMasksUp to 8 hex
RangeExamplesDescription
GUI
defined in the family section. (points to a
Family Parameter set FamilyID)
‘1D00’The part’s unique device ID. Rev bits
characters
‘8192’Size of program memory in words.
Words
‘256’Size of integrated EEPROM in words.
Words
‘3000’A mask for Config bits to be saved
characters
‘04E1.0FC7.0100.0000’Mask for configuration bits. The leftcharacter
words
are set to zero.
(8bit = 1byte/word, 16b = 2bytes/word)
‘0’ indicates no EEPROM.
in a hex file. If less than ProgMem, the
words will also be placed in the Program
Memory array.
no User ID words.
hex file.
across erases. Always applies to first
config word. If 0000, then it is ignored.
most word is the least significant config
word. The number of words should
match
ConfigWords
For 10F/12F/16F Devices with
“OsccalSave = Y”
Word 8 is used as an OSSCAL mask to
verify a valid instruction. Ex “0x0C00”
for baseline devices.
Word 7 is used as the configuration
value during a “regenerate OSCCAL”
operations.
For Baseline Devices
Word 6 is used as a configuration word
“OR” mask, to set bits on Import (for
The last Config mask (mask8) is used as
a “Programmer-To-Go” checksum
adjustment for checksum verification to
account for masked off but active
configs bits in some devices.
For
Serial EEPROM Devices,
ConfigWords should be set to zero.
The words have the following meaning:
Word1 : 1 = I2C, 2=SPI, 3= Microwire,
4 = UNIO
Word2 : address bytes mask
Word3 : number address bits
Word4 : I2C number active Ax pins
ConfigBlankUp to 8 hex
character
words
CPMaskUp to 8 hex
characters
CPConfig0-255‘3’The number of the configuration word to
Config9Mask16 bitsMask for devices with 9th Config bit
Config9Blank16 bitsBlank for devices with 9th Config bit
OsccalSaveY / N‘N’If ‘Y’, then the last program memory
IgnoreAddressUnsigned intStarting Address (in hex file) of section
IgnoreBytesushortStarting from IgnoreAddress the number
VddMin2.5 – 5.0‘2.5’Minimum Vdd supported for the part.
VddMax2.5 – 5.0‘5.0’Maximum Vdd supported for the part.
VddErase2.5 – 5.0‘4.5’Minimum Vdd supported for bulk erases.
CalibrationWords0-255Number of calibration words following
ChipErasePrepScript0-65535Script run before Chip Erase Script if
ChipEraseScript0-65535‘12’Number of script used to perform a chip
ProgMemAddrSetScript0-65535‘31’Number of script for setting Program
ProgMemAddrBytes1-256‘3’Length of address sent down in bytes for
ProgMemRdScript0-65535‘13’Number of script used to read program
ProgMemRdWords1-256‘32’The number of words read by one
EERdPrepScript0-65535‘32’Number of script intended as one-time
‘04E1.0FC7.0100.0000’Value of the configuration words after a
Chip Erase has been performed. The
number of words should match
ConfigWords
‘0400’Mask for the code protect bits in the
config word given by
which
CPMask applies.
location is saved across erase cycles.
of hex file to be ignored – For sections
that aren’t used so they don’t generate an
“Hex file too large” warning.
EERdScript0-65535‘15’Number of script used to read EEPROM
data.
EERdLocations1-256‘4’The number of memory locations read
by one execution of the script.
UserIDRdPrepScript0-65535‘33’Number of script intended as one-time
setup or preparation for reading UserIDs.
UserIDRdScript0-65535‘16’Number of script used to read the
UserID words. Should return
UserIDWords number of words.
ConfigRdPrepScript0-65535‘34’Number of script intended as one-time
setup or preparation for reading
configuration words.
ConfigRdScript0-65535‘17’Number of script used to read
Configuration words. Should return
ConfigWords number of words.
ProgMemWrPrepScript0-65535‘35’Number of script intended as one-time
setup or preparation for writing program
memory.
ProgMemWrScript0-65535‘20’Number of script used to write program
memory.
ProgMemWrWords1-256‘32’The number of words written by one
execution of the script.
ProgMemPanelBufs1-256‘4’Not presently used
ProgMemPanelOffsetunsigned int‘4096’Not presently used
EEWrPrepScript0-65535‘36’Number of script intended as one-time
setup or preparation for writing EE data.
EEWrScript0-65535‘21’Number of script used to write EEPROM
data.
EEWrLocations0-255‘1’The number of locations written by one
execution of the script. Bytes for 8bit,
words for 16-bit
UserIDWrPrepScript0-65535‘37’Number of script intended as one-time
setup or preparation for writing UserIDs.
UserIDWrScript0-65535‘22’Number of script used to write the
UserID words. Should write
UserIDWords number of words.
ConfigWrPrepScript0-65535‘37’Number of script intended as one-time
setup or preparation for writing
configuration words.
ConfigWrScript0-65535‘23’Number of script used to write
Configuration words. Should write
ConfigWords number of words.
OSCCALRdScript0-65535‘30’Number of script used to read OSCCAL
byte.
OSCCALWrScript0-65535‘31’Number of script used to write OSCCAL
byte (after erase).
ProgMemEraseScript0-65535‘32’Number of script to erase program
memory only
EEMemEraseScript0-65535‘33’Number of script to erase EE memory
only
ConfigMemEraseScript0-65535‘34’Number of script to erase configuration
memory only.
DPMask16-bitMask for the EE data protect bits in the
WriteConfigOnEraseY/NSome parts (some 18F, dsPIC33)do not
erase Config to default values on Bulk
Erase, so default config values must be
written on erase
BlankChkSkipUsrIDsY/NSome parts (dsPIC33) do not erase User
IDs to blank on Bulk Erase, so skip them
on Blank Check.
TestMemoryRdScript0-65535Number of script to read words from
Test Memory
TestMemoryRdWords0-65535# words read by TestMemoryRdScript
EERowEraseScript0-65535Script for row erasing EE Data memory
(needed for dsPIC30). Used for low Vdd
programming. Note script advances PC
by EERowEraseWords on each
execution.
EERowEraseWords0-65535Number of words (locations) erased by
one executiong of EERowEraseScript
ExportToMPLABY/NMeta-data only used by Device File
Editor
DebugHaltScript Only used by MPLAB
DebugRunScriptOnly used by MPLAB
DebugStatusScriptOnly used by MPLAB
DebugReadExecVerScriptOnly used by MPLAB
DebugSingleStepScriptOnly used by MPLAB
DebugBulkWrDataScriptOnly used by MPLAB
DebugBulkRdDataScriptOnly used by MPLAB
DebugWriteVectorScriptOnly used by MPLAB
DebugReadVectorScriptOnly used by MPLAB
DebugRowEraseScript0-65535Script for row erasing program memory.
Used for low Vdd programming. Note
script advances PC by
DebugRowEraseWords on each
execution.
DebugRowEraseWords0-65535
DebugReserved5(Emulation Wr)Only used by MPLAB
DebugReserved6(Emulation Rd)Only used by MPLAB
LVPScriptScript used for Low-Voltage-
Programming program entry. If no
script assigned (=0), then the part does
not support LVP.
ScriptNumber1-65536‘121’Essentially, its array index number + 1
ScriptNameStringText name of the script
ScriptVersion0-65535‘2’Version of the script itself. Should be
ScriptLength0-61‘37’Length of script in terms of array
CommentStringText comments related to the script
Scriptushort ArrayArray containing script elements (control bytes and arguments). The
RangeExamplesDescription
(0 reserved for no script)
incremented on changes.
elements. Presently must not exceed 61.
first element to execute is in array position [0].
The control bytes and arguments are stored in the low byte of each
array element.
The upper byte is used for tags:
0xAA = Control Byte (as opposed to argument byte)
0xBB = Display argument byte as hexadecimal
0x00 = Display argument byte as decimal