I have rebuilt my test station from win2000 up and I'm still experiencing the following issue. I've quarantined the problem though down to the following description.
I install all the NI software and then the NI hardware and everything goes good. I create an NIProject from the Ni App Wizard under VC6.0 and drop a CWDIO Control and a button in my dialog. I then call the CWDIO member variable m_digital and give my button an OnButton message to handle. Then I have the following code there.
(OnButton Function name and params)
{
static bool toggle;
if(toggle == 1)
{
m_digital.GetPorts().Item(CNiVariant(0)).GetLines().Item(CNiVariant(0)).SetValue(true);
toggle = 0;
}
else
{
m_digital.GetPorts().Item(CNiVariant(0)).GetLines().Item(CNiVariant(0)).SetValue (false);
toggle = 1;
}
}
I compile the program (let's call it DAQTest) and run it and everything works great. I then turn off the power to the computer and the PXI station. When I come back to windows I create a shortcut to DAQTest.exe in it's Release folder and place it on the desktop calling it "DAQ Test". If I run DAQ Test everything works fine. If, however, I load DAQTest.dsw and then go back to my shortcut and run DAQ Test from the desktop I get "Invalid Index" when I press the only button in my dialog.
Okay, I think that isolates the problem quite well.
I was wondering if the following might be of importance.
On my working test station I have 4 NI-DAQ devices. On my new fixture which is struggling I only have three. Well, check this out.
Working Fixture:
Device 1 -- PXI6704
Device 2 -- PXI6508
Device 3 -- PCI6110
Device 4 -- PCI6503
Non-Working Fixture:
Device 1 -- PXI6704
Device 2 -- PXI6508
Device 3 -- PCI6503
Device 4 -- Not present.
I thought it would be a lot easier to make my PCI6503 Device 4 so that I wouldn't have to change anything when I brought code over from the working fixture. Of course tests that require the PCI6110 can only be done on the working fixture. Anyway, so I change my devices as follows.
Non-Working Fixture:
Device 1 -- PXI6704
Device 2 -- PXI6508
Device 3 -- Not present.
Device 4 -- PCI6503.
This has always been the first thing I've done once everything is installed. It seems to work great and from within VC++ the devices show up just fine.
My question then is, are there any known issues involving changing of the default device number given by NI-DAQ? I really don't have to change it but you made it so easy that I did. After all, it does save me a step each code transfer. This is the kind of thing that could slip by you when you are trying to test out your code. I mean how many people are going to mess with this stuff? It seems pretty rare to me. Again everything seems to work fine except for the "Invalid Index" issue which results in me not being able to communicate with my devices. Once I remove my devices from windows device manager and restart and win2000 reinstalls my devices everything works again in the same order. I can run the shortcut DAQ Test but if I load DAQTest.dsw and run DAQ Test from the desktop I get "Invalid Index" when I press the only button in my dialog.
I'd like to have more information about what exactly occurs when I load a workspace file. As far as NI-DAQ goes anyway. Are the instrument connections set up again through MAX? It just seems strange that loading the file messes things up. I thought it was when I recompiled but that's not the case.
Thanks,
Grant
Grant M. Johnson
Project Engineer
LECO Corporation