Hello, I manage to write bytes on a targeted chip on i2c bus from an ez-usb fx. But I did not manage to read the chip using the ez-usb fx. The targeted chip functions well with my rs232->i2c board.(writing and reading bytes). Does anyone have manage to do it before? If so, I would be very pleased to know how. Thanks a lot. Thierry
//lecture i2C I2CS |= bmSTART; I2DAT = 0x11; while ((I2CS & bmDONE)==0) { } if ( ((I2CS & bmBERR)==1) || ((I2CS & bmACK)==0)) { I2CS |= bmSTOP; goto sortie_ep1; } rien = I2DAT; for (i=0; i < 0x03 ; i++) { while ((I2CS & bmDONE)==0) { } if ((I2CS & bmBERR)==1) { //break; I2CS |= bmSTOP; goto sortie_ep1; } IN1BUF[i] = I2DAT; IN1BC = i + 1; } while ((I2CS & bmDONE)==0) { } if ((I2CS & bmBERR)==1) { I2CS |= bmSTOP; goto sortie_ep1; } I2CS |= bmLASTRD; I2CS |= bmSTOP; rien = I2DAT; } else { IN1BUF[0] = 0x30; IN1BC = 0x01; } goto sortie_ep1; } sortie_ep1: // Arm the OUT so it can receive the next packet OUT1BC = 0; // clear the IRQ EZUSB_IRQ_CLEAR(); OUT07IRQ = bmEP1; }
Hello, no need to help me now , I managed to do it thanks to "Programming a 24lc00 eeprom using the ez-usb i2c port." a cypress application note. Best regards Thierry Orlandi