Fanis,
Did you solve the problem?
FYI, the "3" here is a constant, and is going to cause problems, since the 24LC256 needs a WORD addr.Code:I2CRead memSDA,memSCL,$A1,3,[text]
try:
Code:addr VAR WORD:addr=3 I2CRead memSDA,memSCL,$A1,addr,[text]
Fanis,
Did you solve the problem?
FYI, the "3" here is a constant, and is going to cause problems, since the 24LC256 needs a WORD addr.Code:I2CRead memSDA,memSCL,$A1,3,[text]
try:
Code:addr VAR WORD:addr=3 I2CRead memSDA,memSCL,$A1,addr,[text]
Hi Steve and thank you for your interest,
I did what you suggested and it works, however it's still not working when "addr" is in a For-next loop.
I get the same results, maybe I'm missing something in front of my eyes.
What i mean is that if i use the code in my first message (for addr = 0 to 5, where addr var word) I jump eeprom positions.
It drives me crazy, so I'll not spend more time on this, I have modified my code and will go that way with some more lines of code.
However, if anyone ever finds why this is happening, I would like to know
Thank you all for your answers and interest.
Fanis
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: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
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!"Code:0123456789ABCDEF $0000-000F: HELLO!__KM17WS__
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 youit'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 ?
The above is not working or maybe STR is only used at "read" commands ?Code:Addr=0 I2cwrite memsda,memscl, $a0, addr, [str text\5]
This works for me instead :
A big thanksCode:I2cwrite, memsda, memscl, $a0, addr, [text[0], text[1],......, text[4]]
Fanis
There must be pause 5ms after writing before next operation.
Bookmarks