From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Programming Challenge - NI-Spy Equivalent?

Hello :}

I'm writing C-based console applications under Windows NT and am trying
to find a more useful way of debugging them.

Specifically, I would like to find out the exact string being sent from
the console application to the VISA dll. This would probably be similar
to something that NI-SPY does. However, since the console application
is assembling the string on the fly (and therefore a lot of times %s is
sent), NI-SPY isn't very useful.

What I would like to be able to do is something like this:

// Partial C example

void main()
{
ViSession vis;
char buffer[256] = "\0";
char String1[256]="\0", String2[256]="\0", SendString[256]="\0";
ViUInt32 Count = 0;
.
.
.

sprintf(SendS
tring, "%s%s", String1, String2); // combine the
strings to send

StartSpy(/*whatever parameters are needed here*/);
/* StartSpy would alert whatever (dll? includes?) to start
recording what's being
sent to VISA. */

viWrite(vis, SendString, 256, &Count);

EndSpy(buffer, /*whatever other parameters are needed.*/);

/* buffer would then contain whatever was sent to VISA via viWrite.
It should have the exact same contents as SendString... but this
is
needed for more complex debugging purposes elsewhere. */

.
.
.

}

Any idea, leads, points-in-the-right-direction?

Thanks!

Scott
0 Kudos
Message 1 of 2
(4,490 Views)
In article <3819F684.88356B8A@hamsoft.com>,
scottr@hamsoft.com wrote:
> Hello :}
>
> I'm writing C-based console applications under Windows NT and am
> trying to find a more useful way of debugging them.
>
>
> Any idea, leads, points-in-the-right-direction?
>
> Thanks!
> Scott


Scott:

I am glad to hear that you are trying to use NI Spy for debugging your
app. I am sorry to hear that it's not helping you. It should work
just as well for a console app as from LabVIEW or CVI. It should also
certainly work completely correctly for viWrite. You mention your
program sends "%s" - do you really mean that the function call you are
using is viPrintf? Because with viPrintf we do have some shortcomings
in NI Spy currently. We will be working on that in the f
uture. One
possible workaround for now is to use viSPrintf (print to user buffer)
followed by viWrite of that data. That should allow you to spy on the
formatted data returned by viSPrintf and sent to viWrite.

If you have further problems, feel free to contact me directly with a
larger code snippet and perhaps even a .spy file with what NI Spy is
actually seeing.

Dan Mondrik
Senior Software Engineer, VISA/VXI
National Instruments


Sent via Deja.com http://www.deja.com/
Before you buy.
0 Kudos
Message 2 of 2
(4,490 Views)