# Serializing Parts

TYPE | DIRECTIVE | OPTIONAL | ARGUMENTS
Operation | serialize | Yes | <dest_addr> <serial_number> <format> <step>

The serialize directive is used to store a serial number into the target device memory selected by the memory directive.

This directive can only be used in a command file.

<dest_addr> = address of the serial number Most Significant Byte.

<serial_number> = current value of the serial number; this value will be incremented (or decremented, following the value of <step>) and the command file updated with the new SN value. Therefore, you can suspend and resume the serialization of parts at any time; the command file always contains the next SN to be written.

8 bits <= SN Length <= 64 bits

The SN value must be written in decimal or hexadecimal; no other format is allowed. Hexadecimal serial number values must be prefixed with 0x.

<format> = number | ascii | unicode

number :

if SN = 123456, the memory content after serialization is:

Address | a | a + 1 | a + 2 | a + 3 | a + 4 | a + 5 |  |  |
Data | 12 | 34 | 56 |  |  |  |  |  |

ascii :

if SN = 123456, the memory content after serialization is:

Address | a | a + 1 | a + 2 | a + 3 | a + 4 | a + 5 |  |  |
Data | 31 | 32 | 33 | 34 | 35 | 36 |  |  |

unicode :

if SN = 123456, the memory content after serialization is:

Address | a | a + 1 | a + 2 | a + 3 | a + 4 | ... | a + 9 | a + 10 | a + 11
Data | 31 | 00 | 32 | 00 | 33 |  | 00 | 36 | 00

<step> = the SN increment step; it may be a negative number.

Command file example :

-device T89C51CC01

-hardware PEAK

-canbitrate 500

-operation

memory FLASH

erase F

serialize 0x7F0 12345678900 number 1

The address of the serial number must be chosen with care in order not to exceed the memory size or corrupt the firmware. Batchisp can detect that the Least Significant Byte of the serial number is out of range and displays an error message when this situation occurs.