新闻中心

EEPW首页 > 测试测量 > 设计应用 > labview的软件计数器和FIFO BUFFER

labview的软件计数器和FIFO BUFFER

作者:时间:2017-01-09来源:网络收藏
PLC编程中有大量的定时器和计数器可用,做工业自动化控制的朋友在LABVIEW编程时经常因为找不到类似熟悉的功能而烦恼,其实LABVIEW本身提供的逻辑功能非常强大,远远超过PLC.
看看加计数器的说明:
它有两个控制端
initialize--是计数器复位端,相当于PLC计数器的reset
activate----计数控制端,当ACTIVATE=TRUE时,每调用一次,计数器内部计数加1.
两个输出端:
Counter---输出计数器当前计数,U32数据类型,最大计数范围0XFFFFFFFF
Overflow---溢出,当超过计数器最大计数,为真,计数器自动复位,重新从1开始计数.
应用举例:
记录SUBVI被调用的次数
加计数器的程序框图
减计数器基本类似,更为常用,比如计数器10次触发一次事件,就减计数器就非常合适,就不详细介绍了
Data Queue是一个非常重要的VI,仔细分析它的程序结构,他实际上是一个先进先出的缓冲区(FIFO BUFFER)
它默认的是一个DOUBLE类型的输入,改动一下,就可以适应各种数据类型(重用LABVIEW的VI是一个重要的编程方法)
程序框图
initialize, when TRUE, initializes the internal state of the VI.
input data point is an input data point.
sample length is the length of each set of incoming data. The VI processes each set of data. The default is 100. sample length must be greater than zero.
eliminated element is the first point eliminated from the queue.
Current Queue is the new array created by eliminating the first point and appending the new point.
Previous Queue is the set of data before any operation in this call.
error returns any error or warning from the VI. You can wire error to the Error Cluster From Error Code VI to convert the error code or warning into an error cluster.
current length is the size of the current queue
应用举例:
XY GRAPH如果显示一个不断变化的曲线那,改造这个VI,DOUBLE输入改造成簇,包括X,Y,代表一个点,
在程序循环中不断加入新点,这样一个XY GRAPH就变成了类似CHART的图表了.


评论


技术专区

关闭