cc430串口接收中断问题

2019-08-01 16:22发布

#include "cc430x613x.h"
#include "stdint.h"

uint8_t data[4]={0x00};

void main(void){
  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT

  PMAPPWD = 0x02D52;                        // Get write-access to port mapping regs  
  P2MAP6 = PM_UCA0RXD;                      // Map UCA0RXD output to P2.6
  P2MAP7 = PM_UCA0TXD;                      // Map UCA0TXD output to P2.7
  PMAPPWD = 0;                              // Lock port mapping registers

  P1DIR |= BIT6;                            // Set P2.7 as TX output
  P1SEL |= BIT5 + BIT6;                     // Select P2.6 & P2.7 to UART function

  UCA0CTL1 |= UCSWRST;                      // **Put state machine in reset**
  UCA0CTL1 |= UCSSEL_1;                     // CLK = ACLK
  UCA0BR0 = 0x03;                           // 32kHz/9600=3.41 (see User's Guide)
  UCA0BR1 = 0x00;                           //
  UCA0MCTL = UCBRS_3+UCBRF_0;               // Modulation UCBRSx=3, UCBRFx=0
  UCA0CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**
  UCA0IE |= UCRXIE;                         // Enable USCI_A0 RX interrupt

  __bis_SR_register(LPM3_bits + GIE);       // Enter LPM3, interrupts enabled
  __no_operation();                         // For debugger


    __no_operation();
}

// Echo back RXed character, confirm TX buffer is ready first
#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
{
  switch(__even_in_range(UCA0IV,4))
  {
  case 0:break;                             // Vector 0 - no interrupt
  case 2:                                   // Vector 2 - RXIFG
  //  while (!(UCA0IFG&UCTXIFG));             // USCI_A0 TX buffer ready?

     data[0]= UCA0RXBUF;                  // TX -> RXed character
      UCA0IE= 0x00;     
    break;
  case 4:break;                             // Vector 4 - TXIFG
  default: break;  
  }
    __bic_SR_register(LPM3_bits);       // Enter LPM3, interrupts enabled
}

我使用这段程序可以顺利进入中断,在串口调试助手发过来数也能进入数组,但是似乎无法跳出中断执行到断点处,如图
无法执行到断点处 无法执行到断点处
求大虾指点我程序中的问题
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
8条回答
yufanjoy
2019-08-02 12:48
dirtwillfly 发表于 2013-11-25 19:10
恭喜,能者自答。

版主你好:

最近刚学CC430,发现这款芯片和stm32一样有管脚映射功能,看英文文档看的头脑有点模糊了,按照自己的理解,好像cc430的port mapping可以将一根io口任意的映射为其他的功能,不知道我这样理解对不对啊?

一周热门 更多>