[STM8] iar仿真时livewatch提示错误

[复制链接]
2188|5
 楼主| 负熵 发表于 2019-8-23 15:52 | 显示全部楼层 |阅读模式
lcd1602里面写了一个按键切换显示子程序如下
void display(char screens)
{
  u8 bluetooth_date_str0[16],bluetooth_date_str1[16];
  if (screens==1)
  {
   if (bluetooth_date[0]=='1')
    {
      memcpy(bluetooth_date_str0, bluetooth_date + 1, 16);
      memcpy(bluetooth_date_str1, bluetooth_date + 17, 32);   
    }
    LCD1602_Show_Str(0, 0, bluetooth_date_str0);
    LCD1602_Show_Str(0, 1, bluetooth_date_str1);  
  }

  else if(screens==2)   
  {
   
  }
  
  else if (screens==3)  
  {
   
  }
  else if (screens==4)  
  {
   
  }
  else if (screens==5)
  {
   
  }
我把bluetooth_date_str0[16],bluetooth_date_str1[16]写在display(char screens),编译没提示有错误,但仿真的时候livewatch提示cannot take address xxx
无标题.png
如果是把数组定义在display(char screens)外就没问题
u8 bluetooth_date_str0[16],bluetooth_date_str1[16];
void display(char screens)
{
  
  if (screens==1)
  {
   if (bluetooth_date[0]=='1')
    {
      memcpy(bluetooth_date_str0, bluetooth_date + 1, 16);
      memcpy(bluetooth_date_str1, bluetooth_date + 17, 32);   
    }
这2个有什么差别?


 楼主| 负熵 发表于 2019-8-23 16:10 | 显示全部楼层
还有一个问题是,我用串口接收到一组数据,bluetooth_date[32]格式为:n+16位要显示的内容+16位要显示的内容,n表示第几屏要显示的内容。
然后我想把上下两行的内容存到bluetooth_date_str0[17],bluetooth_date_str1[17]内,我用的memcpy函数
memcpy(bluetooth_date_str0, bluetooth_date + 1, 16);
memcpy(bluetooth_date_str1, bluetooth_date + 17, 32);  
按理来说,bluetooth_date_str0[17],bluetooth_date_str1[17]应该都是空字符'\0'才对,但是bluetooth_date_str1[17]确是个空格。
zhu^zhu 发表于 2019-8-23 17:09 | 显示全部楼层
LiveWatch不可以看局部变量,只可在Locals窗口里看。
磨砂 发表于 2019-9-20 10:42 | 显示全部楼层
这个窗口是干嘛用的啊
晓伍 发表于 2019-9-20 10:49 | 显示全部楼层
这个是实时显示的窗口?
八层楼 发表于 2019-9-20 11:03 | 显示全部楼层
没关注过这个界面啊
您需要登录后才可以回帖 登录 | 注册

本版积分规则

32

主题

80

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部