请问MSP430f5529怎么将SPI口采集到的数据通过USB传到电脑上呢?可否给出相关代码及操作说明?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
#include "msp430f5529.h"
void main(void)
{
volatile unsigned int i;
volatile unsigned int j;
WDTCTL = WDTPW + WDTHOLD;
P4SEL |= BIT4 + BIT5;
UCA1CTL1 |=UCSWRST;
UCA1CTL1 |=UCSSEL_2;
UCA1BR0 = 9;
UCA1BR1 = 0;
UCA1MCTL |= UCBRS_1 +UCBRF_0;
UCA1CTL1 &= ~UCSWRST;
UCA1IE |= UCRXIE;
j=0;
while(1)
{
while(!(UCA1IFG&UCTXIFG));
UCA1TXBUF = j;
j++;
if(j>16) j=0;
}
_bis_SR_register(LPM0_bits + GIE);
}
#pragma vector=USCI_A1_VECTOR
__interrupt void USCI_A1_ISR(void)
{
switch(__even_in_range(UCA1IV,4))
{
case 0:break;
case 2:
while(!(UCA1IFG&UCTXIFG));
UCA1TXBUF = UCA1RXBUF;
break;
case 4:
break;
default:break;
}
}
这个是我参考例程改的,但是在串口助手上收到的数据却没有按照赋值j的顺序接收到数据呢?