CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Do PICs have an usable unique ID?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
elcrcp



Joined: 11 Mar 2016
Posts: 62
Location: izmir / Turkey

View user's profile Send private message

Do PICs have an usable unique ID?
PostPosted: Thu Nov 08, 2018 12:38 pm     Reply with quote

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: 19215

View user's profile Send private message

PostPosted: Thu Nov 08, 2018 1:46 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Nov 08, 2018 1:52 pm     Reply with quote

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! Very Happy
_________________
There is nothing you can't do if you try
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Thu Nov 08, 2018 1:55 pm     Reply with quote

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: 1630
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

Re: Do PICs have an usable unique ID?
PostPosted: Thu Nov 08, 2018 2:56 pm     Reply with quote

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: 9093
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Nov 08, 2018 5:27 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Nov 09, 2018 4:56 am     Reply with quote

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: 19215

View user's profile Send private message

PostPosted: Fri Nov 09, 2018 5:11 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Nov 09, 2018 6:03 am     Reply with quote

Thank you very much that tip!
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Sat Nov 10, 2018 3:17 am     Reply with quote

Just spotted I have left the leading inverted comma out from the filename. Have amended this.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
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


Powered by phpBB © 2001, 2005 phpBB Group