官网上的例程,ExampleCode_RDC_AD2S1210中,下面函数
void ReadFromAD2S1210(unsigned char mode, unsigned char address, unsigned char * buf)
{
if (mode==CONFIG)
{
//write control register address
buf[0] = address;
SET_SCLK();
delay(1);
SET_CS();
delay(1);
CLR_CS();
delay(1);
SET_WR();
delay(1);
CLR_WR();
delay(1);
SPIWrite(1,buf);
SET_WR();
delay(1);
SET_CS();
//write control register address
//read 1-byte register
SET_SCLK();
SET_CS();
SET_WR();
delay(1);
CLR_CS();
delay(1);
CLR_SCLK();
delay(1);
CLR_WR();
delay(1);
SPIRead(1,buf);
SET_WR();
delay(1);
SET_CS();
//read 1-byte register
}
else if (mode==POSI
tiON||mode==VELOCITY)
{
SET_SPL();
delay(1);
CLR_SPL();
delay(5);
//read 3-byte register
SET_SCLK();
SET_CS();
SET_WR();
delay(1);
CLR_CS();
delay(1);
CLR_SCLK();
delay(1);
CLR_WR();
delay(1);
SPIRead(3,buf); //read data register
SET_WR();
delay(1);
SET_CS();
//read 3-byte register
}
}
两种模式下有个明显的区别,普通模式下增加了一段
SET_SPL();
delay(1);
CLR_SPL();
delay(5);
明显这段代码是对sample信号的控制,但是配置模式下读取位置信息却没有对sample信号控制。似乎和手册上的说法是不一致的,各位大神这怎么理解?