Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Sorensen DCS Power Supply RS232

Solved!
Go to solution

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 ?

 

0 Kudos
Message 11 of 13
(384 Views)
Solution
Accepted by topic author GR_JJC

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.

greetings from the Netherlands
Message 12 of 13
(369 Views)

Hi,

 

Thank you very much, this solved everything

 

Have a nice day

0 Kudos
Message 13 of 13
(349 Views)