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

[复制链接]
 楼主| spark周 发表于 2021-8-8 22:58 | 显示全部楼层 |阅读模式
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
  
如果是把数组定义在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个有什么差别?
 楼主| spark周 发表于 2021-8-8 23:02 | 显示全部楼层
renyaq 发表于 2021-8-8 23:04 | 显示全部楼层

还有什么现象?能再详细描述下吗?
 楼主| spark周 发表于 2021-8-8 23:06 | 显示全部楼层
还有一个问题是,我用串口接收到一组数据,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]确是个空格。
wyjie 发表于 2021-8-8 23:07 | 显示全部楼层
LiveWatch不可以看局部变量,只可在Locals窗口里看。
wangzsa 发表于 2021-8-8 23:09 | 显示全部楼层
这个窗口是干嘛用的啊
juventus9554 发表于 2021-8-8 23:12 | 显示全部楼层
这个是实时显示的窗口?
pengf 发表于 2021-8-8 23:14 | 显示全部楼层
没关注过这个界面啊
 楼主| spark周 发表于 2021-8-8 23:16 | 显示全部楼层

其实还是不大明白,我再琢磨琢磨吧,多谢了哈先
呐咯密密 发表于 2021-8-9 09:59 | 显示全部楼层
看看5楼的兄弟,说的是对的
磨砂 发表于 2021-9-8 09:40 | 显示全部楼层
不可以看局部变量
八层楼 发表于 2021-9-8 10:25 | 显示全部楼层
如何掉出这个窗口呀
观海 发表于 2021-9-8 10:30 | 显示全部楼层
这两个窗口有什么区别呢
您需要登录后才可以回帖 登录 | 注册

本版积分规则

821

主题

10121

帖子

4

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