View previous topic :: View next topic |
Author |
Message |
memoally
Joined: 25 Jan 2010 Posts: 35
|
need help about eeprom! |
Posted: Mon Apr 19, 2010 12:06 pm |
|
|
hello everyone.
i have some questions.here they are;
1)how can i write a float value onto eeprom?for example i want to write ''3.17'' on eeprom.how can i manage this?
2)how can i write a value which is bigger than 255 onto eeprom?for example i want to write "426" on eeprom.how could do this?
3)finally,what is the placeholder for an "int16" variable?is it %d or %lu or something different?
waiting for your helps... _________________ compiler version: 4.105
pic: 16f876
clock frequency: 4MHz
Last edited by memoally on Mon Apr 19, 2010 12:12 pm; edited 1 time in total |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Apr 19, 2010 12:08 pm |
|
|
Can you give your posts a more descriptive name than "Help Please" ?
Put in the thread title the subject that you need help on. Thanks.
(You can edit your post to do this). |
|
|
memoally
Joined: 25 Jan 2010 Posts: 35
|
|
Posted: Mon Apr 19, 2010 12:23 pm |
|
|
better now? _________________ compiler version: 4.105
pic: 16f876
clock frequency: 4MHz |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Apr 19, 2010 12:32 pm |
|
|
Quote: | How can I write a float value onto eeprom? |
See this FAQ article:
http://www.ccsinfo.com/faq.php?page=write_eeprom_not_byte
Quote: | How can I write a value which is bigger than 255 onto eeprom? |
Look in these two CCS driver files. They have routines to read/write
various data types to/from eeprom. There are separate routines for
internal or external eeprom:
Quote: |
c:\program files\picc\drivers\internal_eeprom.c
c:\program files\picc\drivers\external_eeprom.c
|
Look for these routines:
Quote: |
write_int16_eeprom()
read_int16_eeprom()
write_int16_ext_eeprom()
read_int16_ext_eeprom()
|
Quote: | what is the placeholder for an "int16" variable? |
To display any integer larger than a byte, you use "%lu".
That's for unsigned integers. For signed integers, use "%ld". |
|
|
memoally
Joined: 25 Jan 2010 Posts: 35
|
|
Posted: Mon Apr 19, 2010 1:31 pm |
|
|
thank you,pcm programmer.your advices helped me.thank you again. _________________ compiler version: 4.105
pic: 16f876
clock frequency: 4MHz |
|
|
|