07-27-2023 02:48 AM
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.
This is the subVI called "Error Query.vi"
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
You can see the address is sucessfully passed. Otherwise(the Highlight Execution is not turned on), the address cannot be passed,
Be like
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.
Solved! Go to Solution.
07-27-2023 10:38 AM
This sounds like there is a miswire of some type. Can you post the code that is showing the issue?
07-27-2023 05:40 PM
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...
07-27-2023 06:45 PM
I think this is the driver set:
At the end of the "Initialize" VI there is this:
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?
07-27-2023 07:20 PM
@Kyle97330 wrote:
I think this is the driver set:
At the end of the "Initialize" VI there is this:
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.
07-27-2023 09:33 PM
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.
So I reset the Serial Port Timeout from 1000ms to 2000ms.
And this magically worked out.
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
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.
07-27-2023 09:42 PM
Maybe....
I thougt the bug may more likely be contributed to the LabVIEW.
All of these bugs drive me crazy.
07-27-2023 09:43 PM
Thanks, the problem is solved.
You can check my supplementary for details.
07-28-2023 02:35 AM
@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.
So I reset the Serial Port Timeout from 1000ms to 2000ms.
And this magically worked out.
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
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.)