u8 bluetooth_date;
u8 bluetooth_date_str0[17],bluetooth_date_str1[17];
int main(void)
{
CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1);
USART_Configuration();//串口初始化
GPIO_Configuration();
LCD1602_Init();
LCD1602_ClearScreen();
while(1)
{
if (bluetooth_date[0]=='1')
{
memcpy(bluetooth_date_str0, bluetooth_date + 1, 16);
memcpy(bluetooth_date_str1, bluetooth_date + 17, 32);
bluetooth_date_str0[16]='\0';
bluetooth_date_str1[16]='\0';
}
LCD1602_Show_Str(0, 0, bluetooth_date_str0);
LCD1602_Show_Str(0, 1, bluetooth_date_str1);
}
然后发现有一个问题,如果只写memcpy(bluetooth_date_str0, bluetooth_date + 1, 16);程序能正常接收到数据并显示出来,但如果加上 memcpy(bluetooth_date_str1, bluetooth_date + 17, 32);程序就没办法接收到串口数据。
这个到底是哪里的问题。
|