请问MSP430f5529怎么将SPI口采集到的数据通过USB传到电脑上呢?可否给出相关代码及操作说明?
Maka Luo:
回复 灰小子:
同意楼上的回答,MSPWARE中分别有USB和SPI例程,需要理解后整合。
dirtwillfly
官方提供有spi和usb的例程,你可以参考http://dev.ti.com/tirex/#/Package/MSPWare?link=MSPWare%2FDevices%2FMSP430F5XX_6XX%2FMSP430F5529%2FPeripheral%20Examples
cong luo:
回复 灰小子:
#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的顺序接收到数据呢?