void UARTPutChar(unsigned int cTX)
{
UCA0TXBUF=cTX;
while (!(IFG2&UCA0TXIFG)); //waiting UCA0TXBUF is empty
IFG2&=~UCA0TXIFG; //clear TX interrupt flag
}
void UARTPutstring(char *str)
{
do
{
UARTPutChar(*str);
}
while(*++str!=' ');
UARTPutChar('
');
Description Resource Path Location Type
#169 argument of type "int" is incompatible with parameter of type "const char *" main.c /TEST1 line 57 C/C++ Problem
#include "msp430g2553.h"
#include <stdio.h>
void UARTPutstring( );
void UARTPutChar();
void UART_init();
int a=10;
char *s;
void UARTPutChar(unsigned int cTX)
{
UCA0TXBUF=cTX;
while (!(IFG2&UCA0TXIFG)); //waiting UCA0TXBUF is empty
IFG2&=~UCA0TXIFG; //clear TX interrupt flag
}
void UARTPutstring(char *str)
{
do
{
UARTPutChar(*str);
}
while(*++str!=' ');
UARTPutChar(' ');
}
void UART_init(void)
{
P1SEL |=BIT1+BIT2; //设置为外围模块第二功能P1.1,2 = USART0 TXD/RXD
P1SEL2|= BIT1 + BIT2 ; // P1.1 = RXD, P1.2=TXD
P1DIR |= BIT2; //P1.2 UART_TX
P1DIR &=~BIT1; //P1.2 UART_RX //串口发送数据端口为输出,接收数据端口为输入
UCA0CTL1|=UCSWRST; //USART第0位被置位0后,开始设置配置UART
UCA0CTL0 &=~UC7BIT; //设置数据位为8位
UCA0CTL1 |=UCSSEL_2; //选择波特率寄存器时钟信号,smCLK
UCA0BR0=109;
UCA0BR1=0;
UCA0MCTL = UCBRS1; //32k时钟下波特率为9600
UCA0CTL1&=~UCSWRST;
IE2 |= UCA0TXIE;
}
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // 关闭看门狗
UART_init();
sprintf(s,a);
UARTPutstring(s);
}
这样
Description Resource Path Location Type
#169 argument of type "int" is incompatible with parameter of type "const char *" main.c /TEST1 line 57 C/C++ Problem
一周热门 更多>