To get the S/N to change at runtime, you'd have to overwrite the flash memory where that string resides, then force the PC to enumerate again.
Not worth it.
If you want it to be selected by PORTD jumpers, then just create a command that the PC program sends to the PIC requesting the value of PORTD. The PIC then reads the PORT and sends the value back to the PC.
That only has to be done once when the program connects to the device.
Another way is to let the PC program assign an ID number and send it to the PIC. Store it in EEPROM, and return the value upon request from the PC.
Then the PC program can keep track of which ID's have been used, to minimize possible duplicates. And the user doesn't need to do anything.
The S/N can then be used to indicate the firmware version. So it knows which command to send to get the ID.
<br>
Bookmarks