LabView

From Axel Public Wiki
Jump to navigation Jump to search

This wiki document explains how to import and use the LLSymbols VI blocks into a LabView project.

Download

Download and unzip the LabView_LLSymbols.zip file. You should notice a LabView_LLSymbols.lvlib file inside it (at the path LabView_LLSymbols\LabView_LLSymbols_Release), that is the LabView library containing all the VI blocks referred to the functions of the LLSymbols library.

Import the library into LabView

From a LabView VI panel, choose the following options:

File -> Open -> LabView_LLSymbols.lvlib

A window containing all the VI blocks will be opened.

Order of the VI blocks

Given the fact that LabView is a dataflow programming language, you must use the imported blocks with the order here specified. These blocks allow you to get/set a value for a variable which type can be either a String, or a Bool (treated as a number set to a 0/1 binary value) or even a Number; but in order to do that you have to drag and drop some configuration blocks.

This means that you have to wire your blocks by following this order:

(I) LL Sym Init WRAP.vi

It calls the Init function.

INPUT
No inputs.

OUTPUT
 function return: It must be 0

(II) LL Sym Open Workspace GDB.vi

It opens a workspace by getting a value for the PLC_area (set to 0 as default) and an IP address. It returns a handle to the workspace that can be passed as an input to the other VI blocks.

INPUT
PLC Area: It is set to 0 as default value.
IP Address: The IP address of your target.

OUTPUT
out_wksHandle: a workspace handle. It has to be given to LL Sym Get Global Tag WRAP.vi.
function return: It must be set to 0.

(III) LL Sym Get Global Tag WRAP.vi

It requires a workspace handle and a symbol (tag) name as input and returns a handle to the tag that can be passed as an input to the other VI blocks.
INPUT
wks_handle: The handle returned at the previous step.
symbolName: The name of the tag (variable) to be read/written.

OUTPUT
out_Tag_handle: a tag handle. It has to be given to a block at the point (IV).
function return: It must be set to 0.

(IV) GET/SET a value for a Number/Boolean/String tag type

Call one of the following six blocks to perform the desired action. Clearly, every one of them requires the tag handle returned at the previous step.

LL Sym Get Tag Value BOOL

INPUT
tagHandle: the tag handle returned at the previous step (III).
OUTPUT
out_bool: a number set to a 0/1 binary value.
function return: It must be set to 0.

LL Sym Set Tag Value BOOL

INPUT
tagHandle: the tag handle returned at the previous step (III).
bool_param: a 0/1 value to be set.
OUTPUT
function return: It must be set to 0.

LL Sym Get Tag Value NUMBER

INPUT
tag_handle: the tag handle returned at the previous step (III).
value: a numeric value to be set.
OUTPUT
function return: It must be set to 0.

LL Sym Set Tag Value NUMBER

INPUT
tagHandle: the tag handle returned at the previous step (III).

OUTPUT
function return: It must be set to 0.

LL Sym Get Tag Value STRING

INPUT
tagHandle: the tag handle returned at the previous step (III).

OUTPUT
function return: It must be set to 0.

LL Sym Set Tag Value STRING

INPUT
tagHandle: the tag handle returned at the previous step (III).

OUTPUT
function return: It must be set to 0.

(V) LL Sym Close Tag WRAP.vi

It closes the tag handle taken as an input of the block.

(VI) LL Sym Close Workspace WRAP.vi

It closes the workspace handle taken as an input of the block.

(VII) Shutdown.vi

It performs the Shutdown function.


Clearly, you can perform one or more actions at the point (IV) within a single flow: please remember that you have to get a tag handle for every variable you want to read/write. Moreover, every time you get a handle (either for a global tag or a workspace) you must close it when you don't deserve it anymore, in order not to waste resources.

It is suggested that you wire these blocks into a Flat Sequence Structure, as shown in the example provided along with the library.

Example

The zip file you downloaded before also has a folder that contains an EXAMPLE.vi file that may explain you in a better way how to use the blocks of the library.

Please notice that it could be required to choose the correct path at which you got the VI blocks on your machine when you open this example within LabView, since you have to manually set the correct path to the blocks of the library used inside this project. When you choose the correct path for one single block, LabView automatically corrects all the paths to the other blocks.