LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 1097 on calling dll

Hi Guys,

 I am trying to control a Syringe Pump valve from Cetoni using their Labview API. I did not write the dll. Before I ask them about it, I want to make sure I didn't make any mistake in programming it.

 

The particular function block runs without error when Highlight execution is ON. So there is some sort of timing problrm. It waits until the hardware changes position and then moves on. Without highlight execution it throws an error.

I tried with delays using sequence structure but to no use. How else can I make that function run slowly so that hardware finishes executing.

 

//============================================================================
// Valve control test
//============================================================================
BOOST_AUTO_TEST_CASE(testValveControl)
{
long NumberOfValvePositions = LCV_NumberOfValvePositions(hValve1);
BOOST_CHECK_GT(NumberOfValvePositions, 0);
BOOST_TEST_MESSAGE("Valve positions: " << NumberOfValvePositions);
 
for (int i = 0; i < NumberOfValvePositions; ++i)
{
Result = LCV_SwitchValveToPosition(hValve1, i);
BOOST_CHECK_EQUAL(Result, ERR_NOERR);
CThread::sleep(200); // give valve some time to move to target
Result = LCV_ActualValvePosition(hValve1);
BOOST_CHECK_EQUAL(Result, i);
}
}
 
 Here the thread sleeps for 200 milliseconds...

 

Download All
Message 1 of 3
(2,577 Views)

Hi,

 

can you provide us with the VI and the DLL as well as with the modified VI, where you added the waiting time.

Also it would be interested which error is thrown.

 

Best regards,

Christoph

Staff Applications Engineer
National Instruments
Certified LabVIEW Developer (CLD), Certified LabVIEW Embedded Systems Developer (CLED)


Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved
0 Kudos
Message 2 of 3
(2,516 Views)

@GoKu25 wrote:

The particular function block runs without error when Highlight execution is ON. So there is some sort of timing problrm. It waits until the hardware changes position and then moves on. Without highlight execution it throws an error.

I tried with delays using sequence structure but to no use. How else can I make that function run slowly so that hardware finishes executing.


This is not necessarily an indication that the problem is timing. It could be threading - as far as I'm aware, execution highlighting forces everything to run sequentially in a single thread, rather than in parallel as LabVIEW would usually do. If you configured the DLL to run in any thread, but the DLL is not thread safe, then you could run into a problem like this. It's also possible that LabVIEW allocates and reuses memory differently with highlight execution turned on, such that the DLL might corrupt important memory only when execution highlighting is turned off.

 

I would start by changing all the Call Library Function Nodes to "Run in UI thread" if they are set to "Run in any thread."

 

If you really think it's timing, can you show how you tried to use a sequence structure to add a delay?

0 Kudos
Message 3 of 3
(2,506 Views)