NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Threads in Real Time

Solved!
Go to solution

Hi Everyone

I'm currently trying to create a program in C++ which reads data from two NI9222 DAQ  cards. So far I've programmed the FPGA in LabView, got my .lvbitx file and C library and managed to create a basic program which reads the data from the FIFO and does absolutely nothing with it.

Currently, at high sample rates one core on the cRio 9068 is maxed out so I'll need to create a program on two separate threads.  One thread reads the FIFO and puts data into some buffer array and the other thread removes data from the buffer and performs whatever operation(s) I require- in this case all I'm trying to do is write data to a .wav file on an external drive.

Can anyone give me some advice on how to multi thread on the cRio with C++? I'm currently new to C++ programming, having done most of my work on Java so this is unfamiliar territory. Currently the very basic program I have put together to test threading gets the following error:

c:\program files\national instruments\eclipse\toolchain\gcc-4.4-arm\i386\bin\../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/include/c++/4.4.1/c++0x_warning.h:31: error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.


I don’t know how to or even if I can enable support for C++11? Anyone got advice on what I should be doing here?

Attached is a first unsuccessful stab at running the FIFO read function on a different thread.

Thanks for the help

0 Kudos
Message 1 of 5
(4,271 Views)
Solution
Accepted by jamie_mac

This forum thread should give you what you need: http://www.eclipse.org/forums/index.php/mv/msg/282618/787571/

Message 2 of 5
(3,456 Views)

Also, you may want to investigate using pthreads directly instead.

0 Kudos
Message 3 of 5
(3,456 Views)

Thanks Brad

For future reference here's a copy of the solution to get threads working with a minor alteration: 

  • Make a new C++ project (currently I have only tested "Empty Project -> Linux GCC". Others can verify on non-Linux platforms)
  • Default options for everything
  • Once created, right-click the project and go to "Properties"
  • C/C++ Build -> Settings -> Tool Settings -> Cross G++ Compiler (Originally GCC C++ Compiler) -> Miscellaneous ->  Other Flags. Put "-std=c++0x" at the end
  • C/C++ General -> Paths and Symbols -> Symbols -> GNU C++. Click "Add..." and paste "__GXX_EXPERIMENTAL_CXX0X__" into "Name" and leave "Value" blank.
  • Hit Apply, do whatever it asks you to do, then hit OK.
Message 4 of 5
(3,456 Views)
0 Kudos
Message 5 of 5
(3,456 Views)