I just discovered, that the I am actually receiving only 1 byte as expected. Rest are just "Start......"13,10 and "Done",13,10. Yesterday got too exhausted and missed this mistake of mine.
Here is the current code withEvery time Change line goes low (detected something), I try to read first 4 memory locations. The communication fails a lot of times (both write and read (write more than read) )in this attempt but I do get the data on the screen finally. Secondly, the data which comes is wrong. For example, memory locations 0 does not read 2E for a start.Code:Start: Loc=0 Start_Again: I2CWRITE SDA,SCL,$36,[LOC],Fail1 Main: Value=0 High Led : Pause 500: Low Led : PAUSE 500 I2CREAD SDA,SCL,$37,[VALUE] ,Fail2 PAUSE 250 DEBUG Value Loc=Loc+1 If Loc<4 then Start_Again ' Read first 4 locations x=0 WHILE !Change ' Stay here if Change Stays High Pause 500 : x=x+1 If x =10 then LOC=3 : Goto Main ' Do another read Endif WEND while Change : pause 100 : wend ' Stay here if change is Low Goto Start Fail1: ' Try Write again For x=0 to 50 High Portc.2 : Pause 50 : Low PortC.2 : Pause 50 Next x Goto Start_again Fail2: ' Try read again For x=0 to 5 High Portc.2 : Pause 250 : Low PortC.2 : Pause 250 Next x Goto Main




Bookmarks