Hi: I am using the (CY7C68013-128AC) uController from Cypress. I am trying to write a simple data to EEProm(24LC64 from Microchip). I am using Cypress's library functions, EZUSB_WriteI2C(byte addr, byte lenght, byte xdata *buf) and EZUSB_WaitForEEPromWrite(byte addr). This is a 'ezusbsys.h' library created by Cypress Semiconductors. Here is my code
BYTE xdata myBuf[] = {0xFF,0xFF,0xFF,0xFF) TD_Poll() { BOOL bWriteOk = FALSE; I2C_ADDR = 0x51; //im using the 24LC64(Large) EEProm on the development board to write data. EZUSB_InitI2C(); while(!bWriteOk){ bWriteOk = EZUSB_WriteI2C(I2C_ADDR, 0x09, &(myBuf[0])); } EZUSB_WaitForEEPROMWrite(I2C_ADDR);
You have not said that anything is wrong with the code, so I'll just say that it lacks proper indentation.
"Do you know wat could be wrong with this code?" As Dan says, you haven't actually described any problem with it at all! Does it not compile? Does it not download? Does it not do what you expected? - in this case, you need to describe what you expected (it could be just your misconception), and what actually happens. You should also describe what steps you have taken so far to debug it yourself.
Thanks guys, I solved the problem. The problem was that i wasn't sending the right i2c protocol to the EEProm.