[mw_shl_code=c,true] 我想用 xx 01 xx xx 和 xx 02 xx xx 来控制LED的闪烁,但程序下载进去没有反映 请大神赐教[/mw_shl_code]
[mw_shl_code=c,true]int main(void)
{
u8 t;
u8 len;
u8 a;
u16 times=0;
u16 Num=0;
SystemInit();
delay_init(72);
NVIC_Configuration
uart_init(9600);
LED_Init();
while(1)
{
if(USART_RX_STA&0x80)
{
len=USART_RX_STA&0x3f;
printf("\n您发送的消息为:\n");
for(t=0;t<len;t++)
{
USART1->DR=USART_RX_BUF[t];
USART_RX_BUF[1] = a;
if(a == 0x01)
{
LED1 = 0;
USART_RX_BUF[1] = 0x00;
delay_ms(2);
}
if(a == 0x02)
{
LED1 = 1;
USART_RX_BUF[1] = 0x00;
delay_ms(2);
}
while((USART1->SR&0X40)==0);
}
printf("\n\n");
USART_RX_STA=0;
}else
{
times++;
if(times%5000==0)
{
printf("\nMiniSTM32\n");
printf("ALIENTEK\n\n\n");
}
if(times%200==0)printf("请输入数据\n");
if(times%30==0)LED0=!LED0;
delay_ms(2);
}
}
}
[/mw_shl_code]
|