Wrong read EEPROM address! (Solved)

General discussion on mikroBasic PRO for PIC.
Post Reply
Author
Message
arvinfx
Posts: 115
Joined: 22 Feb 2010 18:44

Wrong read EEPROM address! (Solved)

#1 Post by arvinfx » 03 Jul 2023 20:56

Hi, i am trying to read and write on EEPROM with EEPROM_Read command on PIC16F877A.
But it reads wrong address or something is wrong

code is this:

Code: Select all

Sub procedure Update_Events()                                                   
Dim read_buf as word
    HI(read_buf) = EEPROM_Read(0x0)                                          
    LO(read_buf) = EEPROM_Read(0x1)                                           
    EEPROM_Write(0x0,hi(read_buf))                                            
    EEPROM_Write(0x1,lo(read_buf))                                            


    hi(read_buf) = EEPROM_Read(0x2)                                       
    lo(read_buf) = EEPROM_Read(0x3)                                     
    EEPROM_Write(0x2,hi(read_buf))                                           
    EEPROM_Write(0x3,lo(read_buf))                                         
                                                   

End sub
First read and write is ok . but second act wrong.
If I save value on 0x1 to 0x4 like this:
01 02 03 04

result will be this:
01 02 02 02

Instead of this:
01 02 03 04

Why?
Last edited by arvinfx on 15 Jul 2023 14:15, edited 1 time in total.

Firewire
Posts: 166
Joined: 20 Jun 2009 17:12

Re: Wrong read EEPROM address!

#2 Post by Firewire » 05 Jul 2023 13:59

Hello
Take a break of 30ms between the write commands.

arvinfx
Posts: 115
Joined: 22 Feb 2010 18:44

Re: Wrong read EEPROM address!

#3 Post by arvinfx » 11 Jul 2023 14:53

Firewire wrote:
05 Jul 2023 13:59
Hello
Take a break of 30ms between the write commands.
It works . Thanks. :P

Post Reply

Return to “mikroBasic PRO for PIC General”