当前位置:网站首页>零基础学习CANoe Panel(8)—— 数据/文本编辑控件(Hex/Text Editor )
零基础学习CANoe Panel(8)—— 数据/文本编辑控件(Hex/Text Editor )
2022-07-24 10:41:00 【蚂蚁小兵】
- 我是蚂蚁小兵,专注于车载诊断领域,尤其擅长于对CANoe工具的使用
- 寻找组织 ,答疑解惑,摸鱼聊天,博客源码,点击加入【相亲相爱一家人】
- 零基础学习CANoe Panel设计目录汇总,点击跳转
前言
- 相比
Input/Output Box,Hex/Text Editor可以用来显示更多的数据,主要用来显示byte/int数组类型,也可以用来显示string - 演示软硬件环境
Windows11 x64;CANoe 11 SP2 x64
目录

数据/文本编辑控件(Hex/Text Editor )
- Hex/Text Editor 控件支持的数据类型有string 和数组。


控件显示布局(Editor Layout )
symbol类型是Data(byte arrary)
1️⃣ 如果Editor 绑定的symbol类型是Data,则Editor Layout属性我们可以只选择only Hex Field
- 而且设置的时候,我们还应该根据我们每行想要显示的字节数来设置(
Columns/Letter per Line),比如标准CAN报文 我们可以设置为8,正好可以显示一整条报文 - 两个字节之间自动通过
空格间隔

2️⃣ 我们简单模拟下实时刷新某条报文
/*@!Encoding:936*/
variables
{
byte ByteData[16];
int i ;
msTimer timer_demo;
}
on key 'a'
{
setTimer(timer_demo,1000);
}
on timer timer_demo
{
for(i=0;i<elcount(ByteData);i++)
ByteData[i]= random(0xFF);
sysSetVariableData (sysvar::Panel::Editor_ByteArrary,ByteData,elcount(ByteData));
setTimer(timer_demo,1000);
}
3️⃣ 运行CANoe ,按下按键‘a’,panel 周期刷新数据。

symbol类型是Int arrary
1️⃣ 如果绑定的symbol的数据类型是Int Arrary
- 则Editor 控件每行只能显示一个 整形数(占4个字节,且通过空格隔开),且是16进制显示的。
Columns/Letter per Line属性这个时候就不能在设置了,固定死了

2️⃣ 下图代码是系统变量Editor_IntArrary赋值,
- 重点,代码中定义的临时
变量IntArrary数组的大小一定和系统变量Editor_IntArrary定义的数组大小一致,否则设置不成功的。
/*@!Encoding:936*/
on key 'b'
{
IntArrary[0]= 0x11111111;
IntArrary[1]= 0x22222222;
IntArrary[2]= 0x33333333;
IntArrary[3]= 0x44444444;
sysSetVariableLongArray (sysvar::Panel::Editor_IntArrary,IntArrary,elcount(IntArrary));
}
3️⃣ 运行CANoe 按下按键‘b’,显示结果如下:

symbol类型是string
1️⃣ 如果绑定的symbol的数据类型是string,则Editor Layout属性可以只选择Only Text Filed
- 我们可以用Editor 控件来实时显示我们的测试过程的log信息,下面我们把读取到的DTC 信息显示在Panel中。
- 注意这个控件只支持英文输出,且不会自动换行,需要指定每行多少个字节(
Columns/Letter per Line)
2️⃣ 一段小代码演示下 symbol类型是string,editor控件的显示效果
- 需要严格按照(
Columns/Letter per Line )设置的每行字节数来格式输出。否则无法像图中的那样有格式
/*@!Encoding:936*/
on key 'c'
{
char tempText[0x500];
int i;
dword DTC[3] = {
0xD08998,0xD01123,0xD05695};
char Descriable[3][20]={
"Power High","Power Lower","Crc Error"};
byte Status[3] = {
0x09,0x2B,0x2F};
// 类似于表格头
snprintf(tempText,elCount(tempText),"%8s%16s%12s","DTC","Descriable","Status");
for(i=0;i<3;i++)
{
snprintf(tempText,elCount(tempText),"%s%8X%16s%12X",tempText,DTC[i],Descriable[i],Status[i]);
}
sysSetVariableString (sysvar::Panel::Editor_String,tempText);
}
3️⃣ 运行CANoe 按下按键‘b’,显示结果如下:


总结


- 要有最朴素的生活,最遥远的梦想,即使明天天寒地冻,路遥马亡!
- 如果这篇博客对你有帮助,请 “点赞” “评论”“收藏”一键三连 哦!码字不易,大家的支持就是我坚持下去的动力。
边栏推荐
猜你喜欢

Qt创建应用程序托盘及相关功能

Constant pointer, pointer constant

5个最佳WordPress广告插件

Real time weather API

Adobe substance 3D Designer 2021 software installation package download and installation tutorial

UVM——双向通信

MySQL - 多列索引

MySQL - lock

MySQL - hiding and deleting indexes

App automation and simple environment construction
随机推荐
The role of glpushmatrix and glpopmatrix
PC博物馆(1) 1970年 Datapoint 2000
How to build a node development environment efficiently
划分数据2
ZOJ 2770 differential restraint system -- 2 -- May 20, 2022
MySQL - 删除数据库表中的数据
分布式事务处理方案大 PK!
第五章 修改实现(IMPL)类
Problem solving -- question 283 of leetcode question bank
Arduino + AD9833 波形发生器
OSPF includes special area experiments, mGRE construction and re release
Nirvana rebirth! Byte Daniel recommends a large distributed manual, and the Phoenix architecture makes you become a God in fire
Daily three questions 7.21
Qt程序最小化托盘后,再弹出个msgbox,点击确定后程序退出问题解决
Rtklib source code, RTK difference calculation, rtkpos and replos function process sorting
JSON tutorial [easy to understand]
Will not be rejected! Learn the distributed architecture notes sorted out by Alibaba Daniel in 35 days, with a salary increase of 20K
Volcanic engine: open ByteDance, the same AI infrastructure, a system to solve multiple training tasks
MySQL - multi column index
How to gracefully realize idempotency and distributed current limiting of distributed interfaces (glory Collection Edition)
