打印
[STM8]

iar仿真时livewatch提示错误

[复制链接]
1487|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

如果是把数组定义在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 | 只看该作者
这个窗口是干嘛用的啊

使用特权

评论回复
5
晓伍| | 2019-9-20 10:49 | 只看该作者
这个是实时显示的窗口?

使用特权

评论回复
6
八层楼| | 2019-9-20 11:03 | 只看该作者
没关注过这个界面啊

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

30

主题

78

帖子

0

粉丝