LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Ethernet TCPIP (Socket) Termination Character

Hello NI Team,

 

I'm currently developing a Plug'n'Play Instrument Driver. The driver should support the interfaces RS232 and Ethernet (TCPIP::SOCKET). I'm using the VISA pallett set.

What I want to reach: The VISA session should automatically append a line feed to every write operation for RS232 and Ethernet.

 

After reading some helpful comments I got stocked now.

1. http://www.ni.com/white-paper/4256/en

2. http://zone.ni.com/reference/en-XX/help/371361K-01/lvvisaprop/instr_3fff001c/

 

When I use the RS232 interface I can set a termination char for write and read operation's like that way:

Unbenannt.JPG

This communication works perfectly with the termination char "line feed". In write and read operations. The visa write perfectly append the line feed ("\n") to every command.

With that I would only demonstrate how it should work.

 

Now switching to the interface type TCPIP:

Unbenannt1.JPG

I can also set the property "Send End En" to True. This should normally append the 488.2 end of message terminator for TCPIP sessions.

 

I also choosed a "Serial-TCPIP-USB/488 Strings" IO Protocol for the instrument session.

 

But after an VISA write operation e. g. "*IDN?" the VSIA doesn't append the line feed (\n or HEX 0A). I used wireshark to trace the tcpip packets.

The line feed ("\n" or Hex 0A) is missing after the string.

 

I'm woundering about that behaviour, because 1. http://www.ni.com/white-paper/4256/en desribes that "Both incoming and outgoing messages can have termination characters." Beacuse I'm using TCPIP Socket connection ("You need to tell VISA how messages are terminated only when using other VISA resource types (Serial Instr, USB Raw, and TCPIP Socket).") I configured the IO Prot for 488 commands.

 

But this doesn't work probably. What else should be configured? 

 

Furthermore I found that the VISA Read STB and Trigger append the line feed. Why does the VISA Write doesn't make that?

 

This function append a line feed:

Unbenannt3.JPG

This funciton doesn't append the line feed:

Unbenannt4.JPG

 

Thanks a lot for your help

 

 

 

0 Kudos
Message 1 of 29
(8,679 Views)

Hi,

 

thank you for the great description. I haeve no idea why it doesn't work. Unfortunately i couldn't find any documentation about such an issue.

 

Did you try to hardcode the line feed?

 

*IDN?\n

0 Kudos
Message 2 of 29
(8,635 Views)

Hi Gregor,

 

Hardcoding the line feed might might be one more solution. Yes I tried that and it works satisfying.

 

But I woundered about the fact that a line feed could be set as termination for the serial interface, but not for an ethernet interface. And I use the same VISA components for communication... Does anyone of NI HQ America know that problematic?

 

Thanks a lot.

 

 

0 Kudos
Message 3 of 29
(8,622 Views)

Hi,

 

I'm sorry, i could not get any further information about this. Mayby you can go through these posts:

 

http://forums.ni.com/t5/LabVIEW/TCP-Read-with-custom-message-termination-symbol-LF-instead-of/td-p/2...

https://decibel.ni.com/content/docs/DOC-31512

 

I hope this helps

0 Kudos
Message 4 of 29
(8,569 Views)

Hi,

 

I am currently facing the same problem.

But, I do not want to manually append the LF ('\n') character, since I want to reuse some old code.

 

Did you manage to understand what the problem was?? Did you find out which setting can produce the desired outcome?

 

 

Regards,

Diogo Ribeiro

Diogo Ribeiro
0 Kudos
Message 5 of 29
(8,401 Views)

Hello,

 

I could not locate the problem of that behaviour. I made a workaround and hardcoded the /n (h0A) Linefeed into my code.

Maybe another member was faced with that problem? Im interested in any solution too.

 

Thanks!

0 Kudos
Message 6 of 29
(8,372 Views)
With a VXI-11 instrument, you don't have to specify anything. The cases for GPIB and Ethernet are identical. I'm not sure what the IO Protocol does but I would suggest removing it or setting it to a different value.
0 Kudos
Message 7 of 29
(8,360 Views)

I finally looked here after 3 day, this is still a problem...

VXI / LXI use EOI, thus the message terminiator is na; for "RAW SOCKET" the TCPIP is just a tranport for the rs232 message...

In my case the instrument does not support VXI / LXI, and this not inserting the termination on the write is a problem...

The following NI I/O Trace shows that even setting the "SEND_END" = True and "TERMCHAR" = 13, this does not happen...

Log shows being set, and tried twice with a clear buffer between each, then I added the "\r" as part of the message, which shows the device is happy...

Running Labview 2016 64bit f2, VISA 15.5, MAX 15.3...

 

RawSocketNoTermChar.png

 

copy for this message, sent to TDI to document this issue...

0 Kudos
Message 8 of 29
(7,790 Views)

I would like to resurrect this unresolved thread (and link it to the essentially same discussion here extending back to 2008). As far as I can tell (and as far as is expressed here), there is no way to get LabVIEW to append a termination character to serial communications taking place over a TCPIP SOCKET (non VXI-11) connection. The workarounds are for all commands to be manually appended with the necessary termination, or for the user to override the VISA Write VI. These workarounds have been in place for over a decade. This makes it difficult to write code that works with minimal modification on GPIB, serial and ethernet interfaces, which is supposed to be one of the great benefits of the VISA architecture.

 

Assuming this accurately summarises the situation, I would like to log this as a bug, unless it is by design in which case I would like to see an explanation here so it can be found by future Googlers. Can someone from NI please provide a CAR, or the appropriate explanation.

0 Kudos
Message 9 of 29
(5,929 Views)

@scwimbush wrote:

I would like to resurrect this unresolved thread (and link it to the essentially same discussion here extending back to 2008). As far as I can tell (and as far as is expressed here), there is no way to get LabVIEW to append a termination character to serial communications taking place over a TCPIP SOCKET (non VXI-11) connection. The workarounds are for all commands to be manually appended with the necessary termination, or for the user to override the VISA Write VI. These workarounds have been in place for over a decade. This makes it difficult to write code that works with minimal modification on GPIB, serial and ethernet interfaces, which is supposed to be one of the great benefits of the VISA architecture.

 

Assuming this accurately summarizes the situation, I would like to log this as a bug, unless it is by design in which case I would like to see an explanation here so it can be found by future Googlers. Can someone from NI please provide a CAR, or the appropriate explanation.


It is not a bug.  The proper situation is for the programmer to explicitly put the termination character at the end of the command if he needs one.  That is not a workaround.  If I'm sending anything by serial, or TCP/IP, I don't want VISA in the background adding any characters to the end of the message I send.  Perhaps what I send in one command is just the first part of a longer message.  If I want a character sent, I'll put it in there.  If I don't, I don't want one added automatically.

0 Kudos
Message 10 of 29
(5,924 Views)