PreviousNext
eeeWriteData
Help > OS functions > Serial EEPROM > eeeWriteData

Function

 

Write a data block of a specified length from bufferINFO to a specified location in serial EEPROM

Purpose

 

Write to serial EEPROM

Syntax

 

bit eeeWriteData(uns16 address)

Parameters

 

address: initial address in serial EEPROM (0 to 0x3FFF)

Input values

 

     memoryLimit specifies the number of bytes (1 to 64) to be written. It must be set before every eeeWriteData call. If memoryLimit == 0, 64 B is written.

     To respect accessible range, the following rule must be observed:

address + memoryLimit <= 0x4000. See Example 3.

Warning: E.g., writing more than 1 B from address 0x3FFF (i.e. over boundary 0x3FFF-0x4000) overwrites memoryLimit-1 bytes from address 0x4000 in the read-only area. It may lead to corruption of the MIDs database at the Coordinator.

Return value

 

     1        Write successful

     0        Write unsuccessful  (e.g. due to damaged, not supplied, or not populated memory device). Additionally, the _eeeError flag is set. Subsequent clearing of this flag is up to the user.

Output values

 

Data in serial EEPROM changed.

Preconditions

 

The power supply of serial EEPROM must not be disconnected. See macros eEEPROM_TempSensorOn and  eEEPROM_TempSensorOff.

Remarks

 

memoryLimit is automatically cleared after every eeeWriteData call.

Side effects

 

  –

See also

 

eeeReadData

Example 1

 

       // Write 64 B from bufferINFO to serial EEPROM from address 0x40

       // When memoryLimit is kept cleared from previous operations

eeeWriteData(0x40);   // Serial EEPROM[0x40] = bufferINFO[0]

                      //             ...

                      // Serial EEPROM[0x7F] = bufferINFO[63]

Example 2

 

       // Write 16 B from bufferINFO to serial EEPROM from address 0x40

memoryLimit = 16;

eeeWriteData(0x40);   // Serial EEPROM[0x40] = bufferINFO[0]

                      //             ...

                      // Serial EEPROM[0x4F] = bufferINFO[15]

                      // memoryLimit is automatically cleared here

Example 3

 

eeeWriteData(0x4000); // Illegal access, attempt to write to area dedicated to OS

Example 4

 

memoryLimit = 1;      // To write 1 B

bufferINFO[0] = 'A'

if (!eeeWriteData(0x0A))

     ...              // Error handling