[ZLG-ARM] ads1110的问题

[复制链接]
2357|1
 楼主| liulicau 发表于 2007-10-17 13:39 | 显示全部楼层 |阅读模式
&nbsp;&nbsp;&nbsp;ISendByte(0x94,0x8c);<br />&nbsp;&nbsp;&nbsp;&nbsp;DelayNS(10);<br />&nbsp;&nbsp;&nbsp;&nbsp;I2C_ReadNByte(0x94,1,0x00,data_buf1,0x02);<br />&nbsp;&nbsp;&nbsp;&nbsp;DelayNS(10);<br />&nbsp;&nbsp;&nbsp;&nbsp;adc_value1=data_buf1[0]&lt&lt8||data_buf1[1];<br />&nbsp;&nbsp;&nbsp;&nbsp;if(data_buf1[1]||0x80==1)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;adc_value1=~adc_value1+1;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;adc_value1=(adc_value1*2.048)/(32767*1);<br />&nbsp;&nbsp;&nbsp;&nbsp;DelayNS(10);<br />大家帮我看看程序这样写有什么问题吗?
 楼主| liulicau 发表于 2007-10-17 16:19 | 显示全部楼层

lpc2138中I2C器件ads1110的读写

ISendByte(0x94,0x8c);<br />DelayNS(10);<br />I2C_ReadNByte(0x94,ONE_BYTE_SUBA,0x00,data_buf1,0x03);<br />DelayNS(10);<br />ISendByte(0x96,0x8c);<br />DelayNS(10);<br />I2C_ReadNByte(0x96,ONE_BYTE_SUBA,0x00,data_buf2,0x03);<br />DelayNS(10);<br />ISendByte(0x98,0x8c);<br />DelayNS(10);<br />I2C_ReadNByte(0x98,ONE_BYTE_SUBA,0x00,data_buf3,0x03);<br />DelayNS(10);<br />ISendByte(0x9a,0x8c);<br />DelayNS(10);<br />I2C_ReadNByte(0x9a,ONE_BYTE_SUBA,0x00,data_buf4,0x03);<br />if(UART0_GetByte()==0x55)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;UART0_SendByte(data_buf1[2]);<br />&nbsp;&nbsp;&nbsp;&nbsp;DelayNS(10);<br />&nbsp;&nbsp;&nbsp;&nbsp;UART0_SendByte(data_buf2[2]);<br />&nbsp;&nbsp;&nbsp;&nbsp;DelayNS(10);<br />&nbsp;&nbsp;&nbsp;&nbsp;UART0_SendByte(data_buf3[2]);<br />&nbsp;&nbsp;&nbsp;&nbsp;DelayNS(10);<br />&nbsp;&nbsp;&nbsp;&nbsp;UART0_SendByte(data_buf4[2]);<br />&nbsp;&nbsp;&nbsp;&nbsp;DelayNS(10);<br />}<br />本来读回的值应该是写进去的控制字0x8c,为什么显示的是两个FF呢?&nbsp;<br />&nbsp;<br />
您需要登录后才可以回帖 登录 | 注册

本版积分规则

14

主题

28

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部