Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 Communication problem with VISA

Hi everyone,

 

I have a problem with communication with an RS232 device with VISA. PC and device are connected with a third-party USB-to-serial converter. The RS232 device is controller of a temperature chamber and I would like to send and receive commands in order to control the chamber. First I used a basic I/O VI with VISA blocks (create, write and read). Although I send the same command each run, the controller sometimes responds correctly, sometimes returns a command error or gives no response (when controller does not respond the link LED does not blink).

 

I have tried to send commands with VISA test panel. Almost every command is responded correcty but some command errors, but all command have been received by the chamber. Then I checked almost every attribute tracked in NI I/O Trace with property node (from resource name to end modes) and changed some of them which are not equal, but VI does not run like Test Panel.

 

I have used the program given in the link below, which uses .NET for communication, then communication was successful without any problem.

http://www.labviewportal.eu/viewtopic.php?f=18&t=472

 

Any help would be appreciated to solve this problem.

 

Thanks,

 

 

--
bencizdim
0 Kudos
Message 1 of 27
(6,526 Views)

Hi bencizdim,

 

Can you give me a little more information on the USB-Serial Converter. The program that you used avoided the use of VISA. I have in the past seen unsupported USB-Serial Converters that have had similar behavior. Also, what is the rate that you are sending I/O from your controller? Is this behavior new or has it always been like this?

Ryan
Applications Engineer
National Instruments
0 Kudos
Message 2 of 27
(6,486 Views)

Hi Ryan-AE,

 

Thanks for your reply. This is "Prolific USB-to-Serial Comm Port" with drivers provided by the manufacturer. Serial port config: baud rate=9600, bits=8, parity=none, stop bits=1, flow control=none. I could not say anything about the history of device since this is the first time that I have used an USB-to-serial converter.

 

Interestingly, I have tried to use Instrument I/O Assistant then it responds to all commands without error up to now -but I don't like to work with Express VI's. I think there should be a very basic mistake when configuring serial port in the program (fyi, the program that does not work properly is "basic serial write and read.vi" in examples.)

--
bencizdim
0 Kudos
Message 3 of 27
(6,470 Views)

Do you think you could put your code up so I can take a look at it? I understand and agree that using an express VI limits what you can control. 

Ryan
Applications Engineer
National Instruments
0 Kudos
Message 4 of 27
(6,459 Views)

You have said that you can get the Instrument Assistant vi to work for your application but you do not want to use express vi's. You can right click on the working Instrument  assistant vi and open the front panel. That will convert it to a regular vi that you can edit and rename for your particular needs.

Now Using LabVIEW 2019SP1 and TestStand 2019
0 Kudos
Message 5 of 27
(6,448 Views)

Here is the block diagram of the program.

 

ps. I had a chance to use another computer with serial port on motherboard, then it works fine (like test panel via converter, with few command errors)

--
bencizdim
0 Kudos
Message 6 of 27
(6,429 Views)

@GovBob wrote:

You have said that you can get the Instrument Assistant vi to work for your application but you do not want to use express vi's. You can right click on the working Instrument  assistant vi and open the front panel. That will convert it to a regular vi that you can edit and rename for your particular needs.


 

Thanks, I'll look at it.

--
bencizdim
0 Kudos
Message 7 of 27
(6,428 Views)

Hi bencizdim,

 

We'll it looks like you are working with an the basic example for serial read and write from LabVIEW. Have you had any success with converting the Instrument I/O Assistant into its basic components? I like that idea. If you are still having problems can you discribe the instrument command error that you are receiving? Also the code that you are using that includes the express VI, can you send me what that set of code looks like? Is it the same as the example + the express VI or was anything else changed?

Ryan
Applications Engineer
National Instruments
0 Kudos
Message 8 of 27
(6,397 Views)

I have converted the ExpressVI to SubVI then block diagram given in attachments. This VI works exactly as the ExpressVI.

I have listed the differences in the new VI stands out from the VISA write/read VI:

  1. No serial configuration block, VISA session is created by a control (I think)
  2. Property node for selecting and enabling termination character
  3. VISA session of Read block does not connected after VISA Write
  4. While loop continues to read until all data in the buffer are collected

Then I modified the Basic serial and write.vi with these (by “copy-paste”ing) and in order to search for the effect of each change I put them in Diagram Disable structures. These are my experiences:

-          Enabling termination character, connecting VISA session in for read before write, defining timeout, even adding reading loop does not make any difference, i.e. problem still remains.

-          Removing configure serial block then adding the same control for VISA session makes most of the commands are sent but reasonable amount of them was not send - loop iterates until timeout. This is a new experience since recognized commands are significantly increased, but performance is not acceptable.

 

After modification the code looks like the created VI but I could not understand why it does not run like the source. I think it’s better not to use USB-serial converter for this application.

--
bencizdim
0 Kudos
Message 9 of 27
(6,375 Views)

That's interesting, I wish I could give you more information about what you have found. Unfortunately when using third party hardware it makes it more difficult to predict how a set up with behave. Will you be able to use th Instrument I/O assistant? How quickly are you trying to read and or write? The speed can effect the reliablilty, especially when using a USB to GPIB converter.

Ryan
Applications Engineer
National Instruments
0 Kudos
Message 10 of 27
(6,350 Views)