初级会员

- 积分
- 59
- 金钱
- 59
- 注册时间
- 2014-10-10
- 在线时间
- 0 小时
|
5金钱
我想完成识别接收汉字的程序,大家帮我看看
void
USART1_IRQHandler(void)
{
uint8_t ch,ch1[]="亮";
uint8_t ch2[]="灭";
if(USART_GetITStatus(USART1,
USART_IT_RXNE) != RESET)
{
//ch = USART1->DR;
ch=USART_ReceiveData(USART1);
if(strcmp(ch,ch1)==0)
//编译器提示这里有错误
{
LED1(ON);
LED2(ON);
LED3(ON);
}
else if(strcmp(ch,ch2)==0) //编译器提示这里有错误
{
LED1(OFF);
LED2(OFF);
LED3(OFF);
}
else
printf("\nerror\n");
}
}..\..\User\stm32f10x_it.c(157):
error: #167: argument of type "uint8_t" is incompatible with parameter of type
"const char *" |
最佳答案
查看完整内容[请看2#楼]
1,汉字是双字节的内码。
2,USART_ReceiveData一次只能接受1个字节。
所以,你的代码无法实现你的想法。
|