大家好,我用F149做异步串口传送程序,用U1传送口,传送一系列数组,希望大家帮我看一下程序是不是正确。
为什么我在IAR中加入了,UCOS不能生成文件呢?程序如下:
#include <msp430x14x.h>
#define ANUM 11
static char TAX[ANUM]={0x01,0xBB,0XB6,0XD3,0XAD,0XCA,0XB9,0XD3,0XC3,0XBF,0x04};
void main(void)
{
unsigned int i;
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P3SEL |=0xC0; // P3.6,7 = USART1 option select
P6DIR |=0X18; //p63,4 输出
P6OUT |=0X08; //选择P6,3输出1,P6,4输出0
BCSCTL1 &= ~XT2OFF; // XT2on
do
{
IFG1 &= ~OFIFG; // Clear OSCFault flag
for (i = 0xFF; i > 0; i--); // Time for flag to set
}
while ((IFG1 & OFIFG)); // OSCFault flag still set?
BCSCTL2 |= SELM_2 + SELS; // MCLK= SMCLK= XT2 (safe)
ME2 |= UTXE1; // Ena××e USART1 TXD/RXD
UCTL1 |= CHAR; // 8-bit character
UTCTL1 |= SSEL1; // UCLK = SMCLK
UBR01 = 0x82; // 8Mhz/4800
UBR11 = 0x06; //
UMCTL1 = 0x00; // no modulation
UCTL1 &= ~SWRST; // Initialize USART state machine
for(i=0;i<ANUM;i++)
{
while((IFG2 &UTXIFG1)==0); //usart1 tx buffer 准备好了吗?
}
_BIS_SR(LPM3_bits);
} |