关于TI DAC芯片 DAC101C081 地址选择
2016-11-21 15:01
295 查看
这个芯片资料非常简单,单纯看pdf文档很难选择出正确的地址。
在官方技术讨论区正好看到有这个地址的询问,特此记录下。
Question for connecting DAC101C081 with MSP430F5172
I recently met a problem. I tried to connect the DAC101C081 (6 pins, I2C) as slave mode with MSP430 (master mode).
I connected ADR0 of DAC to GND and Va to 5V. However, when I tried to transmit the data from MSP to DAC,
even if I set the slave address as 0x0Dh as datasheet, I could not receive the ACK from DAC. Could anyone provide the suggestion?
Hello,
The address when communicating with the DAC101C081 the address byte consists of 7 bits for the address and 1 bit for read or write.
With ADR0 grounded the address is 000 1101.
To write to the part you need to add a 0 to the end and so you send 0001 1010 (0x1A) for the address byte. See Figure 26 in the datasheet.
To read from the part you need to add a 1 to the end and so you send 0001 1011 (0x1B) for the address byte. See Figure 27 in the datasheet.
i2c驱动我也分享下,参考24c04类似代码
在官方技术讨论区正好看到有这个地址的询问,特此记录下。
Question for connecting DAC101C081 with MSP430F5172
I recently met a problem. I tried to connect the DAC101C081 (6 pins, I2C) as slave mode with MSP430 (master mode).
I connected ADR0 of DAC to GND and Va to 5V. However, when I tried to transmit the data from MSP to DAC,
even if I set the slave address as 0x0Dh as datasheet, I could not receive the ACK from DAC. Could anyone provide the suggestion?
Hello,
The address when communicating with the DAC101C081 the address byte consists of 7 bits for the address and 1 bit for read or write.
With ADR0 grounded the address is 000 1101.
To write to the part you need to add a 0 to the end and so you send 0001 1010 (0x1A) for the address byte. See Figure 26 in the datasheet.
To read from the part you need to add a 1 to the end and so you send 0001 1011 (0x1B) for the address byte. See Figure 27 in the datasheet.
i2c驱动我也分享下,参考24c04类似代码
//#define ADDR_IIC 0x0d #define ADDR_IIC 0x0c /* enum ENUM_TWI_REPLY { TWI_NACK=0 ,TWI_ACK=1 }; */ enum ENUM_TWI_BUS_STATE { TWI_READY=0 ,TWI_BUS_BUSY=1 ,TWI_BUS_ERROR=2 }; static void delay_nop(uint8_t time) { uint8_t i; for(i=0; i<time; i++) { __nop(); __nop(); } } static void TWI_delay(void) { uint8_t i=5; //i=10延时1.5us//这里可以优化速度 ,经测试最低到5还能写入 while(i--); } void DAC081_Set(void) { } uint8_t TWI_Start(void) { SDAH; SCLH; TWI_delay(); if(!SDAread)return TWI_BUS_BUSY; //SDA线为低电平则总线忙,退出 SDAL; TWI_delay(); if(SDAread) return TWI_BUS_ERROR; //SDA线为高电平则总线出错,退出 SCLL; TWI_delay(); return TWI_READY; } void TWI_Stop(void) { SDAL; SCLL; TWI_delay(); SCLH; TWI_delay(); SDAH; TWI_delay(); } void TWI_Ack(void) { SCLL; TWI_delay(); SDAL; TWI_delay(); SCLH; TWI_delay(); SCLL; TWI_delay(); } void TWI_NoAck(void) { SCLL; TWI_delay(); SDAH; TWI_delay(); SCLH; TWI_delay(); SCLL; TWI_delay(); } uint8_t TWI_WaitAck(void) //返回为:=1有ACK,=0无ACK { SCLL; TWI_delay(); //SDAH; GPIO_PinModeSet(gpioPortE, 13, gpioModeInput, 0); //TWI_delay(); SCLH; TWI_delay(); if(SDAread) { SCLL; return 0; } SCLL; GPIO_PinModeSet(gpioPortE, 13, gpioModePushPull, 1); return 1; } void TWI_SendByte(uint8_t SendByte) //数据从高位到低位// { uint8_t i; for(i=0; i<8; i++) { SCLL; TWI_delay(); if(SendByte&0x80) SDAH; else SDAL; SendByte<<=1; //TWI_delay(); SCLH; TWI_delay(); } SCLL; } uint8_t DAC081_WriteByte(uint8_t upper) { uint8_t i; TWI_Start(); TWI_SendByte( (ADDR_IIC<<1) & 0xFE);//写器件地址 写入:地址最低位是0,读取:地址最低位是1 //TWI_SendByte( 0x1A); if(!TWI_WaitAck()) { TWI_Stop(); return 0; } TWI_SendByte((upper>>4)&0x0F); TWI_WaitAck(); TWI_SendByte(upper<<4); TWI_WaitAck(); TWI_Stop(); return 0; }
相关文章推荐
- 关于NFC芯片选择的一些记录
- 关于智能家居、360wifi、wifi开关,以及wifi芯片的选择
- 关于NFC芯片选择的一些记录
- 关于使用FreeMarker如何做到在浏览器弹框选择地址?
- 关于DNS转发时地址选择算法的问题
- 留个记念,第一次写这么长的存储过程。关于台湾地址excel中数据从一张表中导入另一张不同结构的表!
- 三级联动地址选择器,遇到的问题记录
- 关于从客户端获取IP地址和网卡地址的方法
- PHP关于VC11,VC9,VC6以及Thread Safe和Non Thread Safe版本选择的问题
- 关于.net版本的选择
- 关于选择Delphi2006的几点理由
- 关于Chrome CheckBox第二次选择无效
- 关于如何计算子网掩码和广播地址的问题的一个例子
- 一个关于按地址传递和按值传递区别的代码,给新手
- 关于职业方向的选择以及需要学习的课程
- 关于特征选择的几种算法
- 关于“Exchange Server 地址列表服务未能响应”的错误解决方法。
- 关于Python IDE选择的一点个人见解
- 电源芯片的选择
- .NET 关于取当前地址的问题