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

write/read program eeprom inquiry?

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



Joined: 29 Dec 2003
Posts: 81

View user's profile Send private message

write/read program eeprom inquiry?
PostPosted: Fri Apr 09, 2004 12:14 am     Reply with quote

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?
PostPosted: Fri Apr 09, 2004 3:57 am     Reply with quote

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?
PostPosted: Fri Apr 09, 2004 5:52 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Apr 09, 2004 8:03 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Apr 09, 2004 6:15 pm     Reply with quote

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: 1912
Location: Norman, OK

View user's profile Send private message

PostPosted: Fri Apr 09, 2004 7:03 pm     Reply with quote

My manual doesn't say that last part about 8 bits. What manual are you reading from?
chingB



Joined: 29 Dec 2003
Posts: 81

View user's profile Send private message

PostPosted: Fri Apr 09, 2004 10:34 pm     Reply with quote

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