Hi all,
i'm receiving through a max232 a string (ex. XYTest Com1).
With Serin2 I'm waiting for a string and if it has XY I save the following
9 characters into a string (long).
I save 'long' into a 24c64 eeprom with i2cwrite then i check with i2cread and
Serout2 if long has been saved. After that I increase ADD by 9 and I jump
to start waiting for the next available string.
The first 3 strings are saved fine:
Address 0000 Test Com
Address 0009 1Test Co
Address 0010 m1Test C
Address 0018 om1
Now when the fourth string is coming at address 27 (1B) the first 5
characters are correctly saved into 27-28-29-30-31 (1B-1C-1D-1E-1F)
and the last 4 are saved into address 0-1-2-3 instead of 32-33-34-35
(20-21-22-23)
Address 0000 Com1 Com
Address 0009 1Test Co
Address 0010 m1Test C
Address 0018 om1Test

I got lost, I do not understand why !!
Thanks for your help.

Here is the prg:

DEFINE OSC 4

SDA VAR PORTA.0
SCL VAR PORTA.1
ADD VAR WORD
EEP CON $A0
OUT VAR BYTE[9]
long VAR BYTE[9]

BAUD VAR BYTE
RX VAR PORTA.3
TX VAR PORTA.2

BAUD = 84 ' 9600,8,N,1

ADD=0
Pause 1000

Start:

SerIn2 RX, BAUD, [wait("XY"),STR long\9]
Pause 2000
I2CWrite SDA,SCL,EEP,ADD,[STR long\9]
Pause 10

Pause 2000

I2CRead SDA,SCL,EEP,ADD,[STR OUT\9]
Pause 10
SerOut2 TX, BAUD, [#ADD," ", STR OUT\9,13,10]

ADD=ADD+9

GoTo START

End