Using V-channels in Sequences


Recommended Posts

In one of my earlier posts I was told by Azeotech that indeed V-channels can be used in sequences...


I have a peizo siren that is connected to a Labjack U6. When a channel goes above a set-point (that I have in a V-channel), I want DAQFact Lite to send a 5V signal to the DAC channel.

I have the siren working correctly, but just merely on/off by toggling the voltage to DAC1 between 0 and 5V (so not working with sequences yet).

Sometimes the alarm will be going off continuously, where as I just want it to make the operators aware of the initial problem. Therefore, I want to be able to turn the sequence on/off (as a way to kill the siren but still allow screen components to flash to make the operator aware of where the alarm is coming from).

My code"

I have a button screen component that start/stops the following sequence:

global V.alarm_TT10_min //this is the storing the set-point
global TT_10_K //this is the channel name for the temperature in question
global siren = 0 // this is the channel name for the siren (a voltage output)

iif(TT_10_K[0] < V.alarm_TT_10_min, siren = 5, siren = 0)


(1) I have the thread priority set to "2 - User Interface". Is this correct? I don't understand the priorities.

(2) Do I still have to declare variables in sequences even if they are channels already or is this overkill?

(3) When setting any variable to a value, should one use " siren = 5" or "siren[0] = 5"?

(4) Is there something special you have to do with V-channels in script?

(5) Perhaps I should have used an inline-if in a sequence?

Thanks in advance Azeotech!


Link to comment
Share on other sites

1) unless the sequence is a loop, priority doesn't matter much. Its really a matter of, well, what you want to have priority. If the loop is more important than the user interface, give it a higher value, if not, make it lower. It really only comes into play if you have processor intensive tasks. Usually keeping priority 5 on all sequences is just fine.

2) Absolutely not, and in fact, by doing so you are overriding the channels and making them inaccessible. Doing it with globals makes them permanently inaccessible until you do clearGlobals() or restart. When DAQFactory is looking up a symbol, it looks in private variables first, then globals, then system objects, then finally channels

3) depends. If you want siren to just = 5, don't use [0]. If siren is an array and you want to set the first element to 5, then use [0] (for example: siren = {1,2,3}, then siren[0] = 5 will make siren equal {5,2,3}, but siren=5 would make it equal to just 5)

4) No. Just use V. in front of the channel name, and when reading the value (not setting), you usually want [0] after it, otherwise you'll get the whole array

5) Your iif() is incorrect. Its an expression, not three expressions, and returns a different result. It should read:

siren = iif(TT_10_K[0] < V.alarm_TT_10_min, 5, 0)

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.