用AD7792测四线制铂电阻,但是测出来的值一直为0,有没有哪位大佬帮忙看看哪里有问题,谢谢
Reset
time=32;
CLK_H;
CS_L;
MOSI_H;
while(ResetTime--) //超过连续32个周期为高电平即复位
{
CLK_L;
delay_us(200);
CLK_H;
delay_us(200);
}
delay_us(500);
AD7792WriteByte(WriteConfReg); //configuration register
AD7792WriteByte(0x12);//单极性,增益Gain 4
AD7792WriteByte(0x90);//internal Reference,带缓冲
while(1)
{
AD7792WriteByte(WriteIOReg);//IO register
AD7792WriteByte(0x03);
AD7792WriteByte(WriteModeReg);//Mode Register
AD7792WriteByte(0x20);//单次转换
AD7792WriteByte(0x0A);//inter 64 kHZ clock.internal clock is not available at the clk pin.
AD7792WriteByte(ReadStateReg);//write to Communication register.The next step is to read from Status register.
status = AD7792Read(8);
while((status&0x80) == 0x80) //wait for the end of convertion by polling the status register RDY bit
{
AD7792WriteByte(ReadStateReg);//write to Communication register.The next step is to read from Status register.
status = AD7792Read(8);
UARTprintf("status:%xn", status);
}
AD7792WriteByte(ReadDataReg); //write to Communication register.The next step is to read from Data register.
AD7792_Data = AD7792Read(16);
UARTprintf("V:%dn", AD7792_Data);