How Can I insert pic ID on code

Coding and general discussion relating to the compiler

Moderators: David Barker, Jerry Messina

Post Reply
ta1dr
Registered User
Registered User
Posts: 15
Joined: Tue Aug 18, 2009 8:14 am
Location: istanbul TURKEY

How Can I insert pic ID on code

Post by ta1dr » Tue Jun 05, 2012 5:10 am

Hello All
I want to write ID for pic id address on IDE (like a config or edata)
how can I do it?

thanks a lot
Ahmet

Jerry Messina
Swordfish Developer
Posts: 1473
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Post by Jerry Messina » Tue Jun 05, 2012 3:18 pm

Ahmet -

Sorry, but it's not clear to me what you want. Are you looking for code to read the chip IDLOC area?

User avatar
Senacharim
Posts: 139
Joined: Tue Aug 10, 2010 5:19 pm
Location: Ventura, CA

Re: How Can I insert pic ID on code

Post by Senacharim » Tue Jun 05, 2012 3:24 pm

ta1dr wrote:I want to write ID for pic id address on IDE (like a config or edata)
how can I do it?
That's a bit very vague. I'm willing to bet you've not been programming long--spend enough time programming and it becomes ingrained that imprecision and ambiguity are bad.

Now then, I'm guessing you're asking how to use the EEPROM.

Code: Select all

Include "EEPROM.bas"
//--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- 
// EEPROM Value                                'Address
EEPROM = (%11100110 As Byte)    'ConfigByte1,   '0
EEPROM = (%00110000 As Byte)    'ConfigByte2,   '1
EEPROM = (%00000000 As Byte)    'ConfigByte3,   '2
EEPROM = (65535 As Word)        'Number   '3 - 4
EEPROM = (52 As Byte)           'ID     '5

Const 
  ConfigByte1_EEPROM = 0
Dim
  ConfigByte1 as Byte

  ConfigByte1 = EE.ReadByte(ConfigByte1_EEPROM)

  EE.WriteByte(ConfigByte1_EEPROM, ConfigByte1)
There's a little do-nothing example code which should point you in the correct direction.

Good luck, happy coding.
Surviving Member
Bermuda Triangle Battalion
from 2026 to 1992

Voted "Most likely to time travel"--Class of 2024.

User avatar
Jason
Posts: 50
Joined: Mon Mar 10, 2008 1:10 pm
Location: Australia

Post by Jason » Tue Jun 05, 2012 4:04 pm

Isn't he talking about the chip ID word that you can program for the pic?
If I wanted to program that ID, I would do that separately in MPLAB rather than in the program code.

Like the config bits, e.g. Brown-out, code protect, ... I.D.

Actually, no I changed my mind. It would be way better to do it in the program code. I've never used the chip ID yet, but I can think of many uses for it. But then what ever ID it is that you want to burn to the chip, you could easily just put it in the EEPROM. Make it something cool like the last byte in the EEPROM memory or something.

ta1dr
Registered User
Registered User
Posts: 15
Joined: Tue Aug 18, 2009 8:14 am
Location: istanbul TURKEY

Post by ta1dr » Wed Jun 06, 2012 7:22 am

Jason wrote:Isn't he talking about the chip ID word that you can program for the pic?
If I wanted to program that ID, I would do that separately in MPLAB rather than in the program code.

Like the config bits, e.g. Brown-out, code protect, ... I.D.

Actually, no I changed my mind. It would be way better to do it in the program code. I've never used the chip ID yet, but I can think of many uses for it. But then what ever ID it is that you want to burn to the chip, you could easily just put it in the EEPROM. Make it something cool like the last byte in the EEPROM memory or something.
yes jason you correct thanks for suggestion, good idea eeprom

sorry jerry I cant explain correct but thanks for attention

thanks for attention senacharim

regards
Ahmet

bitfogav
Registered User
Registered User
Posts: 169
Joined: Sat Oct 09, 2010 1:39 pm
Location: United Kingdom

Post by bitfogav » Wed Jun 06, 2012 9:15 am

FYI, Yes you can do it in MPLAB Configure>ID Memory but that will only give you access to the lower nibble of the user ID, The high nibble can be only be written to via program code.

Thanks to Jerry he has put together a small userID Module which you can download in the USB Library.
SFUSBv142

Post Reply