This property takes an unsigned 8-bit integer as an input. Therefore, unless you know the ASCII value for your termination character, it is best to typecast the value to set the property, as shown above. Use this property value as the termination character for both reads and writes. Setting this property value does not affect whether it is used.
Although TermChar is not restricted to serial communication, you may want to use other termination mechanisms when communicating on buses with a complete 488.2 protocol, as discussed in the introduction. For example, when communicating over GPIB, the standard is to use a hardware line—EOI—for termination.
Note: VISA Configure Serial Port.vi sets this property through the termination char parameter, which defaults to a Line Feed (0x0A = '\n' = LF).
If set to True, this property instructs VISA to stop reading when Termination Character is encountered. Notice that it is not restricted to serial; you can use this property for terminating reads on other buses.
Important: This property is ignored and does not return an error if Serial End Modes for Reads (discussed below) is set to Term Char.
This property does not affect the termination character for writes.
Note: VISA Configure Serial Port.vi sets this property through the Enable Termination Char parameter, which defaults to True.
This property specifies the method used to terminate a read operation from the software buffer for serial communication only. Valid values are:
Value
| Description
|
None (0) | The read does not stop when the termination character is encountered. |
Last Bit (1) | The read stops as soon as a character arrives with its last bit set. |
TermChar (2) (Default) | The read stops when the termination character is encountered. This is the default value. |
Important: If the value is set to TermChar (2), the Termination Character Enabled property value is ignored.
If the byte count (specified by VISA Read) or timeout (VISA property) is reached, the read terminates regardless of what value this property is set to.
This property can be disabled by setting the Suppress End Enabled (Suppress End En) property to true.
Note: VISA Configure Serial Port.vi sets this property to None if the Enable Termination Char input is set to F; it sets it to TermChar if the Enable Termination Char input is set to T.
This property specifies the method used to terminate write operations. Valid values are:
Value
| Description
|
None (0) (Default) | No termination character is appended to writes. |
Last Bit (1) | The write sends all but the last character with the highest bit clear and transmits the last character with the highest bit set. |
TermChar (2) | The value of Termination Character is appended to the end of all writes. |
Break (3) | A serial break is sent after each write. A serial break is a series of continuous space values often used to instruct an instrument either to stop the operation in progress or discard any data in the output butter. Use this method with caution. |
You may see older instrument drivers appending a termination character before the VISA Write. This was because older versions of VISA did not support this property, so users had to explicitly append termination characters. This is no longer necessary, as setting this property does it for you.
You can disable this property by setting the Send End Enabled (Send End En) property to false.
Note: VISA Configure Serial Port.vi does not set this property. You must set it through a property node, as shown in the figure above.
When performing ASCII communication, set your termination properties and other bus communication settings at the beginning of your application or driver initialization routine. Termination character settings must match your instrument configuration. Remember that some instruments have configurable settings. Consult the user manual for your particular instrument.
Recommendation: For more robust applications that may deal with multiple buses, always keep Termination Character Enabled and Serial End Modes for Reads in sync (that is, when you enable/disable one, set the other also).
When performing binary communication, the read can terminate prematurely if one binary data value has the same binary representation as the termination character. Therefore, disable the termination character by setting Termination Character Enabled to false and Serial End Modes for Reads to None (0), as shown below. You must rely on a different method of terminating the read, such as a hardware line or byte count.
Note: When using VISA resource types that correspond to a complete 488.2 protocol (GPIB Instr, VXI/GPIB-VXI Instr, USB Instr, and TCPIP Instr), because you generally do not need to enable termination characters in the first place, binary communication is easier because you do not need to worry about first disabling the termination character settings.
Some instruments send multiple termination characters such as Carriage Return Line Feed (codes display '\r\n' or ASCII hex 0x0D0A). Because VISA allows only one termination character, you must find an alternate solution. First, check if the instrument termination sequence is configurable. If not, you can set VISA to terminate on the last character and use Scan from String to parse out the other character(s) from the actual message. The following figure shows code that works for either '\r\n' or '\n' termination.
Note: In order to use this configuration the property Display Style must be set to Backslash ('\') Codes. For more information on Backslash ('\') Codes Display see Backslash ('\') Codes Display - LabVIEW Help.