|Home||PICProg 13V version||PICProg 5V ISP version|
Serial adds serial number, date and time to hex-files
Many modern devices contain a microcontroller with a communication interface. This can be used without extra cost to improve the software version management. Therefor the software must provide a possibility to read out serial number, production date and time. This data can easily embedded into the program with Serial. Other applications are the usage of the serial number for bus arbitration and device identification in a network.
Table of contents:
|/read||try to read serial number, date and time from file|
|/pic||limits serial number to 14 bits|
|/w:||hex-file to be modified, extension will be ignored and set to .hex|
To support the batch mode, feedback can be received via error levels:
|1||start target address not found|
|2||error in hex-file|
|3||nothing to do|
For every byte that should be insert, a dummy byte must exist in the original hex-file.
Serial number, date and time are written to the hex-file as follows:
|0||serial number low byte|
|1||serial number high byte|
|4||year (last two digits)|
The serial number is stored in a file named "hex-file name".ser. The format of this file is:
|1||start target address|
Solution: Employ Serial and PICProg in the following way:
org 0x0FFC dw 0x0000, 0x0000, 0x0000, 0x0000
&h01FF8 0The first line will let Serial search for the address 0x0FFC. Pay attention the factor of two, which is caused by the need of two bytes in the hex-file for every 14 bit word of the PIC's flash memory.
ppserial lpt1 "hex-file name"and follow the instructions.
Solution: Employ Serial and Peter Dannegger's Atmel MCU Programmer in the following way:
ORG 0FF8H PGMSNR: DB 0 ;0 serial number low byte DB 0 ;1 serial number high byte PGMDate: DB 0 ;2 day DB 0 ;3 month DB 0 ;4 year (last two digits) PGMTime: DB 0 ;5 hour DB 0 ;6 minute DB 0 ;7 second
&h0FF8 0The first line will let Serial search for the address 0x0FF8.
unibatch "hex-file name"and follow the instructions.
Disclaimer: No warranty at all!
Copyright by Martin Clausen, Germany.
Contact the author: mc AT rotgradpsi DOT de