PICkit 2 Device Data File Editor

This program provides a simple interface for editing the device data file PKDeviceFile.dat that comes with the PICkit2 windows programs. It's my first .NET application ever and I won't be surprised if there's a few bugs in it.

I know this is a painfully simple program which probably doesn't require any documentation whatsoever, so only basic notes are provided.

Program screenshot:

Usage

File Menu:

Open - loads and decodes file

Save - overwrites the loaded file with the data in memory

Save As - writes the data in memory to a file of your choosing

Right click on any leaf node (in the left treeview panel) for a popup menu to:

Duplicate - make an identical copy of the selected family/part/script

Remove - delete the selected family/part/script

Number formats:

- where a field is displayed as hex (dec), you can enter

Hex: e.g. 0xfa44 or &hfa44 or fa44h

Binary: e.g. 0b11110010 or %11110010

Decimal: e.g. 1443

- where a field is displayed as decimal, you can enter

Hex: e.g. 0xfa44 or &hfa44

Decimal: e.g. 1443

The program is generally only useful for adding new parts not currently supported by the devicefile bundled with the PICKit 2. The process, after opening the devicefile, is simply to choose an existing PIC from the list of devices, right click on it and select Duplicate Item. There will now be a copy of the part you selected. Change the properties of the new part, including the part name, to appropriate values for the new part. Then save the file and you're done.

It's possible to find the appropriate fields from the datasheet and programming specification documents for the particular PIC part. Sometimes it's a little bit hard to find what you're looking for, or to even know what you should be looking for; feel free to ask on the Microchip Forums (in particular under this thread: PK2 Device File Editor Thread); there's some very knowledgeable and experienced members there.

There is sometimes updates devicefiles available from Microchip (maybe search the Microchip forums).

Downloads

If you already have the .NET 2.0 framework and the VC9 redistributable dll files installed (either in the windows\system32 directory, or in the same directory of this program) you can just download the exe and dll files and the program should run. Or you can use an installer (which I haven't bothered to include for later builds - it's not needed, just copy the exe and dll to the same directory and it should run; provided the VC runtime files are present on the PC).

N.B. VC Runtime files are not required from version 1.0.0.6 onwards.

Version 1.0.0.7 Exe only (.NET 2.0)

Notes: someone asked for export/import XML - it's not really tested though....

Version 1.0.0.6 Exe only (.NET 2.0)

Notes: RawConvert.dll (a 32-bit library) dependency has been removed which may allow the program to run under 64 bit Windows.

Version 1.0.0.5 Exe + Dll only (.NET 2.0)

Notes: The serialization bug introduced in 1.0.0.4 has been fixed. DeviceID field is also now displayed as 0xHEX (DEC).

Version 1.0.0.4 Exe + Dll only (.NET 2.0)

Notes: All fields that look like they should be hex are displayed as 0xHEX (DEC); values can be entered as decimal, hex (prefix "0x" or "&H" or suffix "H") or binary (prefix "0b" or "%"). The ScriptLength field is now automatically updated as you change script command array.

Version 1.0.0.3 Exe + Dll only (.NET 2.0)

Notes: The Parts List tree view section is sorted by name. Duplication now actually copies the object data (not just the reference). Fixed the collection explosion bug (probably added some new ones)

Version 1.0.0.2 Installer (.NET 2.0) Version 1.0.0.2 Exe + Dll (.NET 2.0)

Notes: Same as 1.0.0.1, but had to do some mods to let it compile under .NET 2.0 (required to run on the old W2k)

Version 1.0.0.1 Installer (.NET 3.5) Version 1.0.0.1 Exe + Dll (.NET 3.5)

Notes: Proof of concept

Version 1.0.0.0 (.NET 3.5)

Notes: I lost it. It was rubbish anyway so I guess it wasn't really a loss.

MS VC++ Redistributable DLLs

Notes: You may need to download these and extract them to the same directory that you extracted the above .exe + .dll to. Only required if you don't already have them on your PC.

Bugs (that I know of)

  1. Version 1.0.0.3+. Fixed: You'll get a warning if you try to change the configMask & configBlank & script dimensions.

    1. Versions 1.0.0.0 - 1.0.0.2. Workaround: User takes some responsibility for their actions (am I dreaming?) When editing data arrays from the properties editor dialogue, it's possible to add and remove items from the array (and consequently change its size). This could forseeably create an invalid file.

  2. Version 1.0.0.3+. Fixed: LeafInfoNode object is now serializable and is cloned for the duplicate operation

  3. Versions 1.0.0.0 - 1.0.0.2. Workaround: you could duplicate all the nodes you want, save the file, then reopen it and edit the nodes

    1. Using the duplicate function creates a new tree node but the actual data is shared between the new node and the old node

  1. Version 1.0.0.3+. Fixed: Cut & paste error - I was adding new items to the collections as I was writing them to the file (dumb!)

  2. Versions 1.0.0.0 - 1.0.0.2. Workaround: Just reopen the file, redo the changes and hopefully it works this time.

    1. When duplicating and/or removing nodes after saving a file the number of objects in the families, parts lists and scripts collections double. It only happens after saving the file (which appends to the collections) and then performing a duplicate/remove (which updates the count of items that will later be written to file)

  1. Version 1.0.0.5+. Fixed: marked types as serializable

    1. Version 1.0.0.4. int16_t and int32_t data types were not marked as serializable - this meant duplicating an item wasn't possible

Found any new bugs? Please tell me.

Enhancements

- none planned

Contact

For info on the PK2 device data file and what to do with it, try the Microchip forums, or more simply PK2 Device File Editor Thread (probably how you found this page)