Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA sending command thru Ethernet

Hi
I am using VISA library to communicate with an instrument thru ethernet. I wonder if viPrintf blocks itself until it's done sending all strings in a command, and if viQueryf also blocks itself until it's done receiving all strings in the reply message.
I use VISA library version 4.1 and I get an intermittent error when I send command to a signal generator. The error was something like "SignalGenerator.exe has encountered an problem and needs to close. We are sorry for the inconvenience."  and SignalGenerator.exe hangs. (SignalGenerator.exe is the program I wrote using VISA library. Have you ever had that problem before?
 
I also wonder if I have viPrintf then followed by viQueryf, is a good practice to put a delay after viPrintf (before viQueryf) ? and if I have viPrintf followed by viPrintf, should I put a delay in between? Please bare in mind that I use ethernet, not GPIB. If you think I should put a delay, how many ms of delay should it be?
 
Thanks
0 Kudos
Message 1 of 7
(7,998 Views)
Hello L_K:

Is there an error code with this issue or was it a Windows error?
Regards,

Roland A.
Applications Engineer
National Instruments

Check out VI Roadshow
0 Kudos
Message 2 of 7
(7,979 Views)

Here's the screen capture of the error. I think the error code is 0x0005.

Is this an error with visa32.dll version? or could it be something from my code that I didn't set something right?

Thanks

0 Kudos
Message 3 of 7
(7,971 Views)
It looks like a GP Fault or Page Fault error is generated from inside visa32.dll.  As you say you use viPrintf, viScanf, and viQueryf, application codes may be possibly mis-coded especially for the format specifiers such as "%d", "%s", etc...   I recommend you to check if there is no mis-coding regarding printf-style formatters and their corresponding params.  If they are unmatched, the printf-family function may easily generate a junk stack error, causing the app to generate GP or Page Fault.
0 Kudos
Message 4 of 7
(7,947 Views)
I still can't fix this problem 😞
however, I find the last place where this error occurs though..
the command viOpenDefaultRM was called before I got this error. Do you see any possible cause of error?

m_viDefaultSession = NULL;

status = viOpenDefaultRM (&m_viDefaultSession);

Thanks

0 Kudos
Message 5 of 7
(7,865 Views)
In order to help, we're going to have to get more information.  Are you running an executable?  Do you have access to the source code?  What drivers are you using?  What versions?  What is your code doing?

Thanks!

Meghan
Applications Engineer
National Instruments
0 Kudos
Message 6 of 7
(7,830 Views)

Hi

Please see my answer in italics below

by the way, is GPIB more reliable than Ethernet? (basically I just want the instrument to perform according to the command I send to it without any errors)

thanks

In order to help, we're going to have to get more information.  Are you running an executable? 

yes. I am running executable. Single-threaded.

 Do you have access to the source code? 

Yes, please see the attachment.

 What drivers are you using? 

NI Visa 4.10 for windows. I have WindowsXP. Do I need any special patch from Microsoft to run NI Visa properly?

 What versions? 

What is your code doing?

My code controls Anritsu MG3700A Signal generator (eg sending commands to it to output signal, change frequency,...)

 

0 Kudos
Message 7 of 7
(7,823 Views)