More questions about sequences


Recommended Posts


I have made an application that is working. The only thing that bugs me are some initial alerts during first start-up. I have managed to get rid of most alerts by assigning values to variables and channels. Because of limitiations in DaqFactory Express I had to split up into several sequences. Does somebody spot an error or I am misinterpreting the expression language?


The alert message that I get are:

C1040 Channel does not have any valid values: detect_pos_12_failure Line 4: detect_pos_12_failure Line 4

C1040 Channel does not have any valid values: detect_pos_34_failure Line 4: detect_pos_12_failure Line 4

Sequence: StartUp this is an auto-start sequence

var.alarm1 = 0 // Populate DigOuts so X's do not display.

var.alarm2 = 0

var.alarm3 = 0

var.alarm4 = 0

var.master_alarm = 1

Position_1_load.AddValue (9999)

Position_2_load.AddValue (9999)

Position_3_load.AddValue (9999)

Position_4_load.AddValue (9999)



Sequence: StartUp2

alarm_stop_motor = 5

var.SGraphMin = 0

var.SGraphMax = 5000

var.SGraphWidth = 24




Sequence: detect_pos_12_failure

if (Position_1_load [0]< 1000)

var.alarm1 = 1


if (Position_2_load [0]< 1000)

var.alarm2 = 1


Sequence: detect_pos_34_failure

if (Position_3_load [0]< 1000)

var.alarm1 = 1


if (Position_4_load [0]< 1000)

var.alarm2 = 1


Link to comment
Share on other sites

Sorry I didn't see this post earlier, but perhaps the response to your next post answered the questions. Since others may read this, here is the answer to this question:

The problem here is that the detect sequences pretty much get started immediately on load before those inputs have had a chance to read. To avoid this error, you can just put a delay(1) or similar to delay the start of those sequences until after the channels have had a chance to read a value.

You have the AddValue() functions which should avoid this. Did you still get the error with those lines in place? If so then you have something else going on (like a history of 0 or something) and I'd have to see your document.

As I mention in the other post, you need a loop with a delay() in it on these detect sequences to get them to continually monitor. A few more pointers:

1) When monitoring channel values as you are, its actually better to use the Event on the channel instead. The event gets called every time a new value comes in on that channel. By using an event you avoid the C1040 error, avoid having lots of loops, and get quicker (actually the quickest) response. The code in your event would actually be the same as what you have in your detect sequences, except the if's would be with the appropriate channel. Note that you would never want to put a delay() in a channel event as that would stall the next reading.

2) If you want an easy way to avoid startup alerts like this, assuming you had a loop in those detect sequences, you can always add:


or just:


to get the sequence to ignore all errors or errors starting with C1040.

Link to comment
Share on other sites


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