打印
[STM8]

iar仿真时livewatch提示错误

[复制链接]
1525|12
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
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]确是个空格。

使用特权

评论回复
5
wyjie| | 2021-8-8 23:07 | 只看该作者
LiveWatch不可以看局部变量,只可在Locals窗口里看。

使用特权

评论回复
6
wangzsa| | 2021-8-8 23:09 | 只看该作者
这个窗口是干嘛用的啊

使用特权

评论回复
7
juventus9554| | 2021-8-8 23:12 | 只看该作者
这个是实时显示的窗口?

使用特权

评论回复
8
pengf| | 2021-8-8 23:14 | 只看该作者
没关注过这个界面啊

使用特权

评论回复
9
spark周|  楼主 | 2021-8-8 23:16 | 只看该作者

其实还是不大明白,我再琢磨琢磨吧,多谢了哈先

使用特权

评论回复
10
呐咯密密| | 2021-8-9 09:59 | 只看该作者
看看5楼的兄弟,说的是对的

使用特权

评论回复
11
磨砂| | 2021-9-8 09:40 | 只看该作者
不可以看局部变量

使用特权

评论回复
12
八层楼| | 2021-9-8 10:25 | 只看该作者
如何掉出这个窗口呀

使用特权

评论回复
13
观海| | 2021-9-8 10:30 | 只看该作者
这两个窗口有什么区别呢

使用特权

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

本版积分规则

821

主题

10121

帖子

4

粉丝