Digital Output Control Script

Recommended Posts


I'm trying to control my DO channels I have set up while I have a script running, but for some reason my digital out is not changing state on my Labjack U6 (measured with multi meter).

However, I noticed that the DO state changes on the Labjack when I start DF software without the script running (controlled through the "command/alert" window). It almost looks like it loses connection with the Labjack when I begin the sequence every time.

Note: I am able to visually see the state change on the page I have set up. The issue is only on the labjack side of things. Wondering if I am doing something wrong in my scripting.

Attached is the file I am working on. Would you be able to give me some clarity on this issue I a having?

Universal Tester.ctl

Link to comment
Share on other sites

This is because you declared global variables with the same name as your output channels.  Both channel names and global variables have global scope, but in the case of conflict, the global variable takes precedence. 

Note that once a global is declared, the only way to undeclare it is to call ClearGlobals(), which will undeclare all your globals.  Or restart after removing the declaration in startup...  It is probably easier to simply rename the channels.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.