View previous topic :: View next topic |
Author |
Message |
elcrcp
Joined: 11 Mar 2016 Posts: 62 Location: izmir / Turkey
|
Do PICs have an usable unique ID? |
Posted: Thu Nov 08, 2018 12:38 pm |
|
|
Hi guys, That question just popped in my mind. PICs do have some unique product ID as I remember (or maybe my memory is blurry) but can we get them as a constant or char array? _________________ There is nothing you can't do if you try |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19537
|
|
Posted: Thu Nov 08, 2018 1:46 pm |
|
|
No, not unique.
The reason mass production devices like this don't have unique ID's is cost. Chips with unique ID's, have these lasered in, which is slow and hence relatively expensive, for devices made 'down' to the minimum price like the PIC.
If you need a unique ID, you would have to add something like the 24AA02UID and read this. |
|
|
elcrcp
Joined: 11 Mar 2016 Posts: 62 Location: izmir / Turkey
|
|
Posted: Thu Nov 08, 2018 1:52 pm |
|
|
Hmm, I do remember as if there where a id code in pics registers but probably i'm mistaking it with something else or I'm really making things up myself XD . Thanks for waking me up from my dream world TT! _________________ There is nothing you can't do if you try |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19537
|
|
Posted: Thu Nov 08, 2018 1:55 pm |
|
|
No, there is a product ID (which gives the chip type, and silicon revision), and a programmable set of ID bytes, which can be set when the chip is programmed. You can (for example), tell CCS programmers, to add a serial number into these, that changes each time a new chip is programmed. |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1635 Location: Perth, Australia
|
Re: Do PICs have an usable unique ID? |
Posted: Thu Nov 08, 2018 2:56 pm |
|
|
elcrcp wrote: | Hi guys, That question just popped in my mind. PICs do have some unique product ID as I remember (or maybe my memory is blurry) but can we get them as a constant or char array? |
If the PIC has an embedded Ethernet controller then you can use the MAC address. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9241 Location: Greensville,Ontario
|
|
Posted: Thu Nov 08, 2018 5:27 pm |
|
|
You could add a DS device like a temperature sensor, they have unique IDs.
Another posiibility is to program one in when you're 'ready for production'.
In an ultra high secure data system I used 30 years ago ,'remotes' were all programmed when installed, their addresses stored in RAM. If (when) power failed, they lost their 'ID' and rendered useless.
Jay |
|
|
-Terppa-
Joined: 08 Jan 2018 Posts: 59 Location: Finland
|
|
Posted: Fri Nov 09, 2018 4:56 am |
|
|
Ttelmah wrote: | No, there is a product ID (which gives the chip type, and silicon revision), and a programmable set of ID bytes, which can be set when the chip is programmed. You can (for example), tell CCS programmers, to add a serial number into these, that changes each time a new chip is programmed. |
Interesting. How i can tell that? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19537
|
|
Posted: Fri Nov 09, 2018 5:11 am |
|
|
If you just want a serial number, consider using #SERIALISE.
Have a constant variable:
const int32 serial=0;
Then add the line to the code:
#SERIALISE (ID=serial, listfile="number.txt")
Add a text file kept in your programmer directory (called "number.txt"), containing a list of serial numbers. One number per line. These will then be automatically used each time you program the chip.
In your code, you can just load 'serial'.
Last edited by Ttelmah on Sat Nov 10, 2018 3:18 am; edited 1 time in total |
|
|
-Terppa-
Joined: 08 Jan 2018 Posts: 59 Location: Finland
|
|
Posted: Fri Nov 09, 2018 6:03 am |
|
|
Thank you very much that tip! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19537
|
|
Posted: Sat Nov 10, 2018 3:17 am |
|
|
Just spotted I have left the leading inverted comma out from the filename. Have amended this. |
|
|
|