"Simple" C NI-DAQmx programming

After days of comprehensive DAQmx C functions documentation parsing, I still cannot do a very basic acquisition task... I do not understand clearly how to set timing and trigger functions!
On a 200 kS/s PCI-6024E card, I would like to acquire signals on analog inputs "ai0" to "ai5" on every rising edge on port "pfi0/ai start" (ca. 50Hz). On every rising edge of "pfi0", I would like to convert the signal on port "ai0", then 5µs later on port "ai1", and so on up to port "ai5" where conversion should start 25µs later. And the whole process would run again 20ms later.
This should occur in a THREAD_PRIORITY_TIME_CRITICAL thread in my process. This thread would "idle" wait for each "pf0" rising edge and subsequent conversions with the "DA
QmxReadAnalogF64()" function.
Thanks for your help ;-)

NI-DAQmx installs examples in Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\. There are lots of simple example applications for various aspects of NI-DAQmx.
In your first post, you show examples of DAQmx calls. They aren't organized into code snippets, so I presume that in the real code you are checking the return error codes!
I also notice that at one point you have "/dev1/pf0". I bet you meant to type "/dev1/pfi0"
John Weeks
WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com

Similar Messages

  • "Simple" NI-DAQmx programming

    Using a NI-PCI 6024E card with NI-DAQmx and C, I would like to acquire sequentially (at 200kHz) a single sample on the "ai0" to "ai5" analog inputs on every rising edge of the "pfi0/ai start" input (driven by a signal at 50Hz)...
    What clock and timing to program for a task to do this simple thing?!

    Would you believe it? It is as simple as:
    DAQmxCHECK (DAQmxCfgSampClkTiming (hTask,
    "/dev1/pf0", 50, DAQmx_Val_Rising,
    DAQmx_Val_HWTimedSinglePoint, 2)
    Trigger is about triggering the TASK, not the acquisition. I completely missed this point :-(
    Perhaps I will like DAQmx after all...

  • Simple question (export netbeans program)

    i know it'll be simple but cant sort it can anyone help?
    Im using netbeans (IDE)...it compiles and runs my program fine. The problem is though i cant get it to work outside netbeans (eg, using j2sdk1.4.0 - java or javac)...all my classes are interlinked and all have package project.e; at the top (all in desktop/project/e)...I want to put it all on a floopy and have a bat file which says load - java progam_name...but it doesnt like it...any ideas?
    Thanks for your time&help
    Oly

    Are the classes in their packages, also on the floppy?
    Are the classes in a JAR? Are the packages in the JAR, too?
    Have you set the classpath in your BATCH-File?

  • How to make it simple on my complex program

    hi all, i create a program for my machine, its need 4 device that support rs-485 communication for 1 machine. i make a complex program for this project, my program now just for 1 machine, but for future i`ll make it for 12 machine (4 x 12 machine = 48 device) its will be 12x complex program, i want to make its a simple program by use subVI, the different for every machine is just on peripheral number of device (Serial Parameter)
    please help me how to made simple program by subVI, i try subVI on while loop its over than 28 connector, any idea ?
    i hope you understand what i mean. thanks~
    Attachments:
    MODBUS LIB Counter 2.vi ‏71 KB

    I would recommend to start learning LabVIEW a bit more. You should be able to build something which is scaleable.
    The question is not only about subVI usage, but many other things. For example you should learn how to create and program a state machine. Also, how to choose the right framework for your actual task.
    You can find tutorials here:
    https://decibel.ni.com/content/docs/DOC-40451
    If you have access to the Core1-2-3 online learning material, you could go through these...
    For your actual project:
    I think you should first create your own "driver" for your machine(s). Learn about Action Engines (AE), and you will see how to create an AE subVI which can perform the following actions on your machines:  "Initialize", "Read data", "Close resources", etc...The actual structure of the AE depends on several things, for example: do you need to init and use ALL the available machines with their 4 "ports" at the same time? Or you need to stop and re-initialize some of them during runtime? Etc...
    You can read very useful things about AEs here:
    http://forums.ni.com/t5/LabVIEW/Community-Nugget-4​-08-2007-Action-Engines/td-p/503801
    Also, it can be helpful to "Wrapping It Up" the AEs, see the above link...
    After you have an appropriate AE-set, you can start to work on the "sceleton", the framework of your project. You have to choose which way you wanna go? Simple state machine? Producer consumer with Queues + using Event structure? etc .......
    edit:
    " i try subVI on while loop its over than 28 connector, any idea ?"
    If I understand your problem here, then read about clusters. Specially about type definied clusters!

  • How to make it simple on my complex program (Modbus)

    hi all, i create a program for my machine, its need 4 device that support rs-485 communication for 1 machine. i make a complex program for this project, my program now just for 1 machine, but for future i`ll make it for 12 machine (4 x 12 machine = 48 device) its will be 12x complex program, i want to make its a simple program by use subVI, the different for every machine is just on peripheral number of device (Serial Parameter)
    please help me how to made simple program by subVI, i try subVI on while loop its over than 28 connector, any idea ?
    i hope you understand what i mean. thanks~
    Attachments:
    MODBUS LIB Counter 2.vi ‏71 KB

    Check out this tutorial from Berkeley. You need to identify what output and inputs you want available outside the subVI. Then wire those outputs and inputs on the connector pane on the front panel.
    http://ptolemy.eecs.berkeley.edu/eecs20/labs/LabVIEW_Tutorials_PDF/HowtoCreateaSub-VITutorial.pdf

  • Problem running a simple Hello World RMI Program

    I wrote a simple RMI application, consisting of a Server Interface, Server Implementation and a Client.
    Since the codes are really small, am pasting them here so that you could identify the problem if any, in the code.
    1. Server Interface......
    import java.rmi.* ;
    public interface HelloInterface extends java.rmi.Remote
         public void sayHello(String arg) throws RemoteException ;
    2. Server Implementation......
    import java.rmi.* ;
    import java.rmi.server.* ;
    public class HelloImpl extends UnicastRemoteObject implements HelloInterface
         public HelloImpl() throws RemoteException
              super() ;
         public void sayHello(String arg) throws RemoteException{
              try{
                   System.out.println("RMI Program : Hello "+arg) ;
              catch(Exception e){
                   e.printStackTrace() ;
                   //throw new java.rmi.UnexpectedException("undeclared checked exception", e);
         public static void main(String[] args) throws RemoteException
              try{
                   if( System.getSecurityManager() == null )
                        System.setSecurityManager( new RMISecurityManager() ) ;
                   HelloImpl impl = new HelloImpl() ;
                   Naming.bind("HelloService",impl) ;
                   System.out.println( "Service bound..." ) ;
              catch(Exception e){
                   e.printStackTrace() ;
                   //throw new java.rmi.UnexpectedException("undeclared checked exception", e);
    3. Client Code.
    import java.rmi.* ;
    import java.rmi.Naming.* ;
    class RMIClient
         public static void main(String[] args)
              try{
                   if(System.getSecurityManager()==null)
                        System.setSecurityManager( new RMISecurityManager() ) ;
                   HelloInterface helloInt = (HelloInterface) Naming.lookup("rmi://sand.cise.ufl.edu/HelloService") ;
                   helloInt.sayHello("Ranjit") ;
              catch(Exception e){
                   e.printStackTrace() ;
    I have double checked the classpaths and they all look fine..
    I have even unset the classpath from the shell which runs the rmiregistry..am still getting these errors..
    1. If i use the default java to run the application..this is the error that it spits..
    sand:24% java -Djava.security.policy=java.policy HelloImpl
    java.rmi.UnexpectedException: undeclared checked exception; nested exception is:
    java.lang.ClassNotFoundException: HelloImpl_Stub
    at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
    at java.rmi.Naming.bind(Naming.java:110)
    at HelloImpl.main(HelloImpl.java:28)
    Caused by: java.lang.ClassNotFoundException: HelloImpl_Stub
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:350)
    ... 3 more
    2. Using java from some other location..the error looks different...but in both cases it just gives errors :((
    sand:25% /usr/java1.2/bin/java -Djava.security.policy=java.policy HelloImpl
    java.rmi.UnexpectedException: undeclared checked exception; nested exception is:
    java.lang.ClassNotFoundException: HelloImpl_Stub
    java.lang.ClassNotFoundException: HelloImpl_Stub
    at java.lang.Throwable.fillInStackTrace(Native Method)
    at java.lang.Throwable.fillInStackTrace(Compiled Code)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Compiled Code)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:342)
    at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
    at java.rmi.Naming.bind(Naming.java:116)
    at HelloImpl.main(HelloImpl.java:28)
    I am embarking on a huge assignment but if am having problems getting started..
    Your help will be highly appreciated..
    thanx and regards
    Ranjit Iyer

    First of all you should be posting this Q in the RMI forum :)
    You are getting that error because your stub is not in your clients classpath (or u can say the compiler is not able to find it).
    Make sure that the file HelloImpl_Stub is in the client classpath/package.
    Regards
    Meka Toka

  • LabVIEW 8.2 can't work with DAQmx program written using LabVIEW8.0 ?

    My old LabVIEW program is using the DAQmx sub-vis  from folder: C:\Program Files\National Instruments\LabVIEW 8.0\vi.lib\DAQmx
    e.g. C:\Program Files\National Instruments\LabVIEW 8.0\vi.lib\DAQmx\create\channels.llb\DAQmx Create Channel (AI-Voltage-Basic).vi
    After I installed LabVIEW 8.2 and NIDAQ831.zip (~600MB), there isn't a folder called DAQmx in folder:
    C:\Program Files\National Instruments\LabVIEW 8.2\vi.lib\
    When I load my old program, it need I specify the location of, e.g. DAQmx Create Channel (AI-Voltage-Basic).vi,
    I copied DAQmx folder from \LabVIEW 8.0\vi.lib\ to \LabVIEW 8.2\vi.lib\
    After I copied the DAQmx folder, right click on "block diagram" under "measurement I/O" the folder "NI-DAQmx" comes out and I can pick all the vis inside "NI-DAQmx"
    However, all the vis are not executable.
    My old program find all the vis needed to load; however, the vis are not executable, e.g. DAQmx Create Channel (AI-Voltage-Basic).vi, please see the attachment.
    Anyone know how to solve this?  Thanks.
    ------- LabVIEW 2009, So Easy, Even a Therapist Can Do It -------
    Attachments:
    DAQmx_Error.JPG ‏97 KB

    You should make sure that in the installer options of DAQmx the support VI's for LV 8.2 are installed.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • Recompile simple c and c++ programs for Leopard in Terminal?

    Here is a really stupid question.
    I wrote some really simple programs in c and c++ and compiled them under Tiger about a year ago. Now they won't run in Leopard (I need to recompile using Terminal in Leopard). But I forgot how to do that.
    I know there're only about 3-4 simple steps. Please help me remember how to do this. This seems to be way too simple of a question to post in the Developer section.

    Post to the Unix forum under OS X Technologies. Also, peruse the developer forums there.

  • Simple text plain talk program - filterhappier - radiohead

    i was wondering if anyone knew if there was an online program where i could type in text and have the retro robotic voice read it out like on the old macs. i have a computer thus using windows so i doubt i can download the program though apple however if anyone knows of a website that will allow me to do this i would appreciate it. if you dont know what im talkign about, a similar program is used in the song filter happier by radiohead

    As far as I know it is still on the NEW macs. As for a PC app, I don't know. Probably. Do a google search for speech from text and see what comes up. Or you could just buy an old used Mac I see old G3s going for $100 or less here and there.

  • SImple Text I/O Program

    Morning,
    I have gotten a new assignment which requires me to right a Text I/O program and to copy it as well. We are required to copy it using Command Line parameters I believe. Replacing the string of the text file created and copying it to a new file. So far I have the class written to write and read the file but the copying of the file does not seem to work.
    Here is the code so far: import java.io.*;
    import java.util.*;
    public class WriteFile {
         public static void main (String []args)throws Exception {
              File text = new File("text.txt");
              if (text.exists()) {
                   System.out.println("File already exists " + text.exists());
                   System.exit(0);
              String [] array = {
                   "Josh Harper ",
                   "CS Student ",
                   "January 22 1986 "
              PrintWriter output = new PrintWriter(text);
              for (int i= 0; i<3; i++) {
              output.println(array);
              output.close();
    import java.io.*;
    import java.util.*;
    public class ReadFile {
         public static void main(String[] args) throws Exception {
              File text = new File("text.txt");
              Scanner input = new Scanner(text);
              while(input.hasNext()) {
                   String fname = input.next();
                   String lname = input.next();
                   String degree = input.next();
                   String student = input.next();
                   String month = input.next();
                   int date = input.nextInt();
                   int year = input.nextInt();
                   System.out.println(fname + " " + lname + "\n" + degree + " " + student + "\n" + month + " " + date + " " + year);
              input.close();
    import java.io.*;
    import java.util.*;
    public class CopyText {
         public static void main (String[] args) throws Exception {
              if (args.length != 4) {
                   System.out.println("Usage:java CopyText.java text.txt copy.txt PrintWriter PrintWriter");
                   System.exit(0);
              File sourcefile = new File(args[0]);
              if (!sourcefile.exists()) {
                   System.out.println("Source file " + args[0] + " does not exist");
                   System.exit(0);
              File copyfile = new File(args[1]);
              if (copyfile.exists()) {
                   System.out.println("The copy file " + args[1] + " already exists");
                   System.exit(0);
              Scanner input = new Scanner(sourcefile);
              PrintWriter output = new PrintWriter(copyfile);
              while(input.hasNext()) {
                   String s1 = input.nextLine();
                   String s2 = s1.replaceAll(args[2], args[3]);
                   output.println(s2);
              input.close();
              output.close();
    Any insight on how the code for copying text by passing through as a command-line argument will be much of a great help, the book we use is very vague and the professor explanation was hard to replicate while doing my own program
    Thanks in advance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hello,
    I'm not exactly sure of what your problem but if you just want to copy files, whether they are plain text or other, you can just use the good old method which copy byte by byte your file
    public static void copyFile(File in, File out) throws Exception {
        FileInputStream fis  = new FileInputStream(in);
        FileOutputStream fos = new FileOutputStream(out);
        try {
            byte[] buf = new byte[1024];
            int i = fis.read(buf);
            while (i  != -1) {
                fos.write(buf, 0, i);
                i = fis.read(buf);
        catch (Exception e) {
            throw e;
        finally {
            if (fis != null) fis.close();
            if (fos != null) fos.close();
      }You can also, if you want to go deeper, check at the java API for java.nio.channels for faster copy but I'm not a huge fan of it.

  • How to make a simple hello world c program in xcode???

    Hello..... I've learnt the basics of c programming recently, They use code blocks (ver 10.05) in my class. Im new to Xcode.. so please can you help me?

    Go to http://www.netbeans.org/
    You should find tutorials there.

  • Need help with a simple prime number output program

    ok, the teacher asked for a program to output the first 90 prime numbers and i have been able to do that so far. but now he is asking for the numbers to be printed in a grid of columns and rows. specifically 9 across and 10 down.
    im stumped. what should i do 0_o
    so far, this is my program:
    package primetest;
    public class Main {
    public static void main(String args[]){
    int num1,num2;
    int flag=0; //Checks to see if the number in question is prime or not
    for(num1=1;num1<=463;num1++)
    flag=0;
    for(num2=1;num2<num1;num2++) //Remove the num2<=num1 and let it be as shown
    if(((num1%num2)==0) & num2!=1) //Thus you can remove the third condition
    flag=1; //Flag set to indicate that the number is prime
    if(flag==0)
    System.out.println(num1);
    }

    Congratulations, your code compiles, runs, and appears to produce correct output. (I didn't check every result.) That's far more than most students manage.
    I'd recommend that you separate generating the values from printing them. Can you store primes in an array and then pass that array to another method that prints them out according to your assignment's requirements?
    The good news is that you've solved a good chunk of the problem already. You only have the printing to worry about.
    I'd improve on your class naming. Main? C'mon. How 'bout PrimeFinder or something with a bit more imagination. Names matter in programming. If you gave me this class I'd have to look at the source code to figure out what Main did, but PrimeFinder gives me a hint just from the name.
    Move that stuff out of the main() method and into one of its own. Maybe you can pass in the upper limit over which you want the method to search for primes and return an array of values.
    %

  • Simple but powerful tagging program for kde (like easytag)

    hello!
    i'm looking for a powerful but easy to use mp3 tagging program. actually i'm using easytag. but i want some kde/qt native one...
    here are my needs:
    - fill tags from filename
    - rename file from tags
    - edit multiple files simultaneously (set track number, album title, artist, delete tag entry)
    - id3v1/v2
    already tried kid3 and picard, but both are not fitting my needs. also amarok is not powerful enough.
    do you know one? please tell me...
    thx, iggy

    I maintain audiotag, which does all you ask for with a command line interface.
    Give it a try, and I'd love to hear your feedback if it doesn't work out for you at least

  • Simple type values retrieving in dynamic programming

    Hello,
    Can somebody help me to get the values of a simple type in dynamic programming. I am using the following code:
    wdcontext.currentcustomergraph().getgraphstyle().
    After the values selected in the drop-down, I am not able to get the selected value in dynamic code. Please help.
    Thanks,
    Sunita.

    Hello Vishwas,
    I already did everything what you mentioned. When I use this in WdDoModifyView( )
    wdContext.currentContextElement().getCustomerGraphStyles()
    I am not able to retrieve the values inside customerGraphStyles().
    Thanks,
    Sunita.

  • [Theory] A simple but hard question about OO programming

    I was in my first class of OO programming (4th year of computer engineering in Valencia) and the professor gave us homework.
    The homework was a simple question about OO programming (it is not about a specific language, though we are going to use Java in the practice sessions), we shall find an answer to it and discuss it in class the next day.
    The question was:
    "May classes also be objects?"
    which can be said as:
    "May classes be instances of an(other) classes?"
    I hope that you, archers, can enlighten me in this question

    tvale wrote:I believe an object is an instance of a class.
    Yup, that's true. Let's see... An object is an instance of a class, so we can have a lot of objects coming from one class.
    We can say an object is not a class because it has a state (think about a light, it has a state: on or off, but a class light is not on/off, because in a class we just describe the behavior that class should have.
    But what we're asking here is if a class can have a state. I think it may refer to static properties about the objects.

Maybe you are looking for