CANoe Getting Started Series
Simple light switch implementation
1. Create a new project
Double-click to select CANFD500kBaud/4MBaud
The new page is as follows
2. Create nodes through DBC
Select the storage location of dbc
Right-click Network nodes, create switch and light nodes
Create Message, fill in Name, the smaller the ID value, the higher the priority (light does not need too high priority, the allocation is three digits)
Create Signal, just DLC It is 1, 1byte=8bit, and the length range here is 1~8.
Drag Signals to Messages
and then drag messages to switch to save.
Right-click database, import Wizard, import the newly created dbc,
select the dbc just now, and The node moves to Assigned nodes
show as below
Build the canvas Panel
Add switch and LED legends to the canvas
Save Panel
Configure environment variables
Enter SystemVariables under Environment
to create a new NameSpace, and create switch and light environment variables
. Open the Panel again, set the environment variable to graphical, and save
Signal transmission using CAPL programming
Double-click the light node to create a new can file. After the switch receives the signal, the light sends a signal
on sysvar switch_light_namespace::sl_switch{
//先获取到switch变化的msg信息
message switch_light_msg switch_light_msg;
//将变化后的信号值赋给signal
switch_light_msg.switch_light_sig=@this;
//返回msg信息
output(switch_light_msg);
}
on message switch_light_msg{
//让LED的信号值去等于开关变化后的值
@switch_light_namespace::sl_light=this.switch_light_sig;
}
run
Select emulated bus