当前位置:网站首页>Kunlun state screen production (serial 3) - based article (button serial port to send)
Kunlun state screen production (serial 3) - based article (button serial port to send)
2022-07-30 07:14:00 【transparent light】
写在开始
After two days of hard work,Finally have a new understanding of this embedded screen.Make an analogy below:
单片机或者ARM:
(1)main函数开始,进行INIT初始化;
(2)while(1)循环;
(3)External or internal interrupt.
The above three points are the conventional hardware programming that we are familiar with
And Kunlun Tong-state screen script programming:

(1)初始化脚本;---对应INIT初始化
(2)采集脚本;---对应while(1)循环
(3)Single-channel scripting;---对应中断
(4)退出脚本.
结论:The two programming are in one-to-one correspondence,It's just that there is an extra exit script when programming the Kunlun state screen script.That is, the program that executes when you exit the screen.
初始化和while(1)There is no difference between the two,It is equivalent to an interrupt in a single-channel script,The change of the channel value is the interrupt that triggers the execution of the single-channel script.This will be described in detail below.
第一节:回顾
上文中https://blog.csdn.net/weixin_45426095/article/details/119410084,《Kunlun on-state screen production(连载2)------基础篇(初试篇)》Details on how to write scripts,How to configure links to scripts and screens,How to make a screen,怎么调试,怎么验证.For those who are not yet clear, you can move to the above link.
There must now be three open windows:
(1)组态软件,也就是屏幕,Feel free to pull modules,Change the display at any time.
(2)脚本软件,Modify the script file at any time,Then connect to the configuration software.
(3)串口助手,方便调试.
注:Use virtual serial port software,Virtual out a pair of serial ports,The configuration software is connected to a serial port,Serial Assistant connects to another serial port,No hardware connection is required,The purpose of serial port debugging is achieved directly through the virtual serial port.
Made a fetch yesterday、Routines for display and serial transmission,Add something new today:按钮发送数据,Slider to enter other displays,Addition and subtraction input display,串口数据显示.
第二节:按钮发送
1. 编写脚本
(1)加入通道:第一个按钮,Device channel direct count,第三个.

(2)编写脚本:In single-channel scripting.
DIM ButtonChannel as INTEGERFirst define a channel number,目的:Which channel to take has changed,That is, which device channel has the interrupt.
ButtonChannel = !GetCurrentChannelNum()执行上述程序,You can get which device channel the value has changed.
IF ButtonChannel = 3 THEN
!Sleep(1000)
nSendByteArr[1] = &H5B
nSendByteArr[2] = &HB5
nSendByteArr[3] = &HFF
nSendByteArr[4] = !BitRShift(gnGetData1, 8)
nSendByteArr[5] = gnGetData1
nSendByteArr[6] = !SvrByteArraySum(nSendByteArr,3,3)'和校验
!DevClearBuff() '清缓冲
!DevWriteAndReadByteArr(nSendByteArr,6,nRecvByteArr,6,通讯延时)
ENDIFBecause the first button is the third channel,That is the third number,So the following explains the code line by line
如果按钮被按下,==3时,执行以下程序;
缓冲1000ms,This is the system time,Does not occupy the interrupt time,So you can rest assured to delay,for the entire interrupt routine andwhile(1)program execution is not affected.
Fill sentbuffer 6个数,
清缓存,发送6个数据,接收6个数据;
(3)保存.
2. Load scripts and screen link drivers
(1)Open the file created yesterday:

(2)点击设备窗口:双击设备窗口,弹出对话框:Because the script file has been rewritten,So it appears that the driver has been modified externally,

双击驱动:更新设备,in the channel connection options,Add the corresponding data object.In this way, the parameters in the script can be recognized by the modules in the screen interface.

(3)保存,退出,Open the user window.
3. Screen interface settings
(1)Place the button module,这个不会的话,It is described in detail in the previous tutorial.

(2)修改参数:双击按钮,打开对话框,in the action properties:

in the value object,choose negation,Select the first button inside the question mark.
注:You must click to negate here,Because the interrupt script is executed every time a key is pressed,That is, single-channel scripting.Select other to execute only once,Or do it multiple times.
(3)保存.
4. 验证
工具,下载配置,工程下载,启动运行:

(1)初始结果:Yesterday's sending program,1s执行一次,报文正确.

(2)Modify the data in the fetch box:The display box follows the changes,The serial port display changes to 0A,报文正确.


(3)点击按钮后,报文正确.

第三节:总结
(1)总的来说,The programming idea is the same as before,But the programming content is close to embedded,Maybe this is why it is called an embedded screen.
(2)After writing the first routine,The following things are more than a gourd painting,一个一个的添加,然后去验证.From mental work to physical work.
(3)Screen entry has a certain threshold,Especially not embeddedARMMCU and other small partners for logic programming,There should be some difficulty.If you are a friend of object-oriented programming,可以看看前面的文章,There is an introduction to the difference between logic-oriented and object-oriented programming.After that, there are small partners who have the basics of oriented logic writing,It is also very difficult to do without a certain routine,If there is a routine,can be changed on this basis,This time it's easier.
第四节:展望
Now write a program for a button,Subsequent tutorials will be issued one after another,After all, programming takes time,Writing articles also takes time,At the same time, there are other tasks to be done while working,请耐心等待,谢谢了!Friends who need to discuss can add WeChat,大家一起进步:

边栏推荐
- Map making of environmental impact assessment based on remote sensing interpretation and GIS technology (the latest guidelines)
- Receive emails from gmail with pop3
- 虚拟机栈帧结构
- 边境的悍匪—机器学习实战:第十三章 使用TensorFlow加载和预处理数据
- HSPF 模型应用
- Rsync realizes folder or data synchronization between Win systems
- 动态规划入门 JS
- 你不知道的JS语法篇笔记
- 边境的悍匪—机器学习实战:第十六章使用RNN和注意力机制进行自然语言处理
- Atmospheric particulate matter PMF source analysis
猜你喜欢

Cannnot download sources不能下载源码百分百超详细解决方案

Application of remote sensing, GIS and GPS technology in hydrology, meteorology, disaster, ecology, environment and health

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

Kunlun State Screen Production (serialization 4) --- Basics (graphical setting and display, button lights)

jvm之逃逸分析

FPGA解析B码----连载1

QT串口和CAN数据动态实时显示最后日志

海量遥感数据处理与GEE云计算技术应用【基础、进阶】

边境的悍匪—机器学习实战:第八章 降维

昆仑通态屏幕制作(连载2)---基础篇(设定与显示,串口发送)
随机推荐
服务器基础知识:包含基本概念,作用,服务器选择,服务器管理等(学习来自米拓建站)
2021年软考中级过关
表格比手机屏幕宽时不压缩,可左右滚动,格子内容不换行
【江科大自化协stm32F103c8t6】笔记之【入门32单片机及EXTI外部中断初始化参数配置】
经典排序之插入排序
Knowledge distillation method of target detection
关于 PCB 多层板制程能力不得不说的那些事儿
Diwen serial screen production (serialization 1) ===== preparation work
QT serial and CAN dynamic real-time display the log data
边境的悍匪—机器学习实战:第十章 Keras人工神经网络简介
openssl 1.1.1 compile statement
PCB 一分钟科普之你真的懂多层板吗?
TCP为什么要三次握手,握手过程中丢包会怎么样?
边境的悍匪—机器学习实战:第五章 支持向量机
海量遥感数据处理与GEE云计算技术应用【基础、进阶】
多层板的层数,为啥选项都是偶数?就不能选奇数?
租用服务器训练yolov3模型
昆仑通态屏幕制作(连载3)---基础篇(按钮串口发送)
QT串口和CAN数据动态实时显示最后日志
Basic application of XMLBean