![Program serial numbers .doc](https://kumkoniak.com/16.jpg)
Then I can get each device to print out its current configuration every time it starts up. Since I already have an EEPROM configuration system in the software, it’s trivial to put the serial number in the EEPROM. So those “configurations” are stored in the EEPROM, which isn’t erased when new code is uploaded. Serial #1 is still useful as a bench-test unit even if it can never leave my bench due to that fault. I don’t want to edit those places in the software each time I upload code to the device. Serial number 1 has a fault on the PCB fixed by jumpering across to a different Arduino pin and Serial number 2 changed one switch from active-HIGH to active-LOW. Many of my projects have several (nominally) identical pieces of hardware.
![program serial numbers .doc program serial numbers .doc](https://helpx.adobe.com/content/dam/help/pt/acrobat/kb/convert-from-trial-to-classic/_jcr_content/main-pars/procedure/proc_par/step_2/step_par/image/unistall_Acrobat_DC.png)
Not sure if that was a commercial program (he had no qualms about splashing out cash for special build/upload tools), or just a python script - there's a python library that makes it super easy to work with hex files for things like this).
![program serial numbers .doc program serial numbers .doc](https://img.yumpu.com/18468630/1/500x640/slab-track-field-test-and-demonstration-program-for-shared-.jpg)
You can also put the serial number into the flash directly and read it with the appropriate function (depending on the archtecture, the details are different - classic AVRs use the pgm_read_x_near function if it's below 64K, pgm_read_x_far if it's above 64K, where x corresponds to how much data you're reading at a time)- if you're programming these things automatically, you can make your upload scripts modify the hex file before upload (this is what has always been done when i've been working on something that's done as a commercial product the case that I can remember off the top of my head, we stuck it in the gap between the end of the bootloader and the end of the flash - the guy who was actually doing the f/w upload used a tool to write the flash which could be configured to put a sequential serial number into a specified location in the flash automatically. You do need to either upload separate f/w to write to it initially, or when you're programming the boards via ICSP before you ship them out, you can have it write the EEPROM (the bootloader can't IIRC, at least on the Uno/Nano/ProMini and I think the Mega as well - this is to reduce the flash used by the bootloader - at least on Optiboot (used on Uno), you can't get it to write the EEPROM through the bootloader and have the bootloader fit in 512b - you need to step up to the next size, 1024b). The EEPROM is not hidden - your sketch can write it freely.
![Program serial numbers .doc](https://kumkoniak.com/16.jpg)