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.

These blocks interact with LogicLab and their aim is to get/set a value for a Number/Bool/String typed variable.

Download

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

Please note that you need LLExec >= 2.12.0 to work properly.

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 (II).
 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).

OUTPUT
 value: the number contained into the variable.
 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).
 value: a numeric value to be set.

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
 str: the String contained into the variable.
 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).
 value: a String value to be set.

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.

INPUT
 tag_handle: the tag handle returned at the step (III). It will be closed.

OUTPUT
 function return: It must be set to 0.

(VI) LL Sym Close Workspace WRAP.vi

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

INPUT
 wks_handle: the workspace handle returned at the step (II). It will be closed.

OUTPUT
 function return: It must be set to 0.

(VII) Shutdown.vi

It performs the Shutdown function.

INPUT
 No inputs.

OUTPUT
 function return: It must be set to 0.


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 examples provided along with the library.

Examples

The zip file you downloaded before also has a folder that contains both a EXAMPLE_full.vi and a EXAMPLE_minimal.vi files that may explain you in a better way how to use the blocks of the library.

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

When you try to open one of our examples, the following window will be shown:

Labview load.png

Please check which VI block is trying to be loaded by LabView, then choose Browse... and import that block from the following path:

LabView_LLSymbols\LabView_LLSymbols_Release\VIs\

Then a new window will be shown: press ignore and finally save the example.

Now connect to your target via LogicLab and fill the blank gaps of the examples with your own address and symbols, then you'll be able to run those examples.