Could anyone send me an example how to communicate QY4A with EEprom (24LC00) using I2C and C language?
Thanks a lot
The topic of using the I2C surfaces from time to time here. Try doing a search of these forums using the string "I2C programming".
The QY4A device does not contain an IIC hardware module, so your code will need to use "bit-banging" to obtain IIC communication with the serial EEPROM device.
A very old Application Note AN1820 does provide an assembly code example for IIC master communications with a DAC device, but for an old HC05 device (the code should be backward compatible with HC908).
AN2509 provides assembly code for the QT/QY device, but for an IIC slave, which is not what you require.
Since the C language is not particularly efficient at providing shift and rotate operations involving the carry flag, I would suspect that any C function would likely require some inline assembly code to handle the serial data stream.
Do you really require to use an IIC type serial EEPROM? If you were able to use a device with SPI interface (25Cxxx), the coding should be a little simpler. You might also consider the HC908QB8, which is pin compatible with the QY4, and contains a SPI hardware module.
Alternatively, you might choose a device that includes an IIC hardware module. The 9S08QG8 comes to mind.
here is an example that I used with an I2C port expander.
Retrieving data ...