writing to onboard eeprom from outside main program

Status
Not open for further replies.

ghostman11

Well-Known Member
hi chaps,
i am aware of how to read and write to the pic onboard eeprom. but is there a way to write say a serial number or dataset to an eeprom at the time of flashing the chip with the program? if so how is this done?
 
With pickit2 you can (with the stand alone program) write any value to the eeprom... With MPLAB ide I use the MCH scripts to pre-load the eeprom values... What program do you use?
 
Last edited:
The original question is a bit vague, but you can simply preset the EEPROM values in your source code.
 
The following is a section of source code to preset the onboard EEPROM for a 16F876, should work for most.
;################ Initialize PIC EEPROM Data Memory################
ORG H'2100' ; INIT EEPROM Data
DE LOW D'600' ; Setpoint Init value of 20DegC (K Units) EEADDRESS 0x00
DE HIGH D'600' ; EEADDRESS 0x01
DE LOW D'600' ; Alarm Init value of 20DegC (K Units) EEADDRESS 0x02
DE HIGH D'600' ; EEADDRESS 0x03
 
hi
sorry for the vagueness i couldnt think how to word it without making a hash of it.
i use PK2 software and mplab, i wanted to avoide writing it in the source code. i didnt know you could just write to eeprom from PK2 standalone software so i will have a play with that. all i am after is a unique serial number and a address wich is also unique
 
i did also come up with a over complicated fancy way of doing it. but isnt realy needed and is overcomplicated. i had thought i know get another pic that keeps all the unique codes then when i add another program that chips eeprom via usart with a code checked against those already used etc etc. then i sat down had a cup of tea and thought ...........NAHHHHHHHHhhhhhh keep it simple
 
Either or both MPLAB and PK2 allow you to choose which memory types you want to write.

If you want to do serial numbers just edit the EEPROM in the IDE prior to flashing.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…