Eeprom e pic

444 palavras 2 páginas
EEPROM Library (mC PRO for PIC) - Support Center

Página 1 de 2

EEPROM Library (mC PRO for PIC)
Article

EEPROM Library
EEPROM data memory is available with a number of PIC MCUs. mikroC PRO for PIC includes library for comfortable work with EEPROM.

Library Routines
 EEPROM_Read  EEPROM_Write

EEPROM_Read

Prototype

// for PIC16 unsigned short EEPROM_Read(unsigned short address); // for PIC18 unsigned short EEPROM_Read(unsigned int address);

Returns Description

Returns byte from specified address. Reads data from specified address. Parameter address is MCU dependent; for PIC16 family it is of short type, and for PIC18 family it is of integer type.

Requires

Requires EEPROM module. Ensure minimum 20ms delay between successive use of routines EEPROM_Write and EEPROM_Read. Although PIC will write the correct value, EEPROM_Read might return an undefined result.

Example

unsigned short take; ... take = EEPROM_Read(0x3F);

EEPROM_Write

Prototype

// for PIC16 void EEPROM_Write(unsigned short address, unsigned short data); // for PIC18 void EEPROM_Write(unsigned int address, unsigned short data);

Returns Description

Nothing. Writes data to specified address. Parameter address is MCU dependent; for PIC16 family it is of short type, and for PIC18 family it is of integer type. Be aware that all interrupts will be disabled during execution of EEPROM_Write routine (GIE bit of INTCON register will be cleared). Routine will restore previous state of this bit on exit.

Requires

Requires EEPROM module. Ensure minimum 20ms delay between successive use of routines EEPROM_Write and EEPROM_Read. Although PIC will write the correct value, EEPROM_Read might return an undefined result.

Example

EEPROM_Write(0x32, 19);

Library Example
The example demonstrates use of EEPROM Library. char ii; void main(){ ANSEL = 0; ANSELH = 0; PORTB = 0; PORTC = 0; PORTD = 0; TRISB = 0; TRISC = 0; TRISD = 0; // loop variable // Configure AN

Relacionados

  • Microcontroladores
    820 palavras | 4 páginas
  • Unidade central de processamento..
    6839 palavras | 28 páginas
  • Atps sistemas integrados iditais - memórias
    1953 palavras | 8 páginas
  • Microcontroladores
    4377 palavras | 18 páginas
  • Trabalho
    1242 palavras | 5 páginas
  • PIC628
    1795 palavras | 8 páginas
  • Pic16f628a
    1092 palavras | 5 páginas
  • Sistema de aquisição sensorial
    2484 palavras | 10 páginas
  • PIC 16F84A
    10173 palavras | 41 páginas
  • Micro
    1354 palavras | 6 páginas