LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Interfacing APS 7050 AC power supply to LabVIEW through Ethernet

Hello all,

 

I'm interfacing APS 7050 power supply with LabVIEW through Ethernet, but I'm not able to do it. On the APS 7050 power supply website they have drivers which can connect through serial, but I need to connect it with Ethernet and that drivers are not available with them. So, I'm using TCP/IP communication protocol from LabVIEW to interface. I have created one block diagram attached below in which TCP/IP open and writer operation is performing but Read operation is not working giving Error 56. I'm referring User manual and Program manual. They have provided some commands to control the power supply.  

0 Kudos
Message 1 of 13
(1,365 Views)

The very first problem which I see is your attempt to get 1024 bytes back:

Screenshot 2024-03-12 11.01.37.png

According to documentation the response to the command "*IDN?\n" will be 

GWINSTEK,APS-7050, GEXXXXXXX,XX.XX.XXXXXXXX

Which is the only 44 bytes. Try to read exact number of bytes returned back according to documentation (don't forget about termination char).

For the first attempt send "*IDN?\n" and try to read 17 bytes only (the rest will remain in TCP buffer) , you should get back string "GWINSTEK,APS-7050" Then increase amount of bytes to get full string. Do not do this in the cycle, for the very first experiment something like that shall be fully sufficient (later, once working, you can add polling cycle, of course):

Gwintek.png

0 Kudos
Message 2 of 13
(1,321 Views)

Hello Andrey_Dmitriev,

 

I have changed that bytes to read to 17, still I'm getting error and not able to get response. I have choosen Immediate mode.

ShanV_0-1710240193351.png

 

0 Kudos
Message 3 of 13
(1,309 Views)

I'm not sure about your port number. I have the only signal generator MFG-2230M in my hands.

 

This is how it works:

 

Screenshot 2024-03-12 12.14.04.png

Port number is 1026 in my case, can be obtained from Web interface:

 

Screenshot 2024-03-12 12.16.53.png

 

0 Kudos
Message 4 of 13
(1,298 Views)

Did you try following the instructions starting on page 37 in the manual to set up a VISA socket connection in NI-MAX?

 

https://www.gwinstek.com/en-global/products/downloadSeriesDownNew/8395/562

 

It is entirely possible that if you do so, you can use that VISA address to use the LabVIEW drivers you already have.

 

Also, with just the screenshot I strongly suspect that you are not sending the termination character on your *IDN? request properly.  Are you sending two characters, "\" and "n", or do you have "slash codes" turned on to be sure you are sending just one character, the invisible ASCII character for "new line"?

0 Kudos
Message 5 of 13
(1,262 Views)

Yes Kyle, I have followed that from the manual to check the connection and it seems ok. Thank you for the response. I'm able to communicate now with supply. the problem was TCP/IP port was not closing properly that is why it was giving me ERROR 56.

0 Kudos
Message 6 of 13
(1,246 Views)

Hey Andrey, thanks for the help, I'm now able to communicate with supply. basic commands are working such as IDN, measure cureent and voltage . But I want to set the voltage , current and frequency through LabVIEW and whatever the commands given in programming manual are not giving me output. I think I'm missing in syntax of command, can you please confirm once from your side. Please try for setting voltage, current and frequency by using their commands.

0 Kudos
Message 7 of 13
(1,245 Views)

@ShanV wrote:

Hey Andrey, thanks for the help, I'm now able to communicate with supply. basic commands are working such as IDN, measure cureent and voltage . But I want to set the voltage , current and frequency through LabVIEW and whatever the commands given in programming manual are not giving me output. I think I'm missing in syntax of command, can you please confirm once from your side. Please try for setting voltage, current and frequency by using their commands.


Here the snippet with functional code for my MFG-2230M (set Form, Freq and Amplitude only):

MFG-2230M.png

There are some "combined" commands available, where I can set all params in single command, but for me more convenient to set these separately.

It also perform query after set, but you should keep in mind, that the device need some time to set parameters, therefore immediate query will not work (I put 2 sec delays between set and get, not very elegant, but works). This is result:

Screenshot 2024-03-13 09.31.35.png

Hope it helps.

VI and spec for my device are attached.

 

Download All
0 Kudos
Message 8 of 13
(1,232 Views)

@Kyle97330 wrote:

Did you try following the instructions starting on page 37 in the manual to set up a VISA socket connection in NI-MAX?

 

https://www.gwinstek.com/en-global/products/downloadSeriesDownNew/8395/562

 

It is entirely possible that if you do so, you can use that VISA address to use the LabVIEW drivers you already have.

 


I was never ever able to set this for my device. At this point MAX gets "frozen" and not allow me to continue:

Screenshot 2024-03-13 09.40.21.png

Regardless if I pressed "Next >" or "Done" it stay on this dialog.

But technically its not much differences if I will communicate with device using VISA Alias or directly with TCP/IP functions. May be with VISA a little bit more convenient in term of termination char, etc (or may be VISA have some known devices, which is not my case), but TCP/IP also works if used accurately, there are just pure ASCII commands, nothing more.

0 Kudos
Message 9 of 13
(1,230 Views)

The idea to require to request exactly the right amount of bytes is a VERY brittle solution. If you happen to use a different instrument with a slightly different firmware version, this string can easily change (even just the firmware version number might have a different number of characters)!

 

So lets analyze the thing:

 

1) Right click on your IDN?\n string constant and select Visible Items->Display Style. What glyph does appear on the left border of the string constant? If this is not a \, you are not sending a line feed character but simply a backslash followed by an n. The device will simply think WTF, but not produce any response since it expects a line feed (or maybe carriage return or both) before it starts to act on the command.

 

2) The LabVIEW TCP Read function has various read modes, including terminating a read on carriage return + line feed,  but your device may not be able to set to return both these characters at the end of a response. So trying to reliably read from the device gets tricky. If you instead use VISA, you can configure the termination character on which a read should terminate and suddenly it does not matter if you specify to read 1000 characters on the VISA Read. It will return as soon as it sees the line feed character that your device is most likely returning on every response.

 

This should help with most of the trouble you seem to be having.

Rolf Kalbermatter
My Blog
0 Kudos
Message 10 of 13
(1,217 Views)