我用官网的案例和串口调试助手试了试,我想在PC机向430发送一个数据,例如:ff,在单片机上把这个数据反映到IO口的LED灯上,理想状态是IO口的登全亮。但是失败了,IO口的灯只有两三个非常快的闪烁,亮度很低,不是一直亮的状态。不知道是这个程序不适应还是我串口助手用错了呢,求前辈指导一下
程序用的这个案例:
;-------------------------------------------------------------------------------
#include "msp430x16x.h"
;-------------------------------------------------------------------------------
org 06000h
RESET
mov #00300h,SP
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT
SetupP3 bis.b #030h,&P3SEL ; P3.4,5 = USART0 TXD/RXD
mov.b #0h,&P1SEL
mov.b #11111111b,&P1DIR
SetupUART0 bis.b #UTXE0+URXE0,&ME1 ; Enable USART0 TXD/RXD
bis.b #CHAR,&UCTL0 ; 8-bit characters
mov.b #SSEL0,&UTCTL0 ; UCLK = ACLK
mov.b #003h,&UBR00 ; 32k/9600 - 3.41
mov.b #000h,&UBR10 ;
mov.b #04Ah,&UMCTL0 ; Modulation
bic.b #SWRST,&UCTL0 ; **Initialize USART state machine**
bis.b #URXIE0,&IE1 ; Enable USART0 RX interrupt
mov.b #01010101b,&TXBUF0
;
Mainloop bis.b #LPM3+GIE,SR ; Enter LPM3, interrupts enabled
nop ; Required for debugger
;
;------------------------------------------------------------------------------
USART0RX_ISR; Echo back RXed character, confirm TX buffer is ready first
;------------------------------------------------------------------------------
TX1 bit.b #UTXIFG0,&IFG1 ; USART0 TX buffer ready?
jz TX1 ; Jump is TX buffer not ready
mov.b &RXBUF0,&P1OUT ; TX -> RXed character
reti ;
;
;------------------------------------------------------------------------------
; Interrupt Vectors
;------------------------------------------------------------------------------
ORG 0FFFEh ;
DW RESET ; POR, ext. Reset, Watchdog
ORG 0FFF6h ;
DW USART0RX_ISR ; USART0 receive
END
-------------------------------------------------------------------