9.2.7 EEPROM_WRITE Macro

A macro that writes data to the EEPROM memory space.

Include

<xc.h>

Prototype

void EEPROM_WRITE(scalar address, scalar value);

Arguments

address
The EEPROM address to program
value
The value to program

Remarks

This macro is available for all Mid-range devices that implement EEPROM. It is recommended that for PIC18 devices you use MPLAB MCC to generate EEPROM access code, if possible.

This function tests and waits for any concurrent writes to EEPROM to conclude before performing the required operation. It writes value to address in the EEPROM.

Example

#include <xc.h>

int main (void)
{
  unsigned char data = 0x55;
  unsigned char addr = 0x20;

  EEPROM_WRITE(addr, data);
}