当前位置:网站首页>Kunlun State Screen Production (Serialization 2)---Basic Chapter (setting and display, serial transmission)
Kunlun State Screen Production (Serialization 2)---Basic Chapter (setting and display, serial transmission)
2022-07-30 07:14:00 【The light of the transparent】
写在之前
Experienced a software for the first time will not use meng force state after,Calm down and slowly,Well look at exactly how this screen,Experienced many help,Finally slowly grasped the significance of the kunlun state how to make the screen,Share the following the need to use a friend.
语言
还是那句话,自己理解之后,In the most simple language to express,能理解就好.Hope you don't mind where inaccurate wording.While writing an article need careful choice,But this is not published,Relax under the requirement for yourself,As far as possible accurate.
第一步:写脚本
Want to see a friend without psychological resistance this thing,I also pretty contradict what they don't,It should be said that the psychological uncomfortable,May be in his panic,I only want to make something yourself familiar.But in the end found always make something quite boring,But don't familiar with a little panic,Especially when they don't come out,This time the need to meditation,Slowly, step by step to.比如现在,我也TMThe confusion and panic!

再次打开,The device name change,高级.确定.

Click on the collection script.Delete all of the code.
Click on the device channel,删除所有.
The right equipment channel,添加.Feel this is better,Can use Chinese characters,Not all English.

At the same time add global variable,Finally formed the following things:

最左侧,两个通道,一个全局变量.代码一定要规范,g代表globe,n代表整型.The need to buy a special book to see.I also posted on my own in front of the code,All checked in,According to the coding rules to.At least look good.

During the acquisition of the script,加入程序,代码如下:
DIM gnGetData1 as INTEGER
!GetIntChannelValueByName("取数", gnGetData1)
!SetIntChannelValueByName("显示", gnGetData1)
!Sleep(1000)
DIM nSendByteArr(9) as BYTE
DIM nRecvByteArr(9) as BYTE
nSendByteArr[1] = &H5A
nSendByteArr[2] = &HA5
nSendByteArr[3] = &H03
nSendByteArr[4] = &H04
nSendByteArr[5] = !BitRShift(gnGetData1, 8)
nSendByteArr[6] = gnGetData1
nSendByteArr[7] = !BitRShift(gnGetData1, 8)
nSendByteArr[8] = gnGetData1
nSendByteArr[9] = !SvrByteArraySum(nSendByteArr,3,6)'和校验
!DevClearBuff() 'Clear the buffer
!DevWriteAndReadByteArr(nSendByteArr,9,nRecvByteArr,9,通讯延时)According to the number of lines in turn explain the code:
定义变量gnGetData1;
从“取数”Channel access into thegnGetData1中;
将gnGetData1放入“显示”通道中
延迟1s钟
定义发送数组
定义接收数组
以下9Behavior array assignment
Clear the buffer
发送“发送数组中的数据9个”And return back9个数放入“Receiving array”.
Click on the toolbar in the exclamation point in front of the checkmark button,检查语法.
What grammar to help find,Each function write very clear,会用就行.
保存:

到此,Script-driven written.
注:保存位置:D:\MCGSE\Program\Drivers\用户定制设备\Examples of serial port,Instance of a serial port folder build.You can look for other.
第二步:链接
The open section, a configuration,On the section only set up a user window,User window set up two dialog boxes.

关闭这个窗口,回到原始位置,Click on the device window:

Double-click the device window,进入界面:

First add father universal serial port equipment,点击设备管理,Add just save users to customize equipment with,Take the number display device,As for why didn't change name,我也不知道,Anyway looking is just saved scripts drive.

确定后,Click the newly added just now“Take the number display device”,Oneself will run to just add the parent equipment here.

Double-click add script-driven,Choose channel connection:

至此,Driving is to add.Another is the serial number,This is the need to look at their own serial port is which one,Then the father equipment modification inside,这个就不介绍了.
注:At this point what channel of what,Should be still a face of meng forced state,为啥这样设置,End this problem.(这个很关键)
第三步:显示
保存后,Back to user window,Double-click on your project,Show last set of two dialog

Double-click on the input box,Select an action attribute,There is a corresponding data object name,可写,可选.写入:取数.Another input box,按照同样的步骤,Write to show.
至此,Interface has been done,Script also has joined.
点击工具选项,选择下载配置,出现以下画面:

点击工程下载,Engineering will just download to the simulation environment., that is, instead of the screen that thing.

出现绿色的提示,If it is other color, please check yourself where do ignore.
点击启动运行.

In the first box to write Numbers,The second frame delay after the show.

At the same time connect a serial port,看到354Hexadecimal in data:0162

至此,Take the number show,And through a serial port from complete.It can be seen that interval to send1200ms.这个1000Is JianBen program insidesleep的1000,另外还有200ms,Is the time to write a script set this place.设备属性,通讯延时.A serial port to send instructions in,Contains the communication delay,所以每次间隔1200ms.

第四步:解释
Now look at the steps just now:脚本,界面,下载,模拟,运行.这五个步骤,缺一不可.
回头复盘:

(1)写脚本,设定通道;Is the black box input port(At the back of the access),输出口(At the back of the display and serial port).
(2)设置界面,加入脚本.At this time the parameters in the script is only the entrance parameters,No link to the interface.Double-click the script after driving,Will display and the number corresponding to the display and take,Connected with the entrance and interface of the script.
(3)Interface of two input box,Were set to display and access,Formal parameters in the script to entry link to the interface of input box.
注:Drive the display and access the entrance to a script,Driver set corresponds to display and access interface is the corresponding parameter,这个是可以变的.

Is this inside the front access and display,Are the corresponding interface parameters,随便修改.At the back of the access and display is in the script,Can only modify the script in the channel name,These two will change.Application name:Parameter entry.
顺序:界面---实参--形参---脚本---输出(Interface argument and a serial port)
Checking the order problem
The programming sequence is strange,先编写脚本,定义好变量,And then passed to the interface window,Script interface window reuse the variables in the.Anyway, for the first time to see the screen.Used Siemens screen,To the serial port after screen,No such programming.This is the threshold of the embedded screen,So few online tutorial.
写到最后
These two articles to make the most simple things,And then do,What will insert button,After I try out one by one to write an article to introduce,Hope that friends can wait,Also hope to do the things friends attention,Future articles will continue to update.
边栏推荐
- Diwen serial screen production (serialization 1) ===== preparation work
- 边境的悍匪—机器学习实战:第八章 降维
- OpenLayers (ol包),Vite显示地图(附源码)
- ipconfig Command Guide
- QT串口动态实时显示大量数据波形曲线(五)========“最终完美解决版”
- QT每周技巧(1)~~~~~~~~~运行图标
- Kunlun State Screen Production (serialization 4) --- Basics (graphical setting and display, button lights)
- Meta分析在生态环境领域里的应用
- Flood Control Assessment Report Compilation Method and Flood Modelling under the New Guidelines (HEC-RAS)
- 边境的悍匪—机器学习实战:第四章 训练模型
猜你喜欢

Pytorch(二):数据读取机制(DataLoader、DataSet)与图像预处理模块(transforms)

边境的悍匪—机器学习实战:第十章 Keras人工神经网络简介

influxDB运维记录

QT连载3:基于QT和STM32H750的LORA试验平台(2)

OpenCV中(rows,cols)与图像(x,y)

Knowledge distillation method of target detection

边境的悍匪—机器学习实战:第四章 训练模型

R-GIS: 如何用R语言实现GIS地理空间分析及模型预测

R language application in the field of ecological environment

【江科大自化协stm32F103c8t6】笔记之【入门32单片机及GPIO初始化参数配置】
随机推荐
CPU的三种工作模式:实模式、保护模式、长模式
基于QT的CAN通讯数据实时波形显示(连载八)====“子函数或新类调用ui控件”
QT serial and CAN dynamic real-time display the log data
昆仑通态屏幕制作(连载2)---基础篇(设定与显示,串口发送)
CLUE模型构建方法、模型验证及土地利用变化情景预测
Generalized Focal Loss paper reading notes
一文盘点五款 BLDC 风机参考方案,建议先马
FPGA解析B码----连载1
探究make_shared效率
Kaggle-M5
How does MATLAB display nii file slice information in the image?
昆仑通态屏幕制作(连载1)---接触篇
Target detection, object classification and semantic segmentation of UAV remote sensing images based on PyTorch deep learning
BLDC电机应用持续火爆,“网红神器”筋膜枪前景几何?
关于报错vscode
QT连载1:readyRead()函数,数据分包不完整解决办法
边境的悍匪—机器学习实战:第二章 端到端的机器学习项目
华秋电子成为开放原子开源基金会openDACS捐赠人,共建 openDACS开源生态
Biome-BGC 生态系统模型与应用
Based on R language geographic weighted regression, principal component analysis, discriminant analysis and other spatial heterogeneity data analysis