I have two test fixtures that have different devices on them but I want to transfer my code back and forth when I can. Fixture A has a device 5 and fixture B doesn't. Once I use the property pages to set up the CWDIO control and give it a member variable all the calls to that member varaible work great. If the member variable is m_dio then m_dio.SetDevice(3) for example works great.
What I want to do though is only have device 5 on one station so I don't have to delete the control when I go from Fixture A to Fixture B. Right now I just change my #define FIXA to #define FIXB and recompile to switch fixtures. Well, everything works except for device 5 which is on FIXA and not FIXB. Well, the solution seems to be just don't
have a device 5 and only create one for use on FIXA.
I have the following in my .h.
CCWDIO m_diocontrol;
then in my *.cpp OnInit() I have:
m_diocontrol.SetDevice(5);
when I call
device = m_diocontrol.GetDevice();
device equals like 0x10003 or something and changes around which seems like it must not be getting assigned at all.
I have all the instruments working through MAX and like I mentioned before if I use the property pages of a dialog control I don't have a problem.
So, all this so I don't have to delete the control or recreate it each time I go between fixtures. Seems like I should be able to do it though.
Should I be trying more of a dynamic approach? I'm sure you can tell by my syntax that I'm more of a test engineer then a programmer. I appreciate your input.
Grant
ps. I should mention that device 5 is another PCI-6503 card. FIXA has 2 PCI-6503 cards and FIXB only has one so no device 5 for him. Since both have at least one PCI-6503
though all the files are installed for digital I/O.
Grant M. Johnson
Project Engineer
LECO Corporation