• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

EEPROM storage of Single variable

Status
Not open for further replies.

Roger Harrold

New Member
I'm using a Single (floating point) value as a calibration constant.
Does anyone know how to store the 4-byte value in EEPROM and
how to read it back?
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
It worked

Using the pointer like so..
Code:
Dim eep As Byte  'eeprom address
Dim data As Byte
Dim floater As Single @ 0x30
Dim addr As Word  'ram address
addr  = 0x30
floater = 123.456
main:
   For eep = 0 To 3
     data = Pointer(addr)
     Write eep, data
     addr =addr + 1
   Next eep
   floater = 0
   addr = 0x30
   For eep = 0 To 3
     Read eep, data
     Pointer(addr) = data
     addr = addr + 1
   Next eep     
     
Goto main  'go again
You have to declare the single in ram specifically so you can set the address..
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top