Maybe it is an ATMEL / PIC conflict
I2C read/write takes care of that.Could it be something to do with the device needing a dummy write before it can start reading?
What PIC and what pins is this thing connected to. ADC pin maybe??
Maybe it is an ATMEL / PIC conflict
I2C read/write takes care of that.Could it be something to do with the device needing a dummy write before it can start reading?
What PIC and what pins is this thing connected to. ADC pin maybe??
Dave
Always wear safety glasses while programming.
8mhz int osc 16F886 pic (pin 14 Clock & 15 Data used)
I can read and write to the eeprom it's just the first byte which is being corrupted?
Interesting...
Maybe it is the sensor?but for the first sensor the first byte is always $10 the rest of the 8 bytes for that sensor is fine?
Have you tried a simple test read/write? Maybe something like this to see if it is the ROM?
http://www.picbasic.co.uk/forum/cont...-EEPROM-Part-1
Dave
Always wear safety glasses while programming.
It's not the I2C sensors i have tried several. If i scan them as sensor 2 then the code is stored correctly, if i scan them as sensor one the first byte is corrupted when stored I tried moving the eeprom to store starting at a different location other than address 0 this still returns a corrupt first byte but works otherwise. very odd.
Further testing reveals the codes are being stored correctly in the eeprom and can be read back and displayed with this code.
This writes the codes correctly to the eeprom
Code:VarA = 0 I2CWRITE Scdeeprom,Sckeeprom,AT24C512B,VarA,[STR I2C1\8,STR I2C2\8] 'Load data into I2c eeprom
This check works even after powering on/off so the data is in the eeprom ok and can be read back.
However trying to put the codes back into the array variables with this code.Code:For VarA = 0 to 15 'Load I2C1 data from eeprom I2CREAD Scdeeprom,Sckeeprom,AT24C512B,VarA,[VarB1] 'Read data from I2c eeprom DEBUG HEX2 VarB1 Next VarA
Appears to work correctly but the first byte of I2C1 array is always corrupted? Could someone try and replicate the fault please.Code:VarA = 0 I2CREAD Scdeeprom,Sckeeprom,AT24C512B,VarA,[STR I2C1\8,STR I2C2\8] 'Read data from I2c eeprom
Last edited by retepsnikrep; - 13th July 2010 at 14:18.
Even when i manually fill the first byte of the array I2C(0) it is corrupted when next read strange.
Bookmarks