电子音量的控制PT2314

时间:2011-10-06 10:36:27
【文件属性】:
文件名称:电子音量的控制PT2314
文件大小:1.73MB
文件格式:PDF
更新时间:2011-10-06 10:36:27
CS3703 本产品是一个具有音量控制的IC。 void I2C_start(void) { EA=0; PTDAT=1; PTSCL=1; SomeNOP(); PTDAT=0; SomeNOP(); PTSCL=0; } static void I2C_stop(void) { PTSCL=0; PTDAT=0; SomeNOP(); PTSCL=1; SomeNOP(); PTDAT=1; } static char I2C_ack(void) { unsigned int errtime=255;//因故障接收方无ACK,超时值为255。 PTDAT=1;SomeNOP(); PTSCL=1;SomeNOP(); while(PTDAT) { errtime--; if (!errtime) { I2C_stop(); return 0; } } PTSCL=0; return 1; } static char I2C_send_byte(unsigned char ch) { uchar i=8; while (i--) { PTSCL=0;_nop_(); _nop_();_nop_();_nop_();_nop_();_nop_(); if(ch&0x80) PTDAT=1; else PTDAT=0; ch<<=1; SomeNOP(); PTSCL=1; SomeNOP(); } PTSCL=0; return I2C_ack(); } char pt2314_send_data(unsigned char *dat, unsigned char n) { unsigned char i; I2C_start(); if (!I2C_send_byte(0x88)) { return 0; } for (i = 0; i < n; i++) { if (!I2C_send_byte(dat[i])) { return 0; } } I2C_stop(); return 1; } char Set_pt2314_Volume(unsigned char dat) { //unsigned char i; I2C_start(); if (!I2C_send_byte(0x88)) { return 0; } // for (i = 0; i < n; i++) // { if (!I2C_send_byte(dat)) { return 0; } // } I2C_stop(); return 1; } /

网友评论