Connect C++ with DAQ: A Beginner's Guide

  • C/C++
  • Thread starter babistopher
  • Start date
  • Tags
    Connection
In summary, the author is trying to create a program that will take data collected by two separate DAQ cards and save them as either a text or spreadsheet file. However, they are not experienced in programming and do not even know where to begin. They contacted the manufacturers of the second card and they do not have a support library for C++. They then found information about the input datastream and were able to hack the code they got to play with the input stream. They also found an online resource that can help them.
  • #1
babistopher
15
0
I am supposed to write a program using C++ that will take data collected by two separate DAQ cards and save them as either a text or spreadsheet file. Now, I'm still new at C++ and I do not even know where to begin. How am I even supposed to make a connection between Visual Basics and the DAQ? Note that only one of them has a .dll file (the program for that one is already done) and there is still the one without the .dll. Thanks!
 
Technology news on Phys.org
  • #2
DAQ is usually associated with some sort of device and maybe a device driver. It sounds like you already have a VB dll solution for one - why not use VB simply on that one?

I do not see why C++ is a requirement, especially if you don't know it at all. All of this can be done less painfully in VB. Is this a class assignment?

Have you contacted the second card's vendor for a support library?
 
  • #3
Hey, thanks for the quick reply. This isn't for an assignment. I'm doing research at CSTAR and I was asked to see if I could figure out how to make the program I described above. Although I actually don't know anything about programming, I am happy that I at least have a chance to learn a little bit of it.

So to answer your questions: I did call the manufacturers of the second card and they don't have a support library for C++. Now, I just noticed something. I am using Wincom (through Matlab) and a .dll file popped up in the file. Could I use this file to create the program?

Also, you said that it could be more easily done in VB. Could you go a little bit more into that?
 
  • #4
Also, the program that is already done was made by another guy and I am trying to work backwards from what he has done. Unfortunately, I do not even know how he coded it. He made an MFC .exe file and I don't know how that came about. If you have an idea about how I could modify this program he's made then please let me know.
 
  • #5
No offense - unless you have a really good math background, learning to program by taking on that project is probably a very difficult assignment. Even with good math skills it will take you a long time to write something like that.

MFC= microsoft foundation classes which is part of VC++ v6.0. So the .exe is from C++ source.

From your first post, I thought you knew VB.

You best bet is to find code off the internet that does what most of what you need to do.
Do you know what the architecture and protocol of the card interface is - serial/parallel/usb/ethernet/prorietary?

Let's assume serial for an example -
goto a site like codeguru.com, planetsourcecode.com (these work for most protocols)

1. search for C++ code that accepts a data stream from a serial device, for serial it is a COM port. For ethernet it will be using a specific TCP/IP port number. Maybe you can use the last guy's C++ code - I dunno. Did he comment his code? Can you figure out what each function does?

2. go to the vendor's site (or look through their manual) and figure out what is going on with the input datastream. See if you can hack the code you got into playing with the input stream. It will specify things like 8bit parity, or which TCP/IP port to listen to.

And IMO, MFC obfuscates things a lot for a beginner. Is there no advanced programmer around you can get one-to-one help from?
 
  • #6
Believe me I have taken no offense whatsoever. I am a complete n00b at programming in general and I know it. I will look into what you said and it turns out that there may be a programmer here that can help me. Thanks a lot for you help.
 

1. How can I connect C++ with DAQ?

To connect C++ with DAQ, you will need to use a library or API that allows communication between the two. Some popular options include the NI-DAQmx library, the LabVIEW DAQmx driver, or the DAQFlex API. These tools provide functions or classes that can be used in your C++ code to communicate with the DAQ hardware.

2. What is the benefit of using C++ for DAQ?

C++ is a powerful and widely-used programming language that offers many benefits for DAQ applications. It allows for efficient and high-performance data processing, as well as the ability to easily integrate with other systems and devices. Additionally, C++ has a large community and a wealth of resources available, making it a popular choice for DAQ development.

3. Can I use C++ with any type of DAQ hardware?

Yes, you can use C++ with most types of DAQ hardware, as long as there is a compatible library or API available. It is always recommended to check the specifications and requirements of your specific DAQ device to ensure compatibility with your chosen programming language.

4. Are there any limitations when using C++ with DAQ?

There may be some limitations when using C++ with DAQ, depending on the specific hardware and library/API being used. For example, some libraries may only support certain types of data acquisition or have restrictions on the number of channels that can be used. It is important to thoroughly research and understand the capabilities and limitations of your chosen tools before beginning your project.

5. Is there a learning curve when using C++ for DAQ?

As with any programming language and new technology, there may be a learning curve when using C++ for DAQ. However, with the abundance of resources and community support available, it is possible to quickly grasp the basics and become proficient in using C++ for DAQ applications. It is recommended to start with smaller projects and gradually work your way up to more complex applications to gain a better understanding of the language and its capabilities.

Similar threads

  • Programming and Computer Science
Replies
1
Views
587
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
3
Replies
81
Views
5K
  • Programming and Computer Science
Replies
1
Views
267
  • Programming and Computer Science
Replies
5
Views
605
  • Programming and Computer Science
2
Replies
69
Views
4K
  • Programming and Computer Science
Replies
1
Views
977
  • Programming and Computer Science
Replies
2
Views
848
  • Programming and Computer Science
Replies
3
Views
1K
  • Computing and Technology
Replies
20
Views
686
Back
Top