User Tools

Site Tools




EEWrite address, data, byteLength

address 0 to 4095
data Data to write to EEPROM (up to Long type values)
byteLength Number of bytes to read (1 to 4)

Store data in the specified address in EEPROM. This is very useful for storing configuration or calibration data.

Dim A As Integer
Dim B As Integer
A = 100
EEWrite 0,A,2 ' Store A in Address 0.
Delay 5 ' Wait for writing.
B = EERead(0,2) ' Read from Address 0 and store in B.

For an example using Single data type, see Peek( ) and Poke.

When writing to the EEPROM, it takes about 3 to 5 milliseconds. When reading from the EEPROM, it takes less than 1 millisecond. There is a physical limit of around 100,000 writes to each location within the EEPROM.

If you are using the EEPROM for data acquisition or data that requires a lot of writes, we recommend using a module with battery-backup memory, such as the CB290 or CB405, instead. One alternative is an RS-232 Compact Flash (CF) or Secure Digital (SD) memory interface module.

The following table compares SRAM and EEPROM

Type Battery Backup SRAM EEPROM
Life of Data Depends on battery capacity 40 Years
Maximum Writes Essentially Infinite About 100,000
Writing Time Essentially 0ms 3 to 5 ms
General use Store often-used variable information over a power outage.
Example: Daily production counter.
Important data that needs to survive even a backup battery failure.
Example: Product serial number

Go CUBLOC home

cubloc/eewrite/index.txt · Last modified: 2017/07/17 10:31 by COMFILE Technology