Detect communication between LJ and PC


Switch

Recommended Posts

I have 4 LJ U3 device, each with a different local ID, used for doing the same test. They are used with the LJ relay drivers to periodically control relay on a circuit. Instead of having a separate software for the different device # or changing the device number manually for all the channels every time, I added a device select symbol which changes the device # between 1-4 for all the channels in the software when pressed.

if device_select = 1

mychannel1.devicenumber= 2 etc

The problem is when one LabJack is running and I setup another one on the same computer, I will interfere with the first test as I switch between device # 1 to 4. I get a communication error since its like trying to run two DF programs on the same LabJack.

I am wondering if there's a way to detect if a LabJack is being used by another DF software and communicating with the PC so I can write code to skip that device number, or better yet, if you can recommend an easier way to implement this feature.

Thanks!

Link to comment
Share on other sites

My recommendation is to write your app so it runs on one instance of DF. You may have to skip channels altogether and use variables instead. This will give you total control over what gets read from where and when. How you design it depends a little on what you are trying to do.

Link to comment
Share on other sites

Is it generally more reliable to run more pins on a single LabJack than running fewer on two LabJacks? I am currently using three pins on a device and the controls have already filled my page. Since I have several LabJacks available, I thought it would be easier to use multiple devices rather than having to duplicate the code.

Can you elaborate on how I can replace channels with variables? I've used variables in my sequences but I guess I am just not familiar with how I can assign the variables to control pins and set which device number I want to control.

Link to comment
Share on other sites

I don't know. You'd think it'd be better to run on multiple labjacks since you then be diversifying. If one LabJack failed, the other would still run. However, you should still run the multiple labjacks off one copy of DAQFactory. Don't start up a separate instance of DAQFactory for each LabJack.

If you have used variables then you've done most of it. Assigning values to control pins is covered in the LabJack DAQFactory application guide. You just use the AddRequest/GoOne/GetResult functions of the standard LabJack API, passing the desired variable to GetResult.

Link to comment
Share on other sites

Archived

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