PreviousNext
eeReadData
Help > OS functions > MCU EEPROM > eeReadData

Function

 

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

Purpose

 

Block access to EEPROM

Syntax

 

bit eeReadData(uns8 address, uns8 length)

Parameters

 

     address: address in EEPROM  (0 to 0xBF - length + 1). See IQRF OS User’s guide, EEPROM map.

     length: number of bytes to be read (1 to 64)

Return value

 

     0: only non-zero bytes have been read

     1: at least one zero byte has been read

Output values

 

     bufferINFO[0 to length – 1]

     bufferINFO[0 to length – 1] is cleared when attempted to read from address 0xC0 or higher

Preconditions

 

The destination address in bufferINFO can be shifted by memoryOffsetTo.

memoryOffsetTo is default disabled (cleared after reset as well as after every eeReadData).

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

 

  –

See also

 

eeReadByte, eeWriteByte, eeWriteData

Example 1

 

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

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

                        //                 ...

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

Example 2

 

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

eeReadData(0xC8, 16);   // EEPROM address 0xA0 used instead of protected area

                        //    bufferINFO[0] = EEPROM[0xA0]

                        //                 ...

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

Example 3

 

memoryOffsetTo = 20;

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

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

                        //                 ...

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

   // memoryOffsetTo is automatically cleared here