Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

generate serial number in code at compile

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
james.harwood

Bascom Member



Joined: 02 Mar 2005
Posts: 10
Location: Herts, England

blank.gif
PostPosted: Thu Mar 10, 2005 12:45 am    Post subject: generate serial number in code at compile Reply with quote

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
View user's profile
ATIU

Bascom Member



Joined: 15 Oct 2004
Posts: 528

philippines.gif
PostPosted: Thu Mar 10, 2005 10:03 am    Post subject: Reply with quote

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
View user's profile
Gyurma

Bascom Member



Joined: 10 Mar 2005
Posts: 17
Location: Budapest

hungary.gif
PostPosted: Thu Mar 10, 2005 11:50 am    Post subject: Re: generate serial number in code at compile Reply with quote

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
View user's profile Visit poster's website
james.harwood

Bascom Member



Joined: 02 Mar 2005
Posts: 10
Location: Herts, England

blank.gif
PostPosted: Thu Mar 10, 2005 7:10 pm    Post subject: thanks Reply with quote

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
View user's profile
ATIU

Bascom Member



Joined: 15 Oct 2004
Posts: 528

philippines.gif
PostPosted: Fri Mar 11, 2005 7:51 am    Post subject: Reply with quote

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
View user's profile
Luciano

Bascom Member



Joined: 29 Nov 2004
Posts: 3149
Location: Italy

blank.gif
PostPosted: Fri Mar 11, 2005 1:59 pm    Post subject: Reply with quote

Hi!

From here you can download Hexmate BETA v1.55.
(See the word "Attachments" next to the post date and time).

http://www.htsoft.com/forum/all/showflat.php/Cat/0/Number/12986/an/0/page/0

See option -SERIAL of Hexmate.

* * *

If you decide to write your own tool:

Intel HEX File Format:
http://www.8052.com/tutintel.phtml


Best regards,

Luciano
Back to top
View user's profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum