参考的网上TM1628例程 但是好像有点问题
void TT1628_Send_command(unsigned cmd){ unsigned char i; IIC_STB_HIGH(); delay_us(15); IIC_STB_LOW(); for (i = 0; i < 8; i++) { IIC_SCL_LOW(); if (cmd & 0x01) { IIC_SDA_HIGH(); } else { IIC_SDA_LOW(); }
cmd >>= 1; IIC_SCL_HIGH(); } IIC_STB_HIGH();}
void TT1628_Send_command_union_data(unsigned char addr,unsigned char data){ unsigned char m,i; IIC_STB_HIGH(); delay_us(15); IIC_STB_LOW(); for (i = 0; i < 8; i++) { IIC_SCL_LOW(); if (addr & 0x01) { IIC_SDA_HIGH(); } else { IIC_SDA_LOW(); }
addr >>= 1; IIC_SCL_HIGH(); }
for (m = 0; m < 8; m++) { IIC_SCL_LOW(); if (data & 0x01) { IIC_SDA_HIGH(); } else { IIC_SDA_LOW(); }
data >>= 1; IIC_SCL_HIGH(); } delay_us(15); IIC_STB_HIGH();}
void TT1628_Send_command(unsigned cmd){ unsigned char i; IIC_STB_HIGH(); delay_us(15); IIC_STB_LOW(); for (i = 0; i < 8; i++) { IIC_SCL_LOW(); if (cmd & 0x01) { IIC_SDA_HIGH(); } else { IIC_SDA_LOW(); }
cmd >>= 1; IIC_SCL_HIGH(); } IIC_STB_HIGH();}
void TT1628_Send_command_union_data(unsigned char addr,unsigned char data){ unsigned char m,i; IIC_STB_HIGH(); delay_us(15); IIC_STB_LOW(); for (i = 0; i < 8; i++) { IIC_SCL_LOW(); if (addr & 0x01) { IIC_SDA_HIGH(); } else { IIC_SDA_LOW(); }
addr >>= 1; IIC_SCL_HIGH(); }
for (m = 0; m < 8; m++) { IIC_SCL_LOW(); if (data & 0x01) { IIC_SDA_HIGH(); } else { IIC_SDA_LOW(); }
data >>= 1; IIC_SCL_HIGH(); } delay_us(15); IIC_STB_HIGH();}