Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

What's the easiest way to control instruments out of Visual C++?

"Invalid Index" occurs when I try and output to a port I have listed as "Unused" in the DIO property sheet. Oops.

Grant
Grant M. Johnson
Project Engineer
LECO Corporation
0 Kudos
Message 13 of 15
(1,684 Views)
Grant,
I just realized that I posted an answer that dealt with the digital sigle write instead of the analog single write you were referring to! Sorry about that 🙂
I think Chris answered your original question already so I'll leave it at that.
Regards,
Azucena
0 Kudos
Message 11 of 15
(1,684 Views)
No problem at all. Your answer saved me my next question which was going to be how to do a SingleRead using DIO. You're a mind reader! What are you doing programming? 🙂

Grant
Grant M. Johnson
Project Engineer
LECO Corporation
0 Kudos
Message 14 of 15
(1,684 Views)
The NI-6704 is a data acquisition card, NOT an instrument. Instrument control (VISA, IVI) is for controlling external instruments over GPIB, serial, ethernet, etc. It can also be used with our computer-based instrument boards such as our NI-Scopes, NI-DMMs (NI-4060), etc. For data acquisition boards, you would program them through the NI-DAQ driver software.

We don't have a native C++ API for NI-DAQ yet, but it is in work. You have two API options to program NI-DAQ in Visual C++. Option 1: NI-DAQ C-style API. This is a low-level C API that is included with NI-DAQ that can be used in Visual C++. There are examples for this API under \Program Files\National Instruments\NI-DAQ\examples\VisualC.

The second option, and the one I would recommend
, is the ActiveX control API. You mentioned this above. There is a set of ActiveX controls provided to control NI-DAQ hardware (CWAI, CWAO, etc.) This API works well in MFC applications because it is event driven and VC++ creates VC++ wrapper classes that can be used. Also, the control have detailed propery pages that save a ton of programming time. There is slightly more overhead in the ActiveX API, but it is usually negligible. I attached an MStudio 6.0 example that uses the CWAO control to do analog output as you would with the 6704. If you have further questions on programming DAQ, our support engineers can help at http://www.ni.com/ask.

Best Regards,

Chris Matthews
National Instruments
Message 3 of 15
(1,986 Views)
I have been trying to find some true C++ examples using DAQ for a digital I/O card, without much success. (I did find some Visual C examples, but that is not much help for C++) I have not opened these examples yet, but they look encouraging. At least they are C++, not C as was the last example I downloaded after doing a search in Measurement Studio C++.
I don't understand why these examples didn't show up with some of the C++ searches I was doing, trying to find examples to help me use my 6503 card. I am virtually new to using C++, and completely new to using C++ for developing test applications, and also new to using DAQ. This discussion thread is a real gold mine for me.
0 Kudos
Message 15 of 15
(1,684 Views)