03-02-2010 04:12 PM
03-02-2010 04:47 PM
Hey Guy,
Can you post the code you're experiencing these issues with? Thanks!
03-02-2010 05:18 PM
#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; }
03-05-2010 12:18 PM
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.
03-05-2010 02:54 PM
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.
03-08-2010 07:15 PM
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.
03-09-2010 11:23 AM
Guy,
those (NI Spy and/or niSwitch_GetError function) traditionally give you better error description including elaboration that may give you and us more info about the problems you're encountering and may shorten the support time.
Now, for the specific names causing trouble, it may be caused by other ways to access the driver. One is VISA aliases. If you have created a VISA alias for something with the name you use, that may cause the trouble you have. Another place where you may get diverted is IVI configuration. If you have created a logical name with the same name, that too will take precedence over DAQmx name.
Both of these configurations can be found in max.
let us know if you've found something!
03-09-2010 05:37 PM - edited 03-09-2010 05:42 PM
03-10-2010 07:19 AM
Did you enable logging to file when using niSpy or did you just save your log to file with Save As... If you enable logging in Spy options, we are able to get more information here at NI. Also choose niSwitch and NI_VISA as APIs you want to spy on.
TO get VISA Aliases, in MAX, go to Tools>>NI-VISA>>VISA Options, and then in the right-side pane select General settings>>Aliases. Check the list to see if there are any rly2567 names or such. Delete any if there are.
03-10-2010 10:55 AM