EEPROM - Write 4 digit decimal number
danlo
Posts: 5
i want to write 4 digit decimal number into EEPRom, but the value of each eeprom cell can only store 0 - 255 value.
How to store 4 digit decimal number e.g 2005 into EEProm?... Would you give me some suggestions?
How to store 4 digit decimal number e.g 2005 into EEProm?... Would you give me some suggestions?
Comments
EEPROM's are generally byte oriented devices. Thus, to write anything, number or otherwise, if it takes more than one byte to contain it, you need to write the appropriate number of bytes one-at-a-time. A 4 digit number can be contained in a WORD (2 bytes) variable. Therefore you need to write two byter as shown below:
number VAR WORD
number = 2005
WRITE 0, number.highbyte···· 'Check exact syntax in the PBASIC manual
WRITE 1, number.lowbyte
Regards,
Bruce Bates
Post Edited (Bruce Bates) : 2/26/2007 12:15:47 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST