Better in nibble setting. I can see '2E' repeated a few times.
Better in nibble setting. I can see '2E' repeated a few times.
My bad, change the Read statement:
Code:I2CREAD SDA,SCL,ADDR,[VALUE] ',Fail
Louie
Still getting the same with the following code:
Code:Value Var BYTE Addr Var byte Loc Var Byte '--------------------------------------------------------- Pause 500 DEBUG "Start......",13,10 Value=0 Loc=0 Main: High Led : Pause 500: Low Led : PAUSE 500 Addr=$36 I2CWRITE SDA,SCL,ADDR,[LOC],Fail1 Addr=$37 : pause 10 ' Sometimes it is failing, leaving pause 10 makes it better. I2CREAD SDA,SCL,ADDR,[VALUE] ,Fail2 PAUSE 25 DEBUG Value,13,10 PAUSE 250 DEBUG "Done....",13,10 WHILE 1 : WEND Goto Main Fail1: while 1: toggle portc.2 : pause 50 : wend goto main Fail2: WHILE 1 High Portc.2 : Pause 250 : Low PortC.2 : Pause 250 WEND
What if you assign the Read/Write addresses before hand?
Question: Where is the "1" monitored at in these statements? Never seen it done this way before.Code:Value Var BYTE Addr Var byte Loc Var Byte '--------------------------------------------------------- Pause 500 DEBUG "Start......",13,10 Value=0 Loc=0 WR_Add CON $36 RD_Add CON $37 Main: High Led : Pause 500: Low Led : PAUSE 500 'Addr=$36 I2CWRITE SDA,SCL,WR_Add,[LOC],Fail1 'Addr=$37 : pause 10 ' Sometimes it is failing, leaving pause 10 makes it better. I2CREAD SDA,SCL,RD_Add,[VALUE] ,Fail2 PAUSE 25 DEBUG Value,13,10 PAUSE 250 DEBUG "Done....",13,10 WHILE 1 : WEND Goto Main Fail1: while 1: toggle portc.2 : pause 50 : wend goto main Fail2: WHILE 1 High Portc.2 : Pause 250 : Low PortC.2 : Pause 250 WEND
Code:WHILE 1: WEND
Louie
The manual says do not use constants for address.
Though I tried the above but the result is the same.
While 1 : Wend - I just put this just like that to halt the code.
Oh yeah, no Constants.
Then give it to him straight!
Have you tried clearing the LOC and Value variables at the beginning of each loop just in case? Start with a clean slate every time.
You're so close, I can smell it!Code:Main: Loc=0 Value=0 High Led : Pause 500: Low Led : PAUSE 500 I2CWRITE SDA,SCL,$36,[LOC],Fail1 I2CREAD SDA,SCL,$37,[VALUE] ,Fail2 PAUSE 25 DEBUG Value,13,10 PAUSE 250 DEBUG "Done....",13,10 WHILE 1 : WEND Goto Main Fail1: while 1: toggle portc.2 : pause 50 : wend goto main Fail2: WHILE 1 High Portc.2 : Pause 250 : Low PortC.2 : Pause 250 WEND
Or was that someone in the room?
Last edited by LinkMTech; - 27th July 2013 at 22:52.
Louie
Did the above, no luck.
Doesn't like it straight, giving it $37/$36 direct sends it to Fail1 routine. So write statement fails.
Funny thing is that when it goes to Fail1, though there should be no output of data, IT does output some of the data. This looks like half the data compared to when cycle runs normally.
The code only run once and then I reset the PIC to run it again, so though it won't make any effect resetting the values in the main loop, I still tried with no luck. I am losing hairs on my head because of this now.
Bookmarks