Quote Originally Posted by SteveB View Post
Code:
addr var WORD

For addr = 0 TO 5                                        '  
I2CRead memSDA,memSCL,$A1,addr,[STR TEXT\6]     '$A0 does the same as $A1  
pause 10 
Next addr
Lets look at what this is doing. First, let's start with what's in the EEPROM. Starting at Address $00 (I put _ as placeholders for the value $FF):

Code:
            0123456789ABCDEF
$0000-000F: HELLO!__KM17WS__
The 1st time through the loop, addr = 0, the PIC sets the register address in the 24LC256 to $0000, then reads 6 bytes sequentially, and puts them into TEXT = "HELLO!"
The 2nd time through the loop, addr = 1, the PIC sets the register address in the 24LC256 to $0001, then reads 6 bytes sequentially, and puts them into TEXT = "ELLO!_"
The 3rd time through the loop, addr = 2, the PIC sets the register address in the 24LC256 to $0002, then reads 6 bytes sequentially, and puts them into TEXT = "LLO!__"
...
The 6th time through the loop, addr = 5, the PIC sets the register address in the 24LC256 to $0005, then reads 6 bytes sequentially, and puts them into TEXT = "!__KM1"

At least that's the way it should be working. I'm not sure why you got "M__KM1".

However, now hopefully you see why, when you changed the FOR...NEXT loop to count from 3 to 8, it gave you "KM17WS"

It's because on the last loop addr = 8, the register address set in the 24LC256 is $0008, then it reads 6 bytes sequentually, and you end up with TEXT = "KM17WS"

That help?
You make me feel stupid , but I forgive you it's always good to learn something new.
My mistake is clear about the use of the STR modifier, however can you help me with the I2cwrite command ?

Code:
Addr=0
I2cwrite memsda,memscl, $a0, addr, [str text\5]
The above is not working or maybe STR is only used at "read" commands ?
This works for me instead :

Code:
I2cwrite, memsda, memscl, $a0, addr, [text[0], text[1],......, text[4]]
A big thanks
Fanis