|
如果单独一个USCI使用则不会,现在我配置两个完全一样的USCI_A模块.
相同配置,只在最后一个USCI启用中断
但是SMCLK在SPI第四个时候后就..启动了/
#include
void InitHC_A(){
P1SEL |= BIT2 | BIT3 | BIT6;
UCA0CTLW0 |= UCSWRST;
UCA0CTLW0 |= UCMST | UCSYNC | UCCKPL | UCMSB;
UCA0CTLW0 |= UCSSEL_1;
UCA0MCTLW = 0;
UCA0CTLW0 &= ~UCSWRST;
//UCA0IE = UCTXIE;
UCA0IE = 0x00;
}
void InitHC_B(){
P2SEL |= BIT4;
P1SEL |= BIT4 | BIT5;
UCA1CTLW0 |= UCSWRST;
UCA1CTLW0 |= UCMST | UCSYNC | UCCKPL | UCMSB;
UCA1CTLW0 |= UCSSEL_1;
UCA1MCTLW = 0;
UCA1CTLW0 &= ~UCSWRST;
UCA1IE = UCTXIE;
}
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // 关闭看门狗
PJDIR |= BIT3 | BIT0;
PJSEL |= BIT3 | BIT0;
InitHC_A();
InitHC_B();
while(1){
P4DIR |= BIT0 | BIT1;
P4OUT |= BIT0 | BIT1;
UCA0TXBUF = 0xAA;
UCA1TXBUF = 0x55;
_bis_SR_register(LPM3_bits + GIE);
P4OUT &= ~(BIT0 | BIT1);
P4OUT |= BIT0 | BIT1;
P4DIR &= ~(BIT0 | BIT1);
}
}
#pragma vector=USCI_A1_VECTOR
__interrupt void USCI_A1_ISR(void)
{
switch (__even_in_range(UCA1IV, 4))
{
case USCI_NONE: break; // No interrupt
case USCI_SPI_UCRXIFG:break; // RXIFG
case USCI_SPI_UCTXIFG: break; // TXIFG
default: break;
}
_bic_SR_register_on_exit(LPM3_bits + GIE);
}
|
|