各位好。
现在我用msp430f5529lp与ads1299通信。下面是energia的程序
测试读取结果 0011 1110 与手册中的说明符合
Bits[7:5] Not used
Bit 4 Must be set to '1'
Bits[3:0] Factory-programmed device identification bits
1110 = ADS1299
然后我用CCS写5529的程序
#include <msp430.h>
char a=0;
int main(void)
{
volatile unsigned int i;
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
P3SEL |= BIT3+BIT4; // P3.3,4 option select
P2SEL |= BIT7; // P2.7 option select
UCA0CTL1 |= UCSWRST; // **Put state machine in reset**
UCA0CTL0 |= UCMST+UCSYNC+UCCKPH+UCMSB; // 3-pin, 8-bit SPI master
//, MSB
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 2; // /2
UCA0BR1 = 0; //
UCA0MCTL = 0; // No modulation
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
UCA0IE |= UCRXIE; // Enable USCI_A0 RX interrupt
//P1OUT &= ~0x02; // Now with SPI signals initialized,
//P1OUT |= 0x02; // reset slave
for(i=50;i>0;i--); // Wait for slave to initialize
P2OUT &=~BIT3; //CS LOW
while (!(UCA0IFG&UCTXIFG));//SDATAC
UCA0TXBUF=0X11;
P2OUT |= BIT3; //CS HIGH
__delay_cycles(4);//4CLK
while(1)
{
P2OUT &=~BIT3; //CS LOW
while (!(UCA0IFG&UCTXIFG));
UCA0TXBUF=0X20;
while (!(UCA0IFG&UCTXIFG));
UCA0TXBUF=0X00;
while (!(UCA0IFG&UCTXIFG));
UCA0TXBUF=0X00;
while (!(UCA0IFG&UCRXIFG));
a=UCA0RXBUF;
P2OUT |= BIT3; //CS HIGH
__delay_cycles(300000);
}
}
然后读取,结果都是0;请指教