Switch Hardware and Software

cancel
Showing results for 
Search instead for 
Did you mean: 

niSwitch_Init error

Solved!
Go to solution
Yes that is the resource descriptors that I use.
0 Kudos
Message 11 of 20
(5,570 Views)

Hey Guy,

 

Can you post the code you're experiencing these issues with?  Thanks!

-John Sullivan
Problem Solver
0 Kudos
Message 12 of 20
(5,567 Views)

#include <iostream> using namespace std; #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <visa.h> #include "niswitch.h" void main() { ViStatus vifxn_stat; ViSession rly_s = VI_NULL; ViRsrc rly_rsrc="rly2567"; vifxn_stat = VI_SUCCESS; vifxn_stat = niSwitch_init(rly_rsrc,VI_TRUE,VI_TRUE,&rly_s); cout << "niSwitch return status = " << hex << vifxn_stat << endl; return; }

0 Kudos
Message 13 of 20
(5,562 Views)

Hey Guy,

 

Apologies you're having trouble getting this system up and running.  What you have should work, but let's try running the following code (which uses a different device syntax):

 

 

#include <iostream> using namespace std; #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <visa.h> #include "niswitch.h" void main() { ViStatus vifxn_stat; ViSession rly_s = VI_NULL; ViRsrc rly_rsrc="rly2567"; vifxn_stat = VI_SUCCESS; vifxn_stat = niSwitch_init(PXI1::4,VI_TRUE,VI_TRUE,&rly_s); cout << "niSwitch return status = " << hex << vifxn_stat << endl; return; }

 

If this doesn't work, let's shut down the chassis, remove and swap the cards and then reboot.  Placing the cards in a new slot will force the driver to reload the modules.  If, for some reason, the modules were not properly loaded before, this would resolve that issue.

 

Let us know what you find.

 

 

 

-John Sullivan
Problem Solver
0 Kudos
Message 14 of 20
(5,523 Views)

Guy,

can you also please throw in a call to niSwitch_GetError() in there? You can pass VI_NULL for the session, as it is Init function that failed and there is no session? You can cout<< the returned buffer. Please allocate char buf[1024]; and call niSwitch_GetError(0, &vifxn_stat, 1024, buf);

 

You'll also need to put quotes around the "PXI1::4" but you've figured that one out I'm sure. 

 

Another thing to try: running NI Spy while trying your program. It may offer additional information about the error.

 

0 Kudos
Message 15 of 20
(5,515 Views)

So I have two PXI Switch cards (PXI-2567 named to "rly2567" and PXI-2568 named to "scan2568"), so I took out 2567 from slot 4 and placed it into a slot 6.  I first tried the "PXI1Slot6", the default name, and I got no errors.  (return status of 0)  I then renamed it to "rly2567" and it returned no errors.  Which suggested John S. theory of modules not properly loaded might be correct. 

 

So I took out the the other PXI card (2568) from slot 3 and placed it in slot 4 (slot 4 was where 2567 was originally).  For the 2568, the default name "PXI1Slot4" worked but I got an error when I changed the name to "scan2568".  So I took out 2567 from slot 6 and placed 2568 in slot 6 and placed 2567 in slot 3.  As usual the defualt name, "PXI1Slot6", worked but the name "scan2568" did not work.  So then I realized that the only time cards seem to not work is when I use the names "scan2568" or "rly2567".  Except for the 2567 card when I place it in any other slot other than slot 4 this name seems to work.  So I'm not sure why this might be.

 

If I use a different name then both cards work in any slot.  I understand the solution seems to be to simply use a different name but, I would like to know why this is?  Is there something in MAX that needs to be done to completely remove these names from the system?

 

Srdan...since I have not tried using the niSwitch_GetError function nor did I try NI SPY yet.  If you feel these are still necessary and may help answer my above question I can try them out to see if I get additional information.

0 Kudos
Message 16 of 20
(5,492 Views)