关于ADS1248code
硬件连接是上图方式,希望能给个驱动代码,ADS1248,ADS1247的code都可以
可以看看这里:http://paapps.tucs.design.ti.com/doku.php?id=parts:ads:ads1247:evm:start
另外建议你根据datasheet的时序自己写一遍,然后看看能不能正常通信,这样对自己学习有很大帮助
底层通讯已经写好,就是有点难理解它的写寄存器的方式,另外这个网页好像无法访问
我给你附上了:6786.ads1247evm_fwsrc_1.0.8.zip
通讯是可以通讯了,但是电流却没有输出
Set_ADS1247_Chip_Enable();
Send_Data_SPI(0x40);
Send_Data_SPI(0x0e);
Send_Data_SPI(0x2e);//MUX0 00101110
Send_Data_SPI(0);//VBIAS
Send_Data_SPI(0x05);//MUX1 00000101
Send_Data_SPI(0x0f);//SYS0 00001111
Send_Data_SPI(0);//OFC0
Send_Data_SPI(0);//OFC1
Send_Data_SPI(0);//OFC2
Send_Data_SPI(0);//FSC0
Send_Data_SPI(0);//FSC1
Send_Data_SPI(0);//FSC2
Send_Data_SPI(0x0f);//IDAC0 00001111
Send_Data_SPI(0x47);//IDAC1 0x47
Send_Data_SPI(0);//GPIOCFG 0
Send_Data_SPI(0xff);//GPIODIR ff
Send_Data_SPI(0);//GPIODAT 00
Clear_ADS1247_Chip_Enable();
Set_ADS1247_Chip_Enable();
Send_Data_SPI(0x20);
Send_Data_SPI(0x0e);
for(uint8_t i=0; i<15; i++)
{
tab[i]= Receive_Data_SPI();
}
Clear_ADS1247_Chip_Enable();
目前寄存器能读能写,但是读取数据,一直读出来为0,求解
Set_ADS1247_Chip_Enable(1);
Send_Data_SPI(0x04);
Send_Data_SPI(0x04);
Clear_ADS1247_Chip_Enable(1);
__delay_cycles(500);
Set_ADS1247_Chip_Enable(1);
while(DOUT1);
Send_Data_SPI(0x12);
bufferIN[0] = Receive_Data_SPI(1);
bufferIN[1] = Receive_Data_SPI(1);
bufferIN[2] = Receive_Data_SPI(1);