Using time of programming as unique ID

Hooter

Senior Member
#1
Folks - Not too long ago there was a thread which spoke about using the time of day when the Picaxe was initially
programmed with its firmware to create a reasonably unique ID if one wanted to use multiple Picaxes in a network.
I have searched high and low and haven't been able to find it.
Is there anybody out there who can recall this.
As always - any assistance is appreciated.
Hooter
 

hippy

Technical Support
Staff member
#2
The 'ppp' pre-processor parameter substitutions are what you are probably thinking of ...

http://www.picaxe.com/BASIC-Commands/Directives/preprocessor

You can insert ppp_datetime and others into a SERTXD ...

Code:
SerTxd( "Created on ", ppp_datetime, CR, LF )
And you can also use similar to create a unique ID ...

Code:
SerTxd( "Created on ", ppp_datetime, CR, LF )
w0 = 0
For b2 = 0 To 18
  ; 0123456789-12345678
  ; 2018-05-29 13:46:50
  LookUp b2,( ppp_datetime ),b3
  w0 = w0 + b3
Next
SerTxd( "Unique ID = ", #w0, CR, LF )
You can also include those within EEPROM or TABLE statements and read the data from there or use that to create a unique ID ...

Code:
Eeprom 0, ( ppp_datetime )

SerTxd( "Created on " )
For b2 = 0 To 18
  Read b2, b3
  SerTxd( b3 )
  w0 = w0 + b3
Next
SerTxd( CR, LF, "Unique ID = ", #w0, CR, LF )
 
Top