Processing counter input into an analog output

Greetings to all --
I've set up a PCI6070E card to do digital input through its "counter 0" channel and output through its "AO 0" channel.
I'm brand-new to Labview, however, and having trouble figuring out how to design my program.  In short, this is what I want to do:
1. Count the number of pulses, let's call it P, that arrive at the counter in a given time increment.  (Ideally, this time will be adjustable from 1 microsec to 1 sec.  In reality, I may have to settle for some number of milliseconds or more, as Labview doesn't seem to like to do loops at more than 1khz.  But that's an issue for another day.)
2. Perfrom a mathematical operation to turn P number of counts into some number N between -10 and 10
3. Set the analog output to read N volts
4. Reset counter to zero and start over at (1.) again.
I can make labview count pulses in, and I can send voltage signals out, and I can use the front panel to get the inputs I need from the user for the mathematical operation,  However, I'm having trouble with counting how mant pulses hit in a given time increment, and then resetting my digital counter to zero.
Can anyone point me at the right function names or help files, or suggest a rough program flow?  I appreciate it.
Chad
[email protected]

Chad,
The only way you can perform this type of operation with your device is in software.  See the knowledge base entries below for more details. 
HW resetting Counter on an STC Device:
http://digital.ni.com/public.nsf/websearch/55AF6CA​DD87F6F7786256B89005B8AFD?OpenDocument
How To Reset in Software:
http://ae.natinst.com/operations/ae/public.nsf/web​/searchinternal/65e3dbc715998c3286256e900075b7f8?O​...
Regards,
L. Allen

Similar Messages

  • Turn mic input into another speaker output on G60-235DX?

    On other computers I have had, I could turn the mic input into a second headphone/speaker jack but I do not know how to do it with this laptop and I'm new to Vista as well. On page 5 of the Notebook Tour User Guide located here it says "This table describes factory settings. For information about changing factory settings, refer to the user guides located in Help and Support." but I just do not know what "Help and Support" it is referring to exactly. When I am on the G60-235DX page and I click a link in the "Support for this product" box in the lower right, I can never seem to chase down any info on this subject. I have periodically done a search and then given up and now I realize I am just not going to be able to do it without bothering someone else for the answer. Thanks for any help!

    See my answer to the other thread you opened. When you do that, you have a double conversion (first D/A, then A/D - though I don't know what actually happens when you use a capturing software like AudioHijack), you might create a hum etc.

  • Route multiple 6602 counter inputs to one counter output...

    Hi!
    I´d like to route 4 different ttl signals, that are read by 4 different counter inputs to one single output channel (e.g. the output of one of the counters used) using pulse train generation with a divider of 4. Note that only one of the four inputs is active at the same time, to prevent overlay.
    How can I do that with Traditional-DAQ?
    Setup would look like this on the SCB-68
    TTL1 ----o in0 (ct0)----o out0 TTL(1..4)/4 [Hz]
    |
    TTL2 ----o in1 -- (output of ct2 is redirected ro ct1)
    |
    TTL3 ----o in2 --
    |
    TTL4 ----o in3 (ct3)--
    May it be better to just output each counter input signal at it´s own output and connect these outputs to one free I/O-pin hardwired?
    Best regards
    Zorniki

    In the end I configured a counter for Pulse Train generation and opted to change the duty cycle and frequency via 'DAQmxWriteCtrFreqScalar" (i.e. Pulse Width Modulation)
    I registered a callback for the 'DAQmx_Val_CounterOutputEvent' and then changed the dutycycle and frequency in that callback. 
    Unfortunately, I kept getting  "The pulse generation with previous property settings must complete a
    full cycle before the property can be updated." error messages and, opon further reading, managed to find a doc where National Instruments suggest adding a 'Wait(period)' before executing the 'DAQmxWriteCtrFreqScalar' call.
    The problem with this solution is that it one has to wait a minimum of 2 Periods before the Pulse Train can be modified which is not acceptable for our work.
    So is there an alternative solution which allows us to change the Pulse Train after only 1 Period ? Is there an event we can trap which allows us alter the Pulse Train after every period ? I'm sure PWM must be possible on Daq cards (PCI-6602 or PCI-6281 or PCI-6259)?
    Cheers, Shaun.

  • How do I configure 128 channels of DIO and 128 channels of Analog output with the availabili​ty of 3 pci slots

    I have only 3 slots of PCI or 4 slots of ISA bus, I want to configure with the minimum possible modules to attain 128 channels of DIO and 128 channels of analog output. This is inturn fed to the PCM (Pulse code Modulator). The cards will be placed in industrial PC.

    Associate Engineer-Marketing,
    Using just those 3 PCI slots you're not going to be able to get the 128 analog output channels. You will probably want to go either the MXI-3 (PCI bus extender) to a PXI chassis or E Series DAQ card to a SCXI chassis for such a high channel count system. Which analog output cards and which digital I/O cards you will want depends on your application. You will have to decide whether you will need static or dynamic analog output as well as whether you need clocked digital I/O or not. I highly recommend contacting our internal sales department at 1-800-433-3488. They are great at helping specify systems.
    Ames
    Applications Engineering
    National Instruments

  • NI board with 4 analog output

    Hello,
    I'm looking for the cheapest national instrument with this specifications:
    Ethernet communication
    1 channel Analog input
    1 Digital input
    4 channel Analog output
    All I found was the Ni sbrio board but the problem that I don't need 80% for its features.
    Thank you for your help

    Hi,
    Before recommending a particular product, it would be beneficial to understand some the requirements you need for the analog inputs, analog outputs, and digital inputs. What signals are you reading and how fast do you need to sample the signals? Also, what is the general application? Are you going to be logging data or providing control?
    Answering the above questions will help us better determine the correct device for your application.
    Tannerite
    National Instruments

  • Synchronizing Analog Output to Counter Input

    Hi!
    I'm really new to LabView. Pls help!
    I'm trying to obtain a set of stimulus signal and response signal from my motor for system identification.
    The stimulus signal will be generated by the Ao0 channel and response signal (quad encoder linear position) will be read into counter0.
    How can I synchronize the stimulus signal and response signal so that the sampling (n samples) for both stimulus and response starts at the same time?
    e.g.
    t=0, stimulus sample 1, response sample 1
    t=1, stimulus sample 2, response sample 2
    t=2000, stimulus sample 2000, response sample 2000 
    I've attached my VI.
    Thanks. 
    Regards,
    Student
    Attachments:
    Acquiring Linear Encoder Samples.vi ‏44 KB

    Hello Htp,
    What do you mean by synchronize? Do you want to start the analog and counter outputs at the same time? If you do, you should have both outputs start with the same digital trigger. For the analog output, you can set up the triggering in the DAQ Assistant in the Task Triggering tab. For the counter output, look at Gen Dig Pulse Train-Continuous-Dig Start.vi found in the Example Finder (Help Menu>>Find Examples). Browse Hardware Input and Output>>DAQmx>>Generating Digital Pulses. Please let me know if you have any questions. Have a great day!
    Sincerely,
    Marni S.

  • When using the analog inputs and analog outputs of the PCI-7344, what is the conversion between the voltage entering the card to counts? Similarly, what is the conversion between counts to voltage at the output of the card?

    I am using the PCI-7344 to control my system. The analog inputs are connected to the output of my system while the analog outputs serve as feedback to the system. The system is a servo. I want to know what is the conversion between the voltage read at the input, to card counts, and finally to the voltage output to the system.

    Carole,
    If you are trying to do analog feedback with a servo motor, Chapter 14 of the manual talks about how to set up the torque feedback. Also linked below is a LabVIEW example of analog feedback.
    Chapter 14
    NI-Motion User Manual
    Automatic Analog Feedback with FlexMotion example
    A. Talley
    National Instruments

  • Counter Output/Counter Input PXI Signals Behaving Erratically

    Question for all your LabVIEW guru's out there,
    I am running a frequency loopback test using the NI PXI 6229 MIO DAQ card.  I am generating a "Counter Output" pulse train signal which feeds through my device under test and then back out of my device under test and back into the PXI 6229 for a "Counter Input" frequency measurement.  Both the "Counter Output" and the "Counter Input" are assigned different PFI lines using DAQmx in LabVIEW.
    I have 4 lines to test on my DUT.  All four lines run this same frequency measurement but with different PFI lines on the PXI 6229.  Each line is test independently.
    This is my setup for the 4 lines:
    Path 1: P2.0 (Counter Output - Pulse Train) -> DUT (Device Under Test) -> P2.1 (Counter Input - Frequency Measurement)
    Path 2: P2.2 (Counter Output - Pulse Train) -> DUT (Device Under Test) -> P2.3 (Counter Input - Frequency Measurement)
    Path 3: P2.4 (Counter Output - Pulse Train) -> DUT (Device Under Test) -> P2.5 (Counter Input - Frequency Measurement)
    Path 4: P2.6 (Counter Output - Pulse Train) -> DUT (Device Under Test) -> P2.7 (Counter Input - Frequency Measurement)
    where:
    P2.0 = PFI8
    P2.1 = PFI9
    P2.2 = PFI10
    P2.3 = PFI11
    P2.4 = PFI12
    P2.5 = PFI13
    P2.6 = PFI14
    P2.7 = PFI15
    I have a LabVIEW VI which generates the "Counter Output" and reads the "Counter Input" frequency.  I am seeing weird behavior from the PXI 6229 card. I can test "Path 1" and "Path 2" and the frequency I read is what I generated. No issue there. However, when I test "Path 3" and "Path 4" the frequency measurement is erratic.  The readings are two different frequencies repeated over and over again and none of those frequencies are the expected frequency which was generated out of the "Counter Output."  If I reset the card, and start by testing "Path 3" and "Path 4" the frequency readings are correct and the erratic behavior is gone.  However, when I try to then test "Path 2" and "Path 1" now those lines have the erratic frequency issue. I can continue resetting the card and see same issue. The PFI lines that I test first will always pass.
    To summarize:
    Steps Taken:
    1. Test Path 1 = SUCCESS
    2. Test Path 2 = SUCCESS
    3. Test Path 3 = Erratic Frequency (Two Frequencies repeated over and over again in my frequency results array)
    4. Test Path 4 = Erratic Frequency (Two Frequencies repeated over and over again in my frequency results array)
    5. Reset the PXI 6229 Card
    6. Test Path 3 = SUCCESS
    7. Test Path 4 = SUCCESS
    8. Test Path 3 = Erratic Frequency (Two Frequencies repeated over and over again in my frequency results array)
    9. Test Path 4 = Erratic Frequency (Two Frequencies repeated over and over again in my frequency results array)
    I am wondering if Port 2 (P2.0-P2.7) on the 6229 card has certain dependecies and this is why I am seeing issues.  I am trying to get around this issue so that I don't have to always reset the card.
    Are P2.0-P2.3 (PFI8-PFI11) and P2.4-P2.7 (PFI12-PFI15) treated differently or require different setup?  How do I resolve this issue?
    Thanks so much!

    I have a theory...
    The DAQ card follows a policy called "lazy uncommit" wherein the terminal used for the output will continue to be connected to the counter even after the task has completed (until the terminal is needed for something else).  So as you run more tests, the counter output will end up driving more lines.  This behavior should be easy enough to confirm.
    As the DAQ card drives more lines, I'd imagine this affects the actual signal.  You could scope it to check, but it sounds like either the rise/fall times are becoming longer or some extra noise is being introduced on the line.  
    The readings are two different frequencies repeated over and over again and none of those frequencies are the expected frequency which was generated out of the "Counter Output."
    This implies you are picking up an extra edge during transitions--this isn't too uncommon if the signal is noisy since there is no built-in hysteresis on the DAQ card.  I would expect the measured frequencies to have periods that sum to either the full period or the semi-period of your actual signal (depending on how many duplicate edges are detected).
    Suggestions are as follows:
    To stop the DAQ card from driving multiple PFI lines, it would probably be easiest to just programmatically reset the device in between your tests (using DAQmx Reset Device).  If you can't reset the device (e.g. because you are running some other task that can't be interrupted) then you can instead configure a dummy task that uses the PFI line in question as an input.
    To stop the DAQ card from picking up multiple edges during transitions, you should configure a digital filter on the input terminals.  If you reset the device it sounds like this might not be necessary... it's up to you if you want to configure this or not.
    Best Regards,
    John Passiak

  • Synchronize a counter and Analog Output

    Hello all,
    I want my Analog Output generation and my Counter0 operations to start at the same time. Any ideas how to accomplish it.
    I have tried to feed the output of another counter1 to the gate of counter0 as well as to the clock source of Analog Output (GPCTR1).
    This however doesnt seem the solution.
    Will appreciate any suggestions.
    Thanks

    Mili,
    I think you'll have to experiment, but it might be possible to do both operations with the equipment you have. This would be relatively easy with an NI 660x counter/timer board.
    You can use the Route Signal VI to send your counter output to a RTSI line and then select the RTSI line as your counter 1 gate. (this is the generic solution for any number of counters)
    For getting an external update clock, check out the continuous external clock example programs that are included with LabVIEW or NI-DAQ.
    You can easily start your output with a digital trigger, but the STC counters do not allow for digital triggering of counter operations. You may be able to come up with some programming scheme that gets counter 1 started, but gated low so t
    hat it is not counting until the start trigger comes in for the acquisition (such as a start trigger that is forced low until the start trigger for the analog input comes in). This would be a design you would have to work out or see if anyone else has found a way to do it.
    You can also search for many example programs/discussions at http://www.ni.com/support by searching in Option 3 for keywords like external, analog, output, and trigger.
    Hope this helps.
    Regards,
    John Nieri
    Applications Engineer
    National Instruments

  • Synchroniz​ing two counter frequency inputs with multiple analog inputs

    Hello all,
    I'm fairly new to LabVIEW and I'm trying to collec​t data from multiple sources with synchronized tim​ing on the acquisition but I'm having trouble figu​ring it out. My problem is that I've got two count​er frequency inputs, one optical tachometer readin​g one pulse per revolution, and a max machinery fl​ow meter with a k factor of 12000. I can't seem to​ figure out how to sync the timing with my multiple analog inputs. I've be​en attempting to get the tachometer  to sync with ​the analog inputs first by following the example l​inked here. (https://decibel.ni.com/content/docs/DOC-10785) So far each time I run it I either get a timeout e​rror on the DAQmx read or a "Multiple sample clock​ pulses were detected" error (see attached image).  It seems if I slow the sampling rate way down to ​say 10 hz and ensure that the tachometer signal is​ over 800-1000 RPM (13-17 Hz) before starting the VI then the program will run without errors until ​the RPM drops below that threshold then the "Multi​ple sample clock pulses" error occurs.  The code is attached below.
    Does anyone know of a more effective way of syncin​g counter frequency inputs with analog inputs?  I'd like to have a VI that can show 0 RPM (and ev​entually 0 flow as well, but I think I need to fig​ure out the timing of one counter before I add ano​ther as it seems I can't have two counters in the ​same task). Any help on this would be greatly appr​eciated.
    LabVIEW version 13.0
    cDAQ-9178 Chassis with NI 9401 for the two counter inputs and NI 9205 for the analog inputs.
    Thanks!
    Richard
    Solved!
    Go to Solution.
    Attachments:
    SimpleDAQ.vi ‏44 KB
    LV_Error.JPG ‏31 KB

    Maybe third times the charm? 
    So I've finally got a good handle on why the VI is having problems at low RPM though I'm somewhat embarassed how long it took me to do that
    Because I have the counter time synced to my Analog input task if it doesn't see at least two pulses between the two clock pulses set by the analog input task I get the -201314 "Multiple sample clock pulses" error. This seems fine at first as it just sets a minimum RPM that I can measure and it's well below the area I'm interested in so no problems there.  I tried a simple error handler that would clear the error when it happend assuming the loop would keep iterating until the RPM went above that minimum at which point I would get a signal again. This is not the case, the read function just continues to spit out the -201314 error even after the RPM is back in the readable range. So then I tried adding two case structures so that when the error occured it would stop the task, clear the error, and then start the task again on the next loop iteration (Code Attached). This also doesn't work as the error shows up again on the stop task and then AGAIN on the start task on the next loop iteration. It seems this error is not actually being cleared and once it happens it stays with the task regardless of what the error cluster is carrying. 
    Anyone have any ideas?  The only solution I can think of is to just clear all tasks and recreate them each loop iteration until the RPM is readable again but that strikes me as a horribly clunky solution.
    Richard 
    Attachments:
    SimpleDAQ_1_Start Stop.vi ‏48 KB

  • Splitting the 5.1 optical mbp/imac outputs into 6 analog mono channels?

    Hi
    is it possible to use the 6 outputs of the optical output of the macbook pro as separate channels?
    What do I need to convert/split the signals into 6 analog channels and does Logic/Ableton recognizes the 5.1 as 6 mono channels?
    thx!!

    sorry to tell you, but no. This is not possible. The 5.1 optical output is only possible by using a special digital encoding that comes with data reduction: AC3. You can't create AC3 streams without relatively large latencies and without buying rather expensive AC3 authoring software components.
    However, once you have an AC3 stream you can use ac AC3 compatible audio amplifier to convert it to analog signals. Not very feasible imho. The much simpler and less expensive way would be to buy an audio interface with multichannel support.
    Cheers,
    Jazz

  • How to get signal from analog input and send it to analog output (real-time​)

    Hi everyone,
    I am doing simple task in Visual C++ and I am using PCI-6221(37 pin).
    Basically, I want to send same signal from 'analog input' to 'analog output'
    at the same time (almost), to make it real-time application.
    Can someone please provide me sample program. 
    I would appreciate if you could provide me with the good tutorial which explains
    step by step everything about programing NI-DAQmx for C/C++.
    Best Regards,
    Khassan
    Solved!
    Go to Solution.

    This is my code in C++, you can optimize it if it looks too messy. This code reads signal from analog input and outputs it through analog output. 
    To make this code work additional  include directories and library directories must be added from NI.
    I hope it helps someone.
    #include <stdio.h>
    #include <conio.h>
    #include "NIDAQmx.h"
    #include <math.h>
    #define DAQmxErrChk(functionCall) { if( DAQmxFailed(error=(functionCall)) ) { goto Error; } }
    int main(int argc, char *argv[])
    int32 error=0;
    TaskHandle taskHandleRead=0,taskHandleWrite=0;
    int32 read=0;
    float64 dataRead[1000];
    char errBuffRead[2048]={'\0'};
    char errBuffWrite[2048]={'\0'};
    bool32 done=0;
    int32 written;
    DAQmxErrChk (DAQmxCreateTask("",&taskHandleRead));
    DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandleRead,"Dev1/ai0​","",DAQmx_Val_Cfg_Default,-10.0,10.0,DAQmx_Val_Vo​lts,NULL));
    DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandleRead,"",100.0,DAQ​mx_Val_Rising,DAQmx_Val_ContSamps,0));
    DAQmxErrChk (DAQmxCreateTask("",&taskHandleWrite));
    DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandleWrite,"Dev1/ao​0","",-10.0,10.0,DAQmx_Val_Volts,NULL));
    DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandleWrite,"ai/SampleC​lock",100.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1​000));
    DAQmxErrChk (DAQmxStartTask(taskHandleRead));
    DAQmxErrChk (DAQmxStartTask(taskHandleWrite));
    while( !done && !_kbhit() )
    DAQmxErrChk (DAQmxReadAnalogF64(taskHandleRead,1,10,DAQmx_Val_​GroupByScanNumber,dataRead,1000,&read,NULL));
    DAQmxErrChk (DAQmxWriteAnalogF64(taskHandleWrite,read,0,10.0,D​AQmx_Val_GroupByChannel,dataRead,&written,NULL));
    _getch();
    Error:
    if( DAQmxFailed(error) )
    DAQmxGetExtendedErrorInfo(errBuffRead,2048);
    DAQmxGetExtendedErrorInfo(errBuffWrite,2048);
    if( taskHandleRead!=0 )
    DAQmxStopTask(taskHandleRead);
    DAQmxClearTask(taskHandleRead);
    if( taskHandleWrite!=0 )
    DAQmxStopTask(taskHandleWrite);
    DAQmxClearTask(taskHandleWrite);
    if( DAQmxFailed(error) ){
    printf("DAQmx Error: %s\n",errBuffRead);
    printf("DAQmx Error: %s\n",errBuffWrite);
    printf("End of program, press Enter key to quit\n");
    getchar();
    return 0;

  • Count 4th consecutive pulses from the analog output of the encoder

    Hi
    Iam getting analog output from the encoder and i want to count the 4th peak of the analog signal. Kindly suggest the best method Once 4th pulse is detected counter will increments.
    Pl refer the encoder output .
    Thanks
    Attachments:
    encoder sig.JPG ‏26 KB

    Whatever you've counted using your logic, divide it by 4 and convert it to an integer (towards negative infinity)..!!
    This should work.
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.

  • Hi, iam facing proble in synchronizing 4 ni 4472 cards input with pxi -6052e analog output. please help me out to sort out this problem

    hi, iam facing problem in synchronizing 4 ni 4472 cards input with pxi -6052e analog output. please help me out to sort out this problem

    Hi achyuth,
    Thank you for posting on the National Instruments forum.
    I am not sure what you are trying to do.  Are you trying to input and output at the
    same time?  Are you just trying to
    synchronize all of your inputs?  Do you
    want them to run off the same clock?  If
    you could, give me some more information so I can understand your problem
    better.
    In the meantime, this might help you:
    PXI Timing,
    Triggering, and Synchronization Capabilities of E-Series Multifunction Data
    Acquisition ...
    PXI Timing and Synchronization
    Thank You,
    Nick F.
    Applications Engineer

  • How to combine the analog input and analog output vi's

    Hi !
    I have a perfectly running triggered analog input acquisition vi. I have a seperate vi for analog output that's running perfectly too. Can someone tell me how to combine these two operations so that I could get a vi that does simulataneous AI and AO without missing triggers. I have tried all the different kinds of configurations suggested by NI support but nothing seems to work. Can someone help ?
    thanks,
    Shiva
    Attachments:
    dac_good.vi ‏77 KB
    adc_good_fw.vi ‏124 KB

    Shiva;
    I'm attaching a good Application Notes that shows how to synchronize multiple DAQ tasks, in Labview.
    Hope this helps.
    Filipe
    Attachments:
    Advanced_Sync_Techniques_for_DAQ.zip ‏166 KB

Maybe you are looking for

  • Will not boot after moving Journal

    I did this on a test system so the fact that it didn't work isn't so big of a deal, but I'd like to get it working. I ran through the steps outlined in Apple's own KB as well as the article on AFP548 to move the journal of my boot volume to the ssd i

  • Question about 'cin' & 'cout' (C++) (SOLVED)

    Probably a stupid question with a simple answer but here goes; when i compile the following code #include <iostream> #include <string> int main(int argc, char* argv[]) string buffer; while (1 == 1) cout<<" ## "; cin>>buffer; it compiles fine, when ru

  • Removing previous versions of Adobe Photoshop Elements

    I have Elements 10 and would like to remve versions 8 and 9 from my computer without losing any pictures.  Do I uncheck the " Remove downloaded content" box? 

  • Calling GUI Scripting from ABAP program

    Is it possible to call GUI Scripting from ABAP and thus to use GUI Scripting as an alternative to CALL TRANSACTION? Is the class CL_JAVA_SCRIPT suitable to access GUI Scripting engine? Accessing ABAP data object would work as well in this case as i t

  • Invalid Path error

    Hi, I'm using iplanet, but I'm sure the principle is the same for any server, ie. tomcat etc. Using struts, there are certain urls (usually concerning .do extensions) that cause the server to complain - Invalid path /bal/bla was requested. These are