03-01-2019 04:47 AM
@RavensFan wrote: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.
I will also add that some instruments actually want 2 termination characters (Carriage Return AND a Line Feed). The VISA append can only add 1 character. So that is another argument that you should be handling your termination characters yourself.
03-01-2019 02:15 PM
All this good advice notwithstanding, the fact remains that this functionality is implemented for the VISA Serial communication (and is even the default there) but not for the VISA Ethernet communication. Similarly for the VISA GPIB communication, the end of message signal is asserted by default at the end of a write, with additional options to append a termination character (or even multiple characters). This inconsistency in the Ethernet implementation causes difficulty and confusion, as evidenced by the multiple unresolved threads discussing exactly this issue. I don't understand the objection to providing parallel and consistent (optional) functionality to both interfaces.
In the meantime, it looks as though I will use the workaround first suggested by Dennis_Knutson in the linked thread (replacing the library VISA Write VI with a home-baked version that works whatever interface is used to connect to the instrument), who -- it is worth noting -- was also confused by this inconsistent and poorly documented behaviour.
As an increasing number of instruments move towards Ethernet interfacing, this is going to become a recurring issue and source of frustration for those who don't follow the programming practices recommended above (probably because they've come through the LabVIEW defaults for serial communication).
03-01-2019 03:58 PM
I disagree. It is NOT the default for VISA Serial communication. You have to drop another property node and wire a True to it to Enable on Writes.
I don't know much about GPIB and what end of message signals it uses, but even you are saying that to append an termination character is "an additional option". That means it isn't appending it by default.
03-01-2019 05:42 PM
My apologies. You are quite right regarding the default for the write termination. My confusion arose from the read termination, which (I believe) is active by default. No wonder I always have trouble getting my serial comms working!
03-01-2019 06:02 PM
@RavensFan wrote:I don't know much about GPIB and what end of message signals it uses...
GPIB has an EOI line to signal the end of a message. But most instruments I used still wanted the termination character(s).
03-02-2019 01:22 AM - edited 03-02-2019 01:33 AM
The 488.2 standard mandates the use of the EOI line on the GPIB bus. Somewhere around the first half of 1990ies this became the default standard for new devices.
Older devices especially from HP insisted on using a termination character though, which is kind of funny considering that HP made the initial design of the HPIB bus, which later became the GPIB standard, and which contained the EOI line right from start already.
And while the Serial Port Initialization VI has read on termination character set to true on default this is a (convinient) utility function. The underlaying VISA session did at least in some distant past not automatically have this enabled for newly opened ASRL sessions.
And I’m with crossrulz on this: automatic termination character appending on write is a bad idea. All devices I have encountered which supported serial or ethernet connectivity did also support an optional termination character when communicating over GPIB so there was never a need to distinguish between the session type for the purpose of message termination, just append the termination characters to any message send, irrespective of the session type!
03-02-2019 03:16 AM
@rolfk wrote:
All devices I have encountered which supported serial or ethernet connectivity did also support an optional termination character when communicating over GPIB so there was never a need to distinguish between the session type for the purpose of message termination, just append the termination characters to any message send, irrespective of the session type!
Thank you for this helpful final remark. I had planned to try this next week in the hope it might be the case, and your comment gives me added optimism. Ultimately I'm trying to transition code from GPIB to Ethernet while maintaining compatibility, so it will certainly simplify my life if I can add in the termination characters universally as has been recommended here and still have it run via the GPIB interface, rather than having to code separately for each.
05-24-2024 02:45 AM
Any solution since than?
I do try with older LV and VISA (2019) and the write character is still not appended no matter what is the flag Send End En, Suppress End en, nor the protocol.
My problem is that I would like to use a bunch of instrument drivers (from Keysight) which are huge packages and it is a pain to manually replace all visa write-s to have a \n appended ...
Needless to say all of their drivers were tested with Visa 5 (probably from 2003 or something) and most probably only USB.
It's a pain that neither LV, neither Keysight (but not only them, it's a common issue with many instrument drivers) found a normal solution for TCPIP which works without being pushed to modify the driver vi's one by one ...
Needles to say that many of those instruments have a sort of bugged VXI implementation, if I use with VXI driver most of the time the instrument is not found or freezes in the VXI part ...
And we are in 2024 where TCPIP connected instruments is something common.
05-24-2024 06:06 AM - edited 05-24-2024 06:08 AM
The property to automatically change the termination indication on write is a ASRL class specific property.
The higher Message class based property "Send End Enable" only enables the End on Write processing that will enable whatever the according ASRL class property specified. For non-ASRL it only enables:
On GPIB, VXI, GPIB-VXI, TCP/IP Instr, and USB Instr sessions, if this property is set to TRUE, VISA includes the 488.2 defined end of message terminator.
Now it seems almost impossible to find any specific document that actually lists what this 488.2 defined end of message terminator actually is for the various instruments!
I know that for GPIB it is the <LF> + EOI but no idea what it is for the others.
So yes those drivers are basically GPIB and RS-232 compatible only! Back around 2000 and before that, it was not that crazy of a choice, although I told people already then to not rely on that feature but instead create the command strings with explicitly appended termination character.
A quite common response back then was: It works that way, so why bother!!
Pretty much all but the most obscure GPIB devices simply accept commands with a termination character too. Before the 488.2 standard was created, many HP devices actually required it, despite that the GPIB bus created by them had a specific EOI signal line for that purpose.
05-24-2024 06:17 AM
"Now it seems almost impossible to find any specific document that actually lists what this 488.2 defined end of message terminator actually is for the various instruments!"
I had the same issue. But never the less even if I switched it on, the plain TCPIP Visa raw socket does not appends anything (at least it is not visible in IO Trace).
My issue is if I download any Keysight driver from "official" NI page like:
https://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=818EC3FFD3E92482E04400144FB7D...
will not work unless I edit all the VI's needed and replace the Visa Write with custom one which adds that line feed if TCPIP is detected ...
Which is not fun because all drivers are full with direct visa write (no wrapper) all over the place ... Not to mention I would expect to not need code change if by any chance I need to switch to USB any of them (where the ASRL kicks in and probably works).
Ofc Keysight is no better either - they have newer drivers (sort of) based on their IO library - every driver is based on that, OFC if I install the latest library, their specific drivers will still say "please install library" and not proceeding with the install so the "latest" driver is useless as of now.
So I have now equipment worth 5-6 figures and the drivers are not working. Which means nobody checked them from years ago ...