|
|
View previous topic :: View next topic |
Author |
Message |
rrb011270
Joined: 07 Sep 2003 Posts: 51
|
Help on this... |
Posted: Tue Sep 09, 2003 6:24 pm |
|
|
Mabuhay!
How can I input a hex to an eeprom? do i have to use the get_hex() function?
please provide me a sample code snippet.
thanx |
|
|
Charlie U Guest
|
|
Posted: Tue Sep 09, 2003 9:36 pm |
|
|
:?:
Can you give us a clue as to what type of EEPROM you are interested in??
There are several types: first is internal EEPROM on your chip (which chip are you using?!?!), next is external EEPROM, and again what type; I2C serial or SPI serial? |
|
|
Guest
|
|
Posted: Tue Sep 09, 2003 11:40 pm |
|
|
Charlie U wrote: | :?:
Can you give us a clue as to what type of EEPROM you are interested in??
There are several types: first is internal EEPROM on your chip (which chip are you using?!?!), next is external EEPROM, and again what type; I2C serial or SPI serial? |
EEPROM type is 24LC256 or FM24C256
target chip: PIC18452
protocol: I2C
Thanx |
|
|
ttelmah Guest
|
Re: Help on this... |
Posted: Wed Sep 10, 2003 8:08 am |
|
|
rrb011270 wrote: | Mabuhay!
How can I input a hex to an eeprom? do i have to use the get_hex() function?
please provide me a sample code snippet.
thanx |
I think you need to get clear in your mind, what you actually want to do.
'Hex', is a way of representing numerical values, using conventional 'text' characters.
So, the number decimal '77', can be represented by the hex code '4D', but if stored into a single byte, displays as the ASCII character 'M'., and is held internally as the binary value '00101101'.
Now the EEPROM, stores numbers. If you have a value arriving in hex, and use the existing input functions to read this into a single byte, this byte can simply be stored to the EEPROM as a number (at this point, 'hex' doesn't come into it at all...). The code 'gethex', is a simple routine contained in one of the driver files, to convert an incoming ASCII 'hex' string, into it's numeric form. If you have a value arriving in text, and need to convert this to numeric, this is a good starting place, but has nothing to do with storing numbers in the EEPROM.
If you need to actually store an internal number, in hex, then the SPRINTF function, allows a value to be converted to the ASCII representation, and the resulting text string, could then be sent to the EEPROM, one character at a time.
Best Wishes |
|
|
|
|
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
|