‎01-19-2023 02:44 AM - edited ‎01-19-2023 02:45 AM
I just found out that the issue comes from the termination character.
In the datasheet, it is mentioned p.3-7 that queries are terminated with a carriage return and line feed (0x0D 0x0A).
For the writing part, it work fine using this kind of syntax "SOUR:CURR 10.0\n\r".
However, I have an issue with the reading part. If I know the amount of bit the request will send, it is working fine as well. But if the number of bits is unknown, and the value overshoot the number of bits in the output buffer, the query will timeout.
For example:
Reading 7 bits after a "MEAS:CURR?\n\r" query will work if the output buffer is "90.125", but will timeout if the output buffer is "115.234".
I know that one of the solution is to wait some type and query the number of bits at the port. But I need the fastest application.
As I understand the VISA library, I shouldn't have to add the termination character myself in the string but use the settings in the "VISA Configure Serial Port" VI. However the "termination char" input is a U8 datatype, so I cannot put "DA" or "13 10". And I believe if I manage to set this termination character the query will end by itself even if I ask more bits than needed.
Any idea of how I can solve that ?
‎01-19-2023 10:07 AM
Hi
The best you can do is to select the last char as termination char, so in your case the CR.
processing the data is normally not influenced by the remaining LF or you can use trim string to remove the LF afterwards.
And the second tip is not to forget to add the LF/CR to the send message. The termination char is as far as I know only checked in reading and not added in the send.
I mostly use a special version of the VISA send that adds the end characters in such cases. The timing overhead is completely nothing compared to the bus timing.
‎01-20-2023 03:59 AM
Hi,
Thank you very much, this solved everything
Have a nice day
‎08-13-2026 07:39 PM - edited ‎08-13-2026 07:51 PM
Here are the settings I found that worked. Refer to the attached screenshots. You'll find that it remains consistently functional, instead of erroring out after the first query.
The standard settings: 19200 baud, 8 data bits, 1 stop bit, no parity, no flow control, incoming termination character: CR (0x0D), outgoing termination characters: CR LF (0x0D 0x0A).
(Flow control is set to None, even though they specify that the RTS/CTS wires are to be connected in the cable wiring. Whatever, I don't write the rules. 🙄)
I found the SG Series Programming Manual (M550129-03 Rev M) page 3-3 more helpful than the DCS literature. Same protocol as used for the SGA/SGI/SGe power supplies' GPIB/RS-232 interface. The cable wiring diagram found there is also correct, and not ambiguous like the one in the DCS manual. (link to SG Programming document: https://www.programmablepower.com/products/dc-power-supplies/6e9fcb33-7372-42f7-921f-547d0521050f)
Keep in mind that you need to manually end all sent data with "\r\n". For example: "*IDN?\r\n".
Also note that I have my R/L configuration toggle set to Local. Contrary to popular wisdom. This leaves the device under the control of the front panel, unless GPIB/RS-232 communication is initiated, at which point the unit switches to Remote mode. Every time the power is cycled on/off, control defaults back to the front panel unless the GPIB/RS-232 link is active. This is the way I like it. Depending on your GPIB firmware version, behavior may be different with this setting.