polona1010
Member level 1
I use 18f45k22 with mikroc and i need to measure adc and store data in internal eeprom, can someone help me?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
/*--- Read eeprom ---*/
uint8_t read_eeprom(uint8_t address)
{
volatile uint8_t data;
EEADR = address;
EECON1bits.EEPGD = 0;
EECON1bits.CFGS = 0;
EECON1bits.RD = 1;
data = EEDATA;
return data;
}
/*--- Write eeprom ---*/
void write_eeprom(uint8_t address, uint8_t data)
{
EEADR = address;
EEDATA = data;
EECON1bits.EEPGD = 0;
EECON1bits.CFGS = 0;
EECON1bits.WREN = 1;
EECON2 = 0x55;
EECON2 = 0xaa;
EECON1bits.WR = 1;
while(EECON1bits.WR){
;
}
EECON1bits.WREN = 0;
}