How to store value in eeprom

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
kumar123
Posts: 68
Joined: 17 Oct 2023 07:32

How to store value in eeprom

#1 Post by kumar123 » 29 Jan 2024 08:31

Hi,
I want to store value in eeprom. I have write code to store value in eeprom. It is giving wrong answer.
MCU I am using pic18f67k40.

Code: Select all

void main() {
    int d = 0;
    char txt[10],i;
    slrcond = 0;
    PORTA = 0;
    PORTB = 0;
    PORTC = 0;
    PORTD = 0;
    TRISA = 0;
    TRISB = 0;
    TRISC = 0;
    TRISD = 0;
    ANSELA = 0;
    ANSELB  = 0;
    ANSELD = 0;
    
    UART1_Init(9600);
    EEPROM_Write(0x00, 40);
    delay_ms(250);
    d = EEPROM_Read(0x00);
    IntToStr(d, txt);
    UART1_Write_Text(txt);
    

}
The result I am getting:
eeprom_write.png
eeprom_write.png (231.03 KiB) Viewed 182 times
Regards,
Kumar

User avatar
IvanJeremic
mikroElektronika team
Posts: 316
Joined: 05 Sep 2022 14:32

Re: How to store value in eeprom

#2 Post by IvanJeremic » 31 Jan 2024 13:20

Hi,

Try going through some of our EEPROM examples from the compiler:
eeprom.png
eeprom.png (21.16 KiB) Viewed 154 times
Regards,

Ivan.

kumar123
Posts: 68
Joined: 17 Oct 2023 07:32

Re: How to store value in eeprom

#3 Post by kumar123 » 01 Feb 2024 05:19

Hi,
The problem has been solved.
Thank you for your support.

Regards,
Kumar

Post Reply

Return to “mikroC PRO for PIC General”