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.
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
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
Thank you very much, this solved everything
Have a nice day