Reducing Delay Time, Using Labjack


Recommended Posts

Hello,

 

We are trying to control the position of an 8-port valve using the outputs of a syringe pump (2 outputs) using a LabJack. We are using the sequence below however, it is not working for us as it is introducing an air bubble due to the 1 second delay. 

 

The way this works is as follows:

1. Give a command thru a TCS pump commander for the outlets of the pump to e either high or low.

2. The LabJack channels will be high or low accordingly (either 0 or 5 volts).

3. The DAQFactory channels will bounce from 0 to 1. 

4. The sequence below will give the command to the 8-port to switch to the desired position. 

 

For this to be completed the way it is running right now, DAQFactory cannot see the change in the FIO1 and FIO0 channels if we do not give a delay of one whole second in the TCS pump commander software which is like I said is introducing an air bubble to the system.

 

So i was wondering if there is any way we can modify this code to enable DAQFactory to see the change in the  FIO1 and FIO0 channels in less than a second or half a second or less even.

 

Thanks.

 

Here is the sequence:

while(1)
 
// Valve = 1,J1
if((FIO0[0] == 1) && (FIO1[0] == 0))
    device.vici.write("GO1" + chr(13))
endif
// Valve = 5, J4
if((FIO0[0] == 0) && (FIO1[0] == 1))
    device.vici.write("GO5" + chr(13))
endif
// Valve = 7, J5
if((FIO0[0] == 1) && (FIO1[0] == 1))
    device.vici.write("GO7" + chr(13))
endif
// Do Nothing; IDLE, J0
 
endwhile
      //Adds Channels for each output
      IC.AddValue(StrToDouble(vIC))
      TC.AddValue(StrToDouble(vTC))
      TOC.AddValue(StrToDouble(vTOC))
   catch()
      ? strLastError
      delay(0.001)
   endcatch
endwhile
Link to comment
Share on other sites

The delay is likely do to the timing of the input channels.  You have two choices.  I'd recommend the second:

 

1) decrease the Timing value on your input channels so it reads faster.  Minimum timing on a LabJack is maybe 0.01 or 0.02.

2) trigger the read from your sequence instead right before you examine the value.  So, right after your while(1) do:

 

read(FIO0)

read(FIO1)

 

As I said, I'd do #2.

Link to comment
Share on other sites

Archived

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