LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA serial port address cannot be passed sometimes in LabVIEW 2016

Solved!
Go to solution

Recently, I have been trying to control my lock-in amplifier SR830 using labview.

That can be really a hard thing to do!

Because there is only GPIB interface program of SR830 I can find online.

I don't have GPIB cable, so I have to change this LabVIEW project from GPIB interface program into RS232 interface program.

Luckily, this LabVIEW SR830 driver project is programed using VISA.

According to https://forums.ni.com/t5/LabVIEW/Programming-a-RS232-interface-to-replace-GPIB-interface-that-is/td-...see the reply of rolfk),

the only 2 things I need to do is :

- append a "VISA Configure Serial Port" to configure the Baud rate etc. of the serial port.

- append the Termination Character '\n' to every command write to the device.

After I have done these 2 things, the program (initialized.vi) worked, which means sucess is close at hand.

 

However, a very weird thing happened.

there is a subVI that is not able to pass the serial port address to next subVI.

wil2004_0-1690442384055.png

This is the subVI called "Error Query.vi"

wil2004_1-1690442583326.png

This is the internal structure.

 

More weird thing happened. If I open the "Highlight Execution" of this subVI, the serial port can be correctly passed.

This would be like

wil2004_2-1690443060266.png

You can see the address is sucessfully passed. Otherwise(the Highlight Execution is not turned on), the address cannot be passed,

Be like

wil2004_3-1690443318500.png

You can see that the "VISA resource name out" is empty, this means the address didn't pass through.

More importantly, there is no warning or error report.

 

I don't know how to tackle this problem, I don't even know why this error happened.

I will appreciate your help very much.

 

System: Win10 64bits

LabVIEW 2016

the sr830 is linked to my computer using a USB to RS232 Converter cable.

The Serial Port read & write behave normally when I use a Serial Port Assistant software to communicate.

But when I use the labview VISA to communicate, there is many unexpected VISA Read&Write error being reported constantly.

Don't know where they comes from, but after trying it a few more times, things get normal.

 

 

 

 

 

0 Kudos
Message 1 of 9
(1,326 Views)

This sounds like there is a miswire of some type.  Can you post the code that is showing the issue?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 9
(1,269 Views)

Because the user mentioned that it worked with the light bulb on, I'm going to say it's possibly a bad driver.  (The picture suggests this is what the company put out as a driver for this instrument.)  Of course, it could be due to a miswiring inside the instrument driver...

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 9
(1,250 Views)

I think this is the driver set:

https://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=240C113D3165071BE0440003BA7CC...

 

At the end of the "Initialize" VI there is this:

Kyle97330_1-1690501398427.png

That is the only place I can find that could possibly be clearing the VISA address and it should only happen on an error, not on a warning.  Are you sure it wasn't running in such a way that it got an error in the Initialize VI that could have cleared it?

Message 4 of 9
(1,244 Views)

@Kyle97330 wrote:

I think this is the driver set:

https://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=240C113D3165071BE0440003BA7CC...

 

At the end of the "Initialize" VI there is this:

Kyle97330_1-1690501398427.png

That is the only place I can find that could possibly be clearing the VISA address and it should only happen on an error, not on a warning.  Are you sure it wasn't running in such a way that it got an error in the Initialize VI that could have cleared it?


There is an error reported in the error out.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 9
(1,238 Views)
Solution
Accepted by topic author wil2004

Thanks for all of your help!

My problem is solved yesterday.

The problem is that the serial port address is clear without any error or warning report.

But if the bulk(Highlight Execution) is turn on, the address can be passed though correctly.

 

After the post for help, I tried to seek the reason of the bug myself.

As whether the bulk is turned on is a factor of influence, I thought maybe the serial port timeout is wrongly set.

This can be the case: Without the bulk turned on, the program is run in a fast way. The program hasn't had a chance to receive the message, and VISA read has already timed out.

But with the bulk turned on, every step is run in a very slow way. The VISA read is able to receive the message before timeout.

 

wil2004_0-1690511463805.png

 

So I reset the Serial Port Timeout from 1000ms to 2000ms.

And this magically worked out.

wil2004_1-1690511493816.png

 

In fact, the 1000ms timeout is a very long time.

Most serial port is able to transmit message in such a long period, this device needs quite large time to read out which is unusual.

Also, whether the bulk is turned on should not change the timeout of the serial port.

I think this is a bug of LabVIEW 2016

 

@Kyle97330

This is ture. In the end of 'Initialize VI', there is a step that clear the adress of serial port and an error will be raised.

But without any error raised, the address is also clear.

I don't know how. But I don't see any other place that will clear the address.

I also believe it is the reason that clear the address, and I am still confused why there is no error.

I think this is another bug.

Since the program is successfully run after changing the timeout, I don't have to address why this bug happened.

 

 

 

 

0 Kudos
Message 6 of 9
(1,223 Views)

Maybe....

 

I thougt the bug may more likely be contributed to the LabVIEW.

 

All of these bugs drive me crazy.

 

0 Kudos
Message 7 of 9
(1,217 Views)

Thanks, the problem is solved.

You can check my supplementary for details.

 

0 Kudos
Message 8 of 9
(1,216 Views)

@wil2004 wrote:

Thanks for all of your help!

My problem is solved yesterday.

The problem is that the serial port address is clear without any error or warning report.

But if the bulk(Highlight Execution) is turn on, the address can be passed though correctly.

 

After the post for help, I tried to seek the reason of the bug myself.

As whether the bulk is turned on is a factor of influence, I thought maybe the serial port timeout is wrongly set.

This can be the case: Without the bulk turned on, the program is run in a fast way. The program hasn't had a chance to receive the message, and VISA read has already timed out.

But with the bulk turned on, every step is run in a very slow way. The VISA read is able to receive the message before timeout.

 

wil2004_0-1690511463805.png

 

So I reset the Serial Port Timeout from 1000ms to 2000ms.

And this magically worked out.

wil2004_1-1690511493816.png

 

In fact, the 1000ms timeout is a very long time.

Most serial port is able to transmit message in such a long period, this device needs quite large time to read out which is unusual.

Also, whether the bulk is turned on should not change the timeout of the serial port.

I think this is a bug of LabVIEW 2016

 

@Kyle97330

This is ture. In the end of 'Initialize VI', there is a step that clear the adress of serial port and an error will be raised.

But without any error raised, the address is also clear.

I don't know how. But I don't see any other place that will clear the address.

I also believe it is the reason that clear the address, and I am still confused why there is no error.

I think this is another bug.

Since the program is successfully run after changing the timeout, I don't have to address why this bug happened.

 

 

 

 


No, this isn't a bug in LabVIEW 2016.  Or any other version.  Most likely, whatever command you are sending the instrument takes time to process.

 

So you must be fairly new to programming, because the more experienced you are in programming, the less likely you are to blame the programming language, and the more you understand that it's the HARDWARE that's always at fault.  😄  (My attempt at humor.)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 9
(1,194 Views)