I2C in C language qith QY4A

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

I2C in C language qith QY4A

2,697 次查看
admin
Specialist II

Hi!

 

     Could anyone send me an example how to communicate QY4A with EEprom (24LC00) using I2C and C language?

 

Thanks a lot

 

 

Edson

标签 (1)
0 项奖励
回复
3 回复数

801 次查看
bigmac
Specialist III

Hello Edson,

 

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.

 

Regards,

Mac

0 项奖励
回复

801 次查看
eckhard
Contributor V

Hello.

 

 

here is an example that I used with an I2C port expander.

 

Eckhard 

0 项奖励
回复

801 次查看
J2MEJediMaster
Specialist I

The topic of using the I2C surfaces from time to time here. Try doing a search of these forums using the string "I2C programming".

 

---Tom

0 项奖励
回复