View previous topic :: View next topic |
Author |
Message |
dynamitron
Joined: 18 Mar 2009 Posts: 38
|
store a character in eeprom |
Posted: Mon Dec 20, 2010 10:45 am |
|
|
Could someone explain me why if I try to store a character in eeprom, I must use the following instruction:
Code: |
write_eeprom(816,78);
|
If I try this one, I am not getting the correct character when I read it back:
Code: |
write_eeprom(816,'n'); |
Thanks for the help,
D. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Mon Dec 20, 2010 10:59 am |
|
|
Remember that 78, is the character code for 'N', not 'n'. For 'n', you would get back 110.
Best Wishes |
|
|
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Mon Dec 20, 2010 11:03 am |
|
|
What are you getting back when you try to read it ? (as Ttelmah indicates, a lower case 'n' is 110 decimal (or 0x6E hex)).
mikey _________________ mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3 |
|
|
dynamitron
Joined: 18 Mar 2009 Posts: 38
|
|
Posted: Mon Dec 20, 2010 11:55 am |
|
|
For N, I get 'B'
I am just curious because otherwise using the ascii code, it works fine |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Dec 20, 2010 12:09 pm |
|
|
Post a simple test program that shows the problem. Example:
http://www.ccsinfo.com/forum/viewtopic.php?t=17590&start=1
It should be complete and compile without errors, similar to the
program shown in the link above.
Also post your compiler version.
Also, tell us if you have ever programmed that eeprom location with
a continuous loop for a long time, and possibly burned out the eeprom. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Mon Dec 20, 2010 2:12 pm |
|
|
Obvious question - What chip - how much EEPROM does it have?.
Best Wishes |
|
|
|