PreviousNext
eeWriteData
Help > OS functions > MCU EEPROM > eeWriteData

Function

 

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

Purpose

 

Block access to EEPROM

Syntax

 

void eeWriteData(uns8 address, uns8 length)

Parameters

 

•     address: address in EEPROM. See IQRF OS User’s guide, EEPROM map.

•     (0x80 to 0xBF - length + 1)  for Coordinator

•     (0 to 0xBF - length + 1)  for other devices

•     length: number of bytes to be written from bufferINFO: (1 to 64)

Return value

 

  –

Output values

 

  –

Preconditions

 

The initial address in bufferINFO can be shifted by memoryOffsetFrom.

memoryOffsetFrom is default disabled (cleared after reset as well as after every eeWriteData).

Remarks

 

•     Direct user access to EEPROM (using registers EECONx etc.) is not allowed for security reasons, specialized OS functions are intended for this.

•     EEPROM area dedicated to OS (locations 0xC0 or higher) is not accessible.

See Example E04-EEPROM.

Side effects

 

Any attempt to write to the protected area above 0xBF leads to no operation.

See also

 

eeReadByte, eeReadData, eeWriteByte

Example 1

 

eeWriteData(0x0A,16);     // copy 16 B from bufferINFO to EEPROM to address 0x0A

                           //   EEPROM[0x0A] = bufferINFO[0]

                           //               ...

                           //   EEPROM[0x19] = bufferINFO[15]

Example 2

 

   // Illegal access: Avoid access to EEPROM locations 0xC0 or higher

eeWriteData(0xC8,16);     // Attempt to write to protected area – nothing is                              // written.

Example 3

 

memoryOffsetFrom = 20;

eeWriteData(0x0A,16);     // copy 16 B from bufferINFO to EEPROM to address 0x0A

                           //   EEPROM[0x0A] = bufferINFO[20]

                           //               ...

                           //   EEPROM[0x19] = bufferINFO[35]

   // memoryOffsetFrom is automatically cleared here