Sign in to follow this  
MrDeathStar

Reserved Word Warning

Recommended Posts

Today I was moving code from some old sequences into a single new sequence with a switch statement. The old sequences were being called by some variable value components and worked well.  I updated the components to call my new sequence and DAQFactory locked up.

 

Sequences that demonstrate this problem are attached.

TimeAsVarName.ctl

 

It is interesting that the old code works well but a lockup occurs if I use the case statement (with the variable declared outside the switch code).  The problem seems to stems from the use of 'time' as a variable name (since 'time' is likely a reserved word).  It might be a nice future feature to have the parser fail with a warning if a reserved word is declared.  Not sure why DF hangs.

 

Share this post


Link to post
Share on other sites

You are correct, the issue is that "time" is a reserved word used for a deprecated form of scripting in place of wait().  The compiler is confusing your time with the Time statement, which, since its not used correctly causes a wait forever.  Since you are calling this from the primary thread of DAQFactory (the UI), the program hangs because the script gets stuck at that line and never returns.  DAQFactory is not actually hung.  Any other sequences, logging, data acquisition would still run.  Just the UI would freeze.

 

Why it works in one script and not the other I can't say.  Its some fluke of the script parser. 

Share this post


Link to post
Share on other sites

Hi, I worked the problem to see the problem which was being masked by other errors. Yes it does freeze but only for Switch/Case seen in version 2 attached. Also showed me where to look to see. [Notes within]

TimeAsVarName2.ctl

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this