Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Using VISA Task Wizard for Serial Comm in a VS C++ Project

I am designing some software ( C++ VS.Net 2003 using Measurement Studio Ent for VS.NET 2003) to communicate with a device via RS232 as well as controlling some measurement equipment to test the device I am communicating with.
 Using VISA is the perfect solution for me as I cam do RS232 and GPIB in one interface.
 I am using the VISA NS Task wizard to assist me with the RS232 portion and am having difficulty with the QUERY task. I can write a command to the device but am having difficulty getting the proper response  ( ASCII) back.
 I am trying to get a multiline response back from the device. I can only do this by specifying "No Termination Character" - But then I get a VISA timeout. It doesn't seem to let me do a Custom Termination Character
Help
0 Kudos
Message 1 of 2
(3,117 Views)

Hi,

I assume you are starting from an NI VISA Class Library template project. Is that correct? If so, you can configure the instrument session to have a different termination character than the line feed or new line characters. This will be on the "Select Instrument" step. Here on the Termination character drop-down, choose "<custom>". Type in the hex value of the termination character you expect. Here is a link to the Serial Quick Reference guide that has a ASCII mapping to hex and decimal values. (Any ASCII table should give you the hex value for the character.) For example, the termination character would appear in the Termination character box as \6B if I had the termination character of k.

If you have a multiline response, after the first "Query and Parse" you would need to have additional "Read and Parse" steps for each line after the first line. Otherwise instead of a "Query and Parse step", you could have a "Write", then as many "Read and Parse" steps as lines you need to read.

I hope this helps!

Regards,

Missy S.
Project Engineer
RoviSys
0 Kudos
Message 2 of 2
(3,097 Views)