04-22-2025 02:39 PM
Since the CR/LF terminator always occurs in that order, if you really want to "accept" a CR-without-the-LF or an LF-without-the-CR (that would be really weird, and would certainly violate sensible parsing of ASCII strings, designed to be "human-readable"), you could certainly code to accept "naked" terminators (choose LF as the Terminator, and when you get it, look at the preceding character in the string, which should be CR, and if not, you've probably got "Bad ASCII").
But much simpler (and likely to work 99.999% of the time) is to choose the termination character of the "sending device" and use that when setting up VISA (and if they send CR/LF, use LF).
Bob Schor
04-22-2025 07:11 PM - edited 04-22-2025 07:23 PM
@RTSLVU wrote:
Trim Whitespace works both ways, so in reality it does not matter if you choose CR or LF as your termination character in VISA Serial Configure. As it will trim space, CR, LF characters off both ends of the string.
However if you use CR you'll never get the LF and it will be appended to the next message.
Edit: okay I see what you are getting at, but I still consider it improper to have the second half of the termination appear on the next message because it isn't part of the next message.