LabVIEW基础-lvlib库

lvlib库

文件-新建-库,创建一个项目库文件。能在项目中创建的文件类型,都可以在库中创建。
在这里插入图片描述在这里插入图片描述
在lvlib上右键-添加-文件,将被选中的文件放到lvlib中。被添加进lvlib的vi名发生改变(vi名前添加了lvlib名,中间以:隔开)
在这里插入图片描述
在lvlib上右键-属性-项设置,设置lvlib内vi的访问权限。
公共-用户在查看项目库时,此项可见。 公共VI可供其他VI和应用程序调用。
库内-用户在查看LabVIEW类时,此项可见。 只有友元和项目库中的VI可调用库内VI。
私有-如锁定项目库,其他用户查看项目库时,该项不可见。 不属于项目库的VI和应用程序无法调用私有VI。
未指定-仅当选定文件夹时,显示该选项。 文件夹未指定访问项, 访问范围为公共。 默认情况下,如未指定类中文件夹的访问范围,则文件夹的访问范围为公共。

//在指定文件夹的访问范围时,访问设置适用于文件夹下所有文件,且可覆盖文件原有设置。
在这里插入图片描述

llb库

工具-llb管理器-文件-新建llb可创建一个新的llb。如果需要在llb文件中添加或删除VI,也需要先打开llb管理器。
在这里插入图片描述在这里插入图片描述

lvlib与llb的区别

lvlibllb
lvlib不包括实际文件llb是一个磁盘上的文件整体
所包含的文件以单独文件形式保存在磁盘vi都存在于此文件的内部
通过项目浏览器查看需要通过llb管理器查看
库名不可重复,库中vi名可与其他库中vi名重复
一个vi只能为一个lvlib所有
一个文件不能同时属于两个lvlib。必须将某个lvlib中的文件添加到新的库时,需要把整个库添加到新的库里
lvlib可以限制访问权限(公共/私有)
lvlib可添加层次关系(虚拟文件夹)llb内部vi平级存放,无层次关系

lvlib常见错误

报错:该vi所属库不存在。
发生原因:将vi连接至库后将库移动至其他目录/删除了库。
解决方法:文件-断开连接库
在这里插入图片描述

报错:LabVIEW工程库与在工程库中的文件不共享同一个硬盘路径
发生位置:试图将lvlib添加到安装程序时
解决方法:库文件可以在创建可执行文件时作为支持文件添加,而在安装程序中,不需要单独添加lvlib文件

断开vi与库之间的连接

一个批量断开lvlib与vi的小程序(鬼知道我经历了些什么才想起来搞这个)
在这里插入图片描述

  • 4
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
与西门子PLC通讯的Labview,还不错。 以下是英文声明: Warning, the attached files are experimental VIs provided for educational purposes only. No warrantee is expressed or implied. You should test your code and completely understand the implications of writing to or reading from an operating PLC. PLCs are often used to control hazardous processes and/or equipment. Writing to or reading from a PLC in active control of equipment or process can result in the disruption of the PLC program or data areas, potentially causing economic loss, property damage, generation or release of hazardous substances and/or personal injury up to and including death. Test your software in a controlled environment and qualify it before using it on active equipment or processes. To my knowledge, Siemens has never released the details of the S7 protocol. Much of what is publicly available on S7 is based on observations of the protocol by others. There is an open source S7 data exchange package available at http://libnodave.sourceforge.net/ that documents many S7 features. These VIs were based upon the example posted at http://decibel.ni.com/content/docs/DOC-5467. They were modified by observing and mimicking a S7 data exchange between a protocol converter and a S7-300 series PLC. The observations were accomplished with the wireshark network protocol analyzer, available at http://www.wireshark.org/ and the Wireshark Plugin f黵 S7-Protokoll, available at http://sps-forum.de/showthread.php?p=202763. The Address Area parameter determines which PLC memory area is the target for the reads and writes. I have only tested reads and writes to the Data Block (DB) Area. Your application should read and write to separate read and write DBs dedicated for transfer only. By confining reads and writes to dedicated Data Blocks, the risk of unintended overwrites may be reduced. The data type: S7Com_Transport_Size.ctl is a ring variable that contains the parameter for the size or type of the transfer. I have only had success with the BYTE, INT and DINT transport sizes on an S7-300 series PLC. The other sizes remain in the ring variable for testing on other PLCs. I do not know if the bytes of a multiple-byte variable are read or written atomically. The example contains two top-level VIs: S7Com_Once.vi and S7Com_W+R_Loop.vi. S7Com_Once.vi performs one read or write per execution. It writes to the target PLC from an array of I32, it reads from the target PLC into an array of I32. The number of bytes written is proportional to the number of elements in the array to be written and the transport size parameter. S7Com_W+R_Loop.vi regularly writes to and reads from a pair of DBs in the target PLC. In order to use it, your Step7 PLC project should provide two Data Blocks, DB11 and DB12. See the screen capture image db11&12.PNG for their layout. After downloading the DBs to your PLC, monitor and change DB VAlues with a VAT. As can be seen in the VI, the transfer size is DWORD. Included are example VIs (S7Com_to_PLC(SubVI).vi and S7Com_from_PLC(SubVI).vi) to map variables between Labview and the S7 PLC DBs. In the example, they use the same cluster type definition (S7Com_PLC_Data.ctl) but that is not a requirement. When you change the mappings, you must calculate the size of the variables to be read from the PLC in order to use the correct Read Length parameter. The read length parameter is in transport size units. The write length parameter is taken from the size of the write data array, so if the write data array is larger than you anticipate, data may be overwritten. The hex byte and hex byte array type definitions were created to format the internal data structures to show hex values so that they could be easily compared to the wireshark packet dumps. These VIs have been minimally tested on a NI 9072 cRIO. This is not finished. Needed are better error checking, cleaner S7 Response decoding, and stress testing with malformed data.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

炳烛之明也

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值