|
哪位高手大俠指導指導啊 從ads1258讀過來的數據跑亂,不正常,是不是設置錯了。用DRDY做外部中斷觸發寫的程序如下: 初始化void ads1258_init(void)
{
cs = 1;
cs = 0;
spi_send_byte(0xc0); //reset command
START = 0;
spi_send_byte(0x70); //write registers/MUL=1¡£
spi_send_byte(0x06); //wait for 4096fclk then SPI reset/chopping = 1 /enable status
spi_send_byte(0x33); //standby mode/delay us/data rate
spi_send_byte(0x00);
spi_send_byte(0x00); spi_send_byte(0x5a); //single input 1.3.4.6
spi_send_byte(0x55); //single input 8.10.12.14
spi_send_byte(0x00);
spi_send_byte(0xff);
spi_send_byte(0x00);
spi_send_byte(0x8b);
START = 1;
} DRDY低電平觸發中斷到接收數據服務程序void int1_isr(void) interrupt 2
{
unsigned char status;
spi_send_byte(0x30); //register form
status = spi_send_byte(0xee) ; XBYTE[write_pointer++] = spi_send_byte(0xee); XBYTE[write_pointer++] = spi_send_byte(0xee); XBYTE[write_pointer++] = spi_send_byte(0xee);
} 程序運行起來后,通道數據和狀態字節會混淆跑亂 |
|