View previous topic :: View next topic |
Author |
Message |
james.harwood
Joined: 02 Mar 2005 Posts: 10 Location: Herts, England
|
Posted: Thu Mar 10, 2005 12:45 am Post subject: generate serial number in code at compile |
|
|
Hi,
Does anyone know of a method to to generate a serial number (stored as a text string * 5) that automatically increments each time a project is compiled
The reason for this is that each product that is programmed needs to have a unique serial number that will be programmed in as part of the programs code, then, when needed the user can find the products serial number from the products lcd
The idea is that a compiler directive would tell the compiler to increment a number that is then compiled in to the code as a string * 5
Either that or does anyone know if each avr chip has a unique serial number embedded in it, and if so, how could i read it; That way i could just use the avr's serial number as my product serial number, as the products serial number just has to be unique
Thanks
James
|
|
Back to top |
|
|
ATIU
Joined: 15 Oct 2004 Posts: 534
|
Posted: Thu Mar 10, 2005 10:03 am Post subject: |
|
|
Why not use the EEPROM space for the seial number so you only will have one compiled firmware version, then generate different EEPROM image for the serial number. How to generate an incrimenting serial number for the EEPROM image file is beyond my knowledge right now, but there should be a way out there to do this easily. |
|
Back to top |
|
|
Gyurma
Joined: 10 Mar 2005 Posts: 17 Location: Budapest
|
Posted: Thu Mar 10, 2005 11:50 am Post subject: Re: generate serial number in code at compile |
|
|
Bascom 1.11.7.7 has function Version(). Another solution is the function Syssec(). If you store the returning values in the eeprom you will get a unique serial number for each product. See the help for more information about the functions! |
|
Back to top |
|
|
james.harwood
Joined: 02 Mar 2005 Posts: 10 Location: Herts, England
|
Posted: Thu Mar 10, 2005 7:10 pm Post subject: thanks |
|
|
Thanks guys, I'll have a look in to both of the ideas
I'm thinking at the moment that I might make a VB program that updates the .eep file and then uses pony prog of something similar to program the chip - That is presuming the .eep file is a text file that stores the values in a hex format |
|
Back to top |
|
|
ATIU
Joined: 15 Oct 2004 Posts: 534
|
Posted: Fri Mar 11, 2005 7:51 am Post subject: |
|
|
You may want to look at atmel website application note AVR911: AVR Open-source Programmer. Modify the codes so it will generate an EEPROM image, incrimenting this everytime a uC is programmed. Then you have an incrimental serial number for every chip that rolls out from your firmware programmer. |
|
Back to top |
|
|
Luciano
Joined: 29 Nov 2004 Posts: 3149 Location: Italy
|
|
Back to top |
|
|
|