LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

communication with 2 or more ethernet devices

I use Labwindows/CVI 7.1 and I want to communicate with 2 agn6700 PSUs via ethernet at the same time. When I communicate with each one individually (creating only one hanlder) I haven't any problem. But the program returns an error when I try to communicate at the same time (creating a different handler for each PSU). It seems to rise up a problem when I define 2 different handlers. The functions for initialization work just fine for both PSUs, but after the initialization of the second PSU I can't use any function of the first PSU-the program returns an error. I use the drivers agN67xx.c that I downloaded from NI site. I tried to connect another instrument, an OSC series 6000 ( I don't remember the exact model, but it supports TCP/IP connection) and I met the same problem!It is a little strange because these intruments work perfectly when the are used individually.I have an attachment with a few lines of my code to see what I mean. I wrote in comments what happens at each step.Has anyone met the same problem?
thank you
George


0 Kudos
Message 1 of 8
(4,582 Views)

Hi gkots,

So, it sounds like this behavior is the same, regardless of what two instruments/drivers you open handles to (the behavior isn't specific to the agN67xx.c driver), is that correct? Also, what exactly is the error that is returned when you try and do communication once two handles are opened?  Perhaps you could attach a screen shot of the error, or the error code and a brief description? 


Regards,
Anna M.
National Instruments
0 Kudos
Message 2 of 8
(4,521 Views)
Yes, the behaviour is the same regardless of what two instruments/drivers open. I attach two screenshots. The first one (error1) is the error that occurs when I run a function (it's marked with red color) of the fist PSU after the initialization of the second PSU. The second (error2) one is the exact point inside the code of agN67xx.c driver , where the program freezes!
I found out that the one way to make my program work right  is the initialization and closing of the handler before and after each function's running of the specific handler. However, it is time-consuming because there are 3 functions instead of one.

Message Edited by gkots on 06-21-2007 07:16 AM

Download All
0 Kudos
Message 3 of 8
(4,493 Views)

Hi gkots,

Sorry for the late reply.  This is unusual behavior if the two instruments you are using are independent resources.  For example, we might expect behavior like this (with the errors) if you were trying to control the same instrument from by opening two simultaneous references because the instrument wouldn't know what commands to follow.  What all instruments (& their respective drivers) have you observed with this behavior?  From your images, it looks like the error is thrown during a measurement (rather than the initialization of the instrument) - is this same command always the trigger for this error?

Sincerely,

Anna


Regards,
Anna M.
National Instruments
0 Kudos
Message 4 of 8
(4,371 Views)
The three devices that I used are the following:
1) Two N6700B MPS -Agilent- with the modules N6752A and N6746B (driver agN67xx.c)
2) One Oscilloscope DSO6032A -Agilent-, (driver ag5462xx.c)
I noticed that I can initialize only two devices and use the functions only for the last device! If I try to initialize three devices, the same error occurs (the initialization function of the third device returns error). It's too strange. The only combination that does not return error is the following one:
-initialization of first device
-usage of first device's functions (optional)
-initialization of second device
-usage of second device's functions only (optional)

Any other combination returns error, regardless of the type of the device and regardless of the type of the function!
0 Kudos
Message 5 of 8
(4,360 Views)

Hi gkots,

Have you seen this behavior on multiple computers?  Unfortunately I don't have access to this equipment to test the combination myself..  or, if you have another programming environment to determine whether that has any influence on the behavior.  Also, what versions of the instruments drivers and NI-VISA do you have installed?  We'll want to be sure you're working with the latest versions.


Regards,
Anna M.
National Instruments
0 Kudos
Message 6 of 8
(4,288 Views)
I found that the code (agN67xx.c, attached as error21.JPG in prev post) looks like bit strange, especially for viPrintf() call at LINE# 1415.
 
The viPrintf() call  includes "%d" in the format specifier, but the actual param whatfor being past is ViInt16.  As the C compiler for Win32 system treats %d param as int (same size as long), the given parameter shall not be of ViInt16 type.  To correctly format the 16bit integer with "%d", the param must be explicitly type-casted as int.  The wrong formatting on viPrintf() is likely causing the GP or Page Fault problem due to junk stack.
 
errStatus = viPrintf(instrumentHandle, "*SRE %d\n", (int)whatfor);
0 Kudos
Message 7 of 8
(4,263 Views)
I noticed that  I didn't use the latest version of NI-VISA. So I installed the version 4.2.1 and I solved the problem.
Thank you Anna for your advice!
0 Kudos
Message 8 of 8
(4,205 Views)