View previous topic :: View next topic |
Author |
Message |
chingB
Joined: 29 Dec 2003 Posts: 81
|
write/read program eeprom inquiry? |
Posted: Fri Apr 09, 2004 12:14 am |
|
|
Hi,
I want to clarify the use of write/read program eeprom CCS built-in function.
Suppose I have a 16bit data and I want to store it to an on-chip program memroy location say 0x7FF0. I understand it can store 1 word.
Question: after executing write_program_eeprom(0x7FF0,data); what would happen to the program counter? Does it point to location 0x7FF1 or 0x7FF2?
I want to use this function to store a DeviceID of my hardware --> similar to versioning system use by software developer. At runtime this will not change unless you update the firmware version.
Need your comments ?
Thank u. |
|
|
Ttelmah Guest
|
Re: write/read program eeprom inquiry? |
Posted: Fri Apr 09, 2004 3:57 am |
|
|
chingB wrote: | Hi,
I want to clarify the use of write/read program eeprom CCS built-in function.
Suppose I have a 16bit data and I want to store it to an on-chip program memroy location say 0x7FF0. I understand it can store 1 word.
Question: after executing write_program_eeprom(0x7FF0,data); what would happen to the program counter? Does it point to location 0x7FF1 or 0x7FF2?
I want to use this function to store a DeviceID of my hardware --> similar to versioning system use by software developer. At runtime this will not change unless you update the firmware version.
Need your comments ?
Thank u. |
The program counter remains pointing in your program. The 'write_program_eeprom' function, has no effect at all on the program counter (except for the number of instructions needed to execute it).
Best Wishes |
|
|
Guest
|
Re: write/read program eeprom inquiry? |
Posted: Fri Apr 09, 2004 5:52 am |
|
|
Ttelmah wrote: | chingB wrote: | Hi,
I want to clarify the use of write/read program eeprom CCS built-in function.
Suppose I have a 16bit data and I want to store it to an on-chip program memroy location say 0x7FF0. I understand it can store 1 word.
Question: after executing write_program_eeprom(0x7FF0,data); what would happen to the program counter? Does it point to location 0x7FF1 or 0x7FF2?
I want to use this function to store a DeviceID of my hardware --> similar to versioning system use by software developer. At runtime this will not change unless you update the firmware version.
Need your comments ?
Thank u. |
The program counter remains pointing in your program. The 'write_program_eeprom' function, has no effect at all on the program counter (except for the number of instructions needed to execute it).
Best Wishes |
What will happend after writing a 16bit data to 0x7FF0? Will it not overwritten the content of 0x7FF0 if I am to write another 16bit data to 0x7FF1?
thnx. |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Fri Apr 09, 2004 8:03 am |
|
|
Donīt worry about the risk of overlapping some data, at least you canīt handle the pointer, just use it and report here if something wrong.
WRITE_PROGRAM_EEPROM ( )
Syntax:
write_program_eeprom (address, data)
Parameters:
address is 16 bits on PCM parts and 32 bits on PCH parts,
data is 16 bits
Humberto |
|
|
chingB
Joined: 29 Dec 2003 Posts: 81
|
|
Posted: Fri Apr 09, 2004 6:15 pm |
|
|
Humberto wrote: | Donīt worry about the risk of overlapping some data, at least you canīt handle the pointer, just use it and report here if something wrong.
WRITE_PROGRAM_EEPROM ( )
Syntax:
write_program_eeprom (address, data)
Parameters:
address is 16 bits on PCM parts and 32 bits on PCH parts,
data is 16 bits
Humberto |
I conduct a test on write_program_eeprom using a PIC18F1320 and the procedure are:
1] I write a data 0xA0A0 to on-chip program memory at location 0x1FF0.
2] I just put a delay of 1sec.
3] I read the content of location 0x1FF0 using the read_program_eeprom.
4] I display it using the serial monitor for checking if got it right.
5] And I got the correct data.
I am just curious... from the manual it says:
ddress is 16 bits on PCM parts and 32 bits on PCH parts,
data is 16 bits on PCM parts and 8 bits on PCH parts.
Comments please.
Thnx |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
Posted: Fri Apr 09, 2004 7:03 pm |
|
|
My manual doesn't say that last part about 8 bits. What manual are you reading from? |
|
|
chingB
Joined: 29 Dec 2003 Posts: 81
|
|
Posted: Fri Apr 09, 2004 10:34 pm |
|
|
dyeatman wrote: | My manual doesn't say that last part about 8 bits. What manual are you reading from? |
I'm sorry I read the old CCS Manual... I got the version 3 of the CCS manual...
Thanx |
|
|
|