I Can't Re-Create An Analog Channel


Recommended Posts

I wanted to add a new analog input channel, and so copied an existing one.  Because I wanted to use this new channel on my existing graphs, I decided to rename the old channel, and then rename the new channel to be the same as the old one.  That way my existing code and displays would work on the new channel.

 

However, in the process I broke something.  Now I can not get either channel working.  The input is working, but the values are WAY too high.  What used to report something like 75, now gives values roughly 10,000 to high.  I did not do anything with the conversion formula.

 

I tried to recreate the original channel, and  looked at a backup copy of my program, then carefully made sure I had the exact same settings for the channel.  But, everything was already set properly.

 

Any ideas where I might have gone wrong?  Did I trigger a bug somehow?

 

-Joe

 

 

Link to comment
Share on other sites

Its unlikely a bug in DAQFactory.  Either you created a channel that has the same D#, I/O type, channel # as another channel and the data is coming from there, or you have script somewhere that was sticking data into that channel name using addValue() and its now going to the wrong place.  I might need to see your .ctl doc to tell anything further.  Consider restarting DAQFactory too.

Link to comment
Share on other sites

I just went through actually deleting the graph,and then copy/paste the graph from the working version.  Then, I deleted all the channels, and imported them from the working version.  Finally, I erased the conversion and pasted a copy of the conversion formula from the working version.  Still not working.  I guess code is the only remaining place for the problem to be hiding.

 

I will start a support request, and send you the .ctl file.

 

Thank you for your support,

-Joe

Link to comment
Share on other sites

The issue is that you have a space in the Quick Note for the analog input channels.  For the LabJackUD driver, this column is passed to the LabJack driver, and the LabJack driver was misinterpretting it.  By removing the extra space, the values came out correct.

Link to comment
Share on other sites

Hi-

 

I have run into this "sort" of problem several times-although I cant be certain its the "same" problem as yours. What worked for me is to delete the channel, and then create a new one with a different name, but this requires to double check all your

sequences that use the channel and renaming in those places as well.

 

I spent many frustrating months on some critical channels that I also had declared as Globals. And to make it worse, the function I needed to make things work, only worked with Variables.

 

Also, I have found that a "clearall()" in the comand line often does the trick to get things going again with stalled channels.

 

On a different note, and possible unrelated, I have found that the initial Front or Main page of a document cannot be deleted

so that you can rename another Page to become the "Main" page by renaming that one. Doing that Hung DF to no end.

 

I use DF Version 5.87-havent updated yet.

Link to comment
Share on other sites

Thus the problem with global variables and why they typically are avoided in large programs (though this is not Joe's issue).  DAQFactory, however, is designed to be easy to use for the non-programmer on smaller systems so global variables are used a lot in the examples, because explaining how to avoid them requires a bit more coding.  However, if you are going to create a more advanced app, you really should consider using alternative methods.  Here are two easy ones to avoid issues with a cluttered global namespace:

 

1) put all your global variables in a class instead.  Instantiate that class as a global variable "g".  Then you can access all your globals through g.myVar:

 

class CGlobals

   local myVar = 4

   local string anotherVar = ""

endclass

 

global g = new(CGlobals)

 

This means that only g is in the global namespace, and all your globals are under g.  This has the advantage also that you can use to/fromJson to actually persist these globals to file.

 

I personally use this method for all programs of any size that might have more than, say, 10 globals.

 

2) uncheck the box that says "Default Connection" under Local.  This will keep all your channels from ending up in the global namespace, and instead you'll have to do Local.myChannel instead of just myChannel.  Alas, there has to be a default connection, so if you uncheck it for local, it will check it for V, bring any V channels (which I wouldn't recommend using anyway for large apps) into the global namespace.  You can get around this by creating a dummy connection with an empty address and assigning that as the default connection, but that will only work in Pro or higher.

 

As for the default page issue, I have not seen this one.  If you can create a .ctl doc that reproduces it, we can address it.  Note that the initial main page is determined by a page property, not the page's name. And you can have more than one page (or none) marked as default and they will overlay.

Link to comment
Share on other sites

Archived

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