当前位置:网站首页>零基础学习CANoe Panel(14)——二极管( LED Control )和液晶屏(LCD Control)
零基础学习CANoe Panel(14)——二极管( LED Control )和液晶屏(LCD Control)
2022-07-25 12:25:00 【蚂蚁小兵】
- 我是蚂蚁小兵,专注于车载诊断领域,尤其擅长于对CANoe工具的使用
- 寻找组织 ,答疑解惑,摸鱼聊天,博客源码,点击加入【相亲相爱一家人】
- 零基础学习CANoe Panel设计目录汇总,点击跳转
前言
本节通过一个简易版的电源操作面板,来一起演示下液晶屏(LCD Control)控件和二极管( LED Control )控件
演示软硬件环境
Windows11 x64;CANoe 11 SP2 x64

液晶屏(LCD Control)
- 放置两个LCD Control取来实时显示电源电压电流
- 放置一个 LED Control 用来显示电源连接状态
- 放置两个Input/Out 控件,串口连接的配置

设置数码管数量
- 一个数字就是一个数码管,以小数位为界,可以设置整数位和小数位的显示位数
Decimal Places:整数位设置为2个Number Of Digits:小数位设置2个

数码管配色设置
- 默认配置就是点亮段时红色,背景色和没有被点亮的段时黑色
- 下面我们简单设置下数码管的颜色

电源连接和电压读取模板代码
- 下面代码,可以作为一个标准电源连接和电压读取的模板把,实际使用时,再根据具体情况加工下
/*@!Encoding:936*/
variables
{
msTimer timer_V;
msTimer timer_C;
char tempText[0x500];
int Port;
int BaudRate;
int res;
byte GetCurrentCommand [6] = {
'I','O','U','T',13,10};//13 CR ; 10 LF
byte GetVoltageCommand [6] = {
'I','O','U','T',13,10};//13 CR ; 10 LF
}
on timer timer_V
{
//RS232Send(Port, GetCurrentCommand, elCount(GetCurrentCommand));
//模拟随机值,真实硬件情况下,把RS232Send打开,然后在RS232OnReceive解析返回值
sysSetVariableFloat(sysvar::Panel::LCD_Voltage,random(5)/10.0+random(10));
setTimer(timer_V,1000);
}
on timer timer_C
{
//RS232Send(Port, GetCurrentCommand, elCount(GetCurrentCommand));
//模拟随机值,真实硬件情况下,把RS232Send打开,然后在RS232OnReceive解析返回值
sysSetVariableFloat(sysvar::Panel::LCD_Current,random(5)/10.0);
setTimer(timer_C,600);
}
on sysvar Panel::Port
{
InitPower();
}
on sysvar Panel::BaudRate
{
InitPower();
}
RS232OnReceive(dword port, byte buffer[], dword number)
{
if(buffer[0] =='V')
{
sysSetVariableFloat(sysvar::Panel::LCD_Voltage,random(5)/10+random(10)); //模拟随机值
}
else if(buffer[0] =='C')
{
sysSetVariableFloat(sysvar::Panel::LCD_Current,random(5)/10);//模拟随机值
}
}
int InitPower()
{
Port = sysGetVariableInt(sysvar::Panel::Port);
BaudRate = sysGetVariableInt(sysvar::Panel::BaudRate);
write("Port:%d ;BaudRate:%d ",Port,BaudRate);
res = RS232Open(Port);
if(res!=1)
{
write("Open COM %d Failed!",Port);
return 0;
}
res = RS232Configure(Port,BaudRate,8,1,0);
if(res!=1)
{
write("Configure COM %d Failed! :%d",Port,res);
return 0;
}
res = RS232SetHandshake(Port,0,0,0,0,0);
if(res!=1)
{
write(" Configure handshaking COM %d Failed!",Port);
return 0;
}
//配置成功
setTimer(timer_V,500);
setTimer(timer_C,600);
sysSetVariableInt(sysvar::Panel::LED_1,1);
write("Configure COM %d Ok!",Port);
return 1;
}
on stopMeasurement
{
rs232Close(Port);
}
实际测试结果

液晶屏(LED Control)
- LED Control 作为一个状态显示控件,比较简单

On Off 值和颜色属性设置
- LED Control 只有On和Off两种状态,默认 On 是1 ,OFF是0,颜色也可选

形状属性设置
- panel提供了6种可选形状


总结


- 要有最朴素的生活,最遥远的梦想,即使明天天寒地冻,路遥马亡!
- 如果这篇博客对你有帮助,请 “点赞” “评论”“收藏”一键三连 哦!码字不易,大家的支持就是我坚持下去的动力。
边栏推荐
- Leetcode 1184. distance between bus stops
- Jenkins配置流水线
- JS 将伪数组转换成数组
- Deep learning MEMC framing paper list
- Pytorch visualization
- JS 中根据数组内元素的属性进行排序
- What does the software testing process include? What are the test methods?
- 【2】 Grid data display stretch ribbon (take DEM data as an example)
- Experimental reproduction of image classification (reasoning only) based on caffe resnet-50 network
- Pytorch project practice - fashionmnist fashion classification
猜你喜欢

Build a series of vision transformer practices, and finally meet, Timm library!

cmake 学习使用笔记(二)库的生成与使用

Moving Chinese figure liushenglan

Kyligence 入选 Gartner 2022 数据管理技术成熟度曲线报告

2022.07.24 (lc_6124_the first letter that appears twice)
![[rust] reference and borrowing, string slice type (& STR) - rust language foundation 12](/img/48/7a1777b735312f29d3a4016a14598c.png)
[rust] reference and borrowing, string slice type (& STR) - rust language foundation 12

2022.07.24(LC_6124_第一个出现两次的字母)

Clickhouse notes 03-- grafana accesses Clickhouse
软件测试流程包括哪些内容?测试方法有哪些?

PyTorch进阶训练技巧
随机推荐
2.1.2 application of machine learning
交换机链路聚合详解【华为eNSP】
“蔚来杯“2022牛客暑期多校训练营2 补题题解(G、J、K、L)
Leetcode 1184. distance between bus stops
Can't delete the blank page in word? How to operate?
If you want to do a good job in software testing, you can first understand ast, SCA and penetration testing
R language ggplot2 visualization: use the ggviolin function of ggpubr package to visualize the violin graph, set the add parameter to add jitter data points and mean standard deviation vertical bars (
【十一】矢量、栅格数据图例制作以及调整
[advanced C language] dynamic memory management
2022.07.24(LC_6126_设计食物评分系统)
软件测试面试题目:请你列举几个物品的测试方法怎么说?
Dr. water 2
SSTI 模板注入漏洞总结之[BJDCTF2020]Cookie is so stable
想要白嫖正则大全是吧?这一次给你个够!
Analysis of TCP packet capturing using Wireshark
[rust] reference and borrowing, string slice type (& STR) - rust language foundation 12
Spirng @Conditional 条件注解的使用
微软Azure和易观分析联合发布《企业级云原生平台驱动数字化转型》报告
Software testing interview question: Please list the testing methods of several items?
PyTorch的生态简介
