Using an internal sample clock with a digital input

I am using an encoder to measure angle and velocity. The example that I have started with is here. https://decibel.ni.com/content/docs/DOC-6834. The problem I am having is with the Sample clock, I get a timeout at the DAQmx read. If I remove the sample clock the VI runs fine, but I have no idea of my sample rate. Below is the the problem setup with the Sample clock inline.
Attachments:
encoder with timer.JPG ‏50 KB

Hi there, a couple suggestions: first , this is a post that it is suppose to be on the DAQ board. Second, you are not being clear about the error, try to include the error code, description and its location, is it coming out of the channel node or the timing VI? Also what hardware are you using?
Now, If you open the example called "Measure Angular Position.vi" from the NI example finder, drill the DAQmx Create Channel, you will see that you are missing a couple terminals for the task configuration, I wonder if this is part of the error.
Alejandro | Academic Program Engineer | National Instruments

Similar Messages

  • 6036 E-Series AI Internal Sample Clock

    I have a 6036 E-Series board and am implementing the DAQmx Analog Input.  I want to use the Internal Sample Clock
    instead of software timing.  I've reviewed and tried to run the examples provided, but only the software timed routines
    function.  All of the Internal Clock routines sit and wait for the timeout to occur.  Any help would be appreciated.

    Hello TonP,
    The code is directly from Labview 7Express "NI Example Finder", search: DAQmx Analog Input Voltage,
    ->Continuous Acq&Chart Samples-Int Clock.vi (filtered for 6036 E -series)-see attached cut 'n pastes.
    I do NOT want to use an External Clock or Software timing.  This AI routine is part of a larger picture of AI, AO, DIO
    and Counters to be implemented in a large VI and eventually synch'd together (for later).  I've tried all related Int Clock
    examples, with same timeout result.  It's as-if the Int Clock is not being addressed.  Is this the same Int Clock that
    AI Traditional uses?  Is there only one clock?  Do AI, AO, DIO use/rely on same clock?  Do I need to address a specific
    clock or is it automatically implied?  Oh yes, this is PCMCIA.
    Attachments:
    DAQmx AI Voltage.jpg ‏101 KB

  • Can buffered digital edge detection only be performed using an external sample clock?

    I am working on an application where I need to measure the speed (rpm) of a motor as it starts up using the output of its built in hall effect sensor.  The sensor should output 2 pulses per revolution of the motor.  My plan is to count the pulses from when the counter (counter 1) is armed to when it is up to speed. Looking at the M series manual, the CVI (v8.5.1) help, and the examples it appears that this can only be done using an external sample clock.  Is there a way to route an internal sample clock to the appropriate terminal on the counter so that I do not need to add additional hardware?
    I am currently using a PCI-6289, but the final application will use a CDaq-9188 chassis (using one of the the built in 32-bit counters).
    Thank you for your assistance.

    Thank you for your input.
    However, I did forget to mention one detail of the application.  I need to buffer the edge counts so that I can graph the speed of the motor as it starts up.  I need to be able to acquire the edge counts at reqular intervals so that I can determine how fast the motor was rotating at each point.  So far I have not been able to find an example of doing this without and external sample clock.  As I mentioned, in the final application I will be using the 32-bit counters on a CDAQ-9188 chassis.  The only thing I can think of at this point is to generate a pulse out of the second counter and use that as the sample clock.  Will this work?

  • NI6602 pulse width measurement: Do I have to use an external sample clock?

    Hi
    In the .NET 4 example 'MeasPulseWidthBuf_SmplClk_Cont' it is stated in the comments that:
    An external sample clock must be used. 
    Counters do not have an internal sample clock available.  You can use
    the Gen Dig Pulse Train-Continuous example to generate a pulse train on
    another counter and connect it to the Sample Clock Source you are using
    in this example.
    I have an application running without specifying an external clock. The applications is running, but I'm not sure I can trust the recorded data. Here is the channel creation code:
                    task.CIChannels.CreatePulseWidthChannel(readTaskCounter,
                                                            "ReadPulswidthTask", 25e-9, 20e-6,
                                                            CIPulseWidthStartingEdge.Rising,
    CIPulseWidthUnits.Seconds);
    task.CIChannels.All.DataTransferMechanism = CIDataTransferMechanism.Dma;
                    task.Stream.Timeout = callbackTimeoutInMilliSeconds;
    task.Stream.Buffer.InputBufferSize = 50000;
                    task.SynchronizeCallbacks = true;
                    task.Timing.ConfigureImplicit(SampleQuantityMode.ContinuousSamples);
                    task.Control(TaskAction.Verify);
    Note that I'm not specifying any external clock.
    1) Which clock is the daq using? -It is obviously using some clock since I can collect data via this task.
    2) Do I need to change the configuration to use an external clock to achieve reliable readings - as mentioned in the 'MeasPulseWidthBuf_SmplClk_Cont' example?
    /mola
    Solved!
    Go to Solution.

    Hi mola,
    That specific example is for sample-clocked pulse width measurements.  This type of measurement is only supported on newer hardware such as X Series boards and will not run on the 6602.
    Your application that you linked uses Implicit timing, meaning that the signal itself serves as the sample clock.  That is, at the end of each pulse width that you measure, the sample is deterministically latched in.  So, you end up with a buffered array of every pulse width that is seen by the counter.
    Best Regards,
    John Passiak

  • HT4628 I can not use the internal wireless card with my Mac pro 2012, I don't know if it is broken

    I can not use the internal wireless card with my Mac pro 2012, I don't know if it is broken. The problem is happen recently, I have to use an independent wireless card now. Thanks!

    When you enable Internet Sharing in OS X, you are creating a separate sub-net.
    There is no option to allow this to be a simple pass-through from Ethernet to AirPort (or the other way).
    The problem is easily solved by getting an inexpensive wireless router. You can replace your current router OR disable the DHCP server on the wireless router and allow the wireless clients to get an IP address from the current router.

  • Using the internal sound card with good optical A/D converters?

    Dear Logic users, I have two questions:
    1) I was wondering if the internal sound card of my MacBook is of such quality that I can achieve good results if I bought a good A/D converter with a digital output to plug directly into the optical line in of the MacBook? E.g. the Samson C-valve http://www.samsontech.com/products/productpage.cfm?prodID=1651&brandID=2 along with the M-Audio Co2 http://www.m-audio.com/products/en_us/CO2-main.html to convert the coaxial S/PDIF to optical? (Same procedure for the line out signal, with a D/A converter of course.) Or is the internal sound card of such inferior quality that I should stick with my current MBox 2 Pro? My initial thought was that if the signal is kept within the digital realm, it is really the A/D converters that determine the sound quality, and that the internal sound card of my MacBook does little less than calculate the digital signal. Maybe someone with a more intimate knowledge of how the internal sound card works with digital I/O could chime in?
    2) If the above mentioned approach would be feasible, suggestions of other A/D and D/A converters would be most welcome.
    The reason for this is to be free from the driver issues that sometimes occur with external hardware, especially with software/OS upgrades.

    If you are recording Midi using loops and all it wont make a difference in having a AD/ converter. as everything you are doing is in the box.
    However if you want to get a Analogue signal into the computer then its a different case, and I'm not talking about using Optical from a keyboard, and even if i was you would need to have a converter anyway,
    even though i am talking about Recording Vocals or Live instrument!
    This is where the Converters come into play, be aware Converter and sound-cards are two different source of hardware,
    anyway Back to Converters on live vocals this is where the AD comes into play,
    transferring Analogue Signal into Digital,
    and also getting used to the sound of the converts, or even liking the the sound of the converters/soundcard which is always going to be subjective and which also shares a relation with Near-field monitors,
    you change your monitors and it seems as if your sound changes that is how tight the relation is between the two.
    Fr.BlayZay.

  • External sample clock with pulse width measurement

    Dear all,
    I am using a NI 6220 board (programming with ANSI C) and would like to perform a "single pulse-width measurement" using an external gate signal and an external signal as source.
    Using the  "DAQmxCreateCIPulseWidthChan" command the program and card works only partly as intended. Namely, the external gate did work, but the card uses the internal 80 MHz time base signal instead of the external source connected to the default source pin (PFI 8).
    I tried to route another PFI pin to the default source pin using the "DAQmxConnectTerms" command but this did not help either.
    Obviously, I am missing something...
    Best, Uli
    Solved!
    Go to Solution.

    Hi Uli,
    I posted to your thread here.
    Best Regards,
    John Passiak

  • Triggering an event with a digital input

    Hello all,
    I'm writing my first Labview program.  I used an architecture I found on the forums here, and it has been very helpful in getting me started.  This architecture uses two while loops, one containing an event structure and one containing a case structure.  (This is a queued state machine architecture, I believe).
    Part way through the programming, we decided we needed a sensor to make sure the part was in the test fixture during the test.  If the part is removed during the test, we'd like to safely stop the test.  So basically, I need to monitor a digital input (on an NI-USB-6525 module) and enter the "Stop" case if the digital input turns off.  I would also like to make sure this digital input is on before entering the "Start" case.  I don't care if the input changes state when the test is not running, nor do I care about its state during the "Exit" case.
    I'm really not sure how to add this functionality to my "stop" case.  I don't even know if it's possible.  I've been researching DAQmx events, but I haven't found an example or answer that aligns with my particular problem. 
    I've attached my code.  It's incomplete right now - I still have a large number of steps to add.  I wanted to get this issue figured out before I programmed any more steps.  A preview of the code showing the basic architecture is shown in the picture below.
    Does anyone have any ideas or suggestions for me, or questions if my problem is unclear?  Also, if you see anything else in my code that will be problematic, please let me know.
    Thanks in advance!
    Attachments:
    Main_Loop_072412.vi ‏195 KB

    I should also add that I looked into event dynamic registration, but it seemed incompatible with my issue.  I don't want my top loop to run only when an event triggers it - I want it to run all the time so that it can immediately respond to button presses. Also, most of the triggering I found was based on value change.  I care about the actual value, not just that it changed.
    I don't want to do anything that will bog the code down too much since it is important that the system respond immediately to inputs, especially to the stop or exit button presses.
    I'm sure I am missing something very basic here.  I'm used to ladder logic, where everything is simple and straightforward. 

  • Why do I have to specify a rate when using an external Sample Clock?

    Set the approximate Rate of the external clock. This allows the internal characteristics of the acquisition to be as efficient as possible.
    How to understand?
    帖子被sillyball在02-25-2007 01:48 AM时编辑过了

    I think it is for optimization of the buffer.
    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!

  • Can I use an Internal Hard Drive with Time Machine?

    My Mac Pro has 4 internal bays for hard drives. Can I set-up one of those bays for a Time Machine hard drive?

    Yes, lots of Mac Pro users do that.
    It's still a good idea to make secondary backups, especially to a portable external HD, that you can take off-site, so you're protected against fire, flood, theft, direct lightning strike on your power lines, etc.
    [CarbonCopyCloner|http://www.bombich.com> is donationware; [SuperDuper|http://www.shirt-pocket.com/SuperDuper/SuperDuperDescription.html] has a free version, but you need the paid one (about $30) to do updates instead of full replacements, or scheduling.
    And/or, see Kappy's post on [Basic Backup|http://discussions.apple.com/thread.jspa?messageID=12366915#12366915].

  • Huge Core Audio issue with Optical digital input (S/PDIF) on MacPro

    Hello to all,
    I just realized that it's just impossible to switch the digital optical input (S/PDIF) on a MacPro to 48kHz, it immediately reswitches to 44.1 !!!
    To reproduce (not sure of the english names, french OS here):
    - launch "Audio MIDI configuration"
    - select "Digital audio input" in Properties
    - try to switch Format to 48kHz / 24bit
    In a few seconds, the format reswitches to 44.1 !!!
    Even if feeding the optical input with a correct S/PDIF signal at 48kHz/24bit, no way to change the sample frequency to something other than 44.1, resulting in wrong tonality or distorted sound.
    Please Apple, fix this ASAP, this is just not usable in a pro or even semi-pro environment !
    Test on Leopard 10.5.8 and Snow Leo 10.6.2. I'm pretty sure it worked with Tiger.
    Bye.

    Thanks Keith, but i don't think Logic users could have a clue on this issue (no pun intended).
    I'm a Pro Tools and Nuendo user, so i'm a bit reluctant to ask in a Logic forum... Too many fanboys there IMHO...
    Thanks anymway.
    Bye.

  • Using AI Sample Clock to Trigger Counter Samples

    My basic question is:  Is the ai\SampleClock signal only active while an analog input task is running?
    The details are:
    I have an X-series PCIe-6321 multifunction DAQ card.  It is controlling a SCXI chassis and has a SCXI-1180 and SCXI-1302 so I can control analog inputs of the chassis as well as access the 4 counter  on the card.  My application requires that I use all 4 counters to measure a frequency input signal and synchronize the samples to the analog input signals.  I have created 5 tasks, 1 for the AI and 1 for each counter.
    I am using LabVIEW 8.6.1 with the latest NI-DAQ drivers on and 64-bit Vista OS 
    1. Are there any driver or hardware restrictions that would cause this solution not to work? 
    2. Can I use the ai\SampleClock as in input sample clock for each of the frequency tasks?  If I do this will the sampling start be syncronized?  I.e. if I start each of the frequency tasks first, will they wait until the AI task is started before they start sampling?
    3. If that doesn't work, do I need to route the sample clock from the AI task to a PFI line (PFI1) and then use that as input to the frequency task sample clock? 
    I usually do option 3 when synchronizing two cards in  PXI chassis and only use the software task start in stead of of synchronizing on a digital start, since the sample clock will control the samples anyway.  I need to know if the same behaviour works with the scenario above.
    Thanks,
    Bob
    Prolucid Technolgies Inc. 
    Solved!
    Go to Solution.

    Hi Bob,
    I can confirm that the ai/SampleClock will only be active while the AI task is running.  As far as the other questions go:
    1.  You'd have to provide more information about what you looking to do exactly, but there is no problem with routing the sample clock of the Analog Input task to be used with the Counters.  I would read through the section of the X Series User Manual that discusses sample-clocked frequency measurements (starting on page 7-16) for some more information about what is actually going on during this configuration to make sure it suits your requirements. 
    The frequency of the signal to be measured should be at least twice as fast as the sample clock of your AI task.
    2.   You can indeed route the signal to all four tasks at the same time (you can refer to the Device Routes page in MAX to double-check routing restrictions).  The sampling will be synchronized provided the four counters are started before the AI task, but the counters will be armed at different times unless you configure an Arm Start Trigger (see page 7-45 of the X Series User Manual).  I would consider using the ai/StartTrigger if you wish to do this. 
    The effect of not arming the counters at the same time would be a different number of periods to average on each counter for the very first sample (assuming averaging is enabled).  This might not be a big concern but I just wanted to point it out.
    3.  The routes are available internal to the board so external routing isn't necessary, you can just specify to use the AI Sample clock for the clock of each counter and the routes will be made for you.  If you prefer to export the signal on a PFI line and route it back in on a different PFI line this option is also available to you but shouldn't be necessary.
    I hope this helps you get started.  I'd make sure to take a look at chapter 7 of the X Series User Manual if you get a chance since it describes how all of the counter configurations work in more detail.  If you have any related questions don't hesitate to post back.
    Best Regards,
    John
    Message Edited by John P on 12-01-2009 07:52 PM
    John Passiak

  • Counter Output as Sample Clock of Digital Signals

    I have a situation where I need to use a hardware counter as sample clock of digital output signals.
    How do you specify the "Counter Internal Output" signal as a sample clock of digital output?
    I want to do something like this:
      // Create counter task
      CNiDAQmxTask m_Task(_T("ATask"));
      m_Task.COChannels.CreatePulseChannelTicks(_T("Dev1/ctr0"), "", _T("20MHzTimebase"), DAQmxCOPulseIdleStateLow, 0, 10, 10);
      m_Task.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("PFI0", DAQmxDigitalEdgeStartTriggerEdgeRising);
      // Create digital output task                     
      CNiDAQmxTask m_Task2(_T("ATask2"));
      m_Task2.DOChannels.CreateChannel("Dev1/port0/line0", "", DAQmxOneChannelForAllLines);
      m_Task2.Timing.ConfigureSampleClock("XXXXXX", 0, DAQmxSampleClockActiveEdgeRising, DAQmxSampleQuantityModeFiniteSamples, 400);
    How do I specificy "counter 0 Internal Output signal" instead of "XXXXXX" above, i.e. the sample clock of the digital output signal. Can't find the name of the signal anywhere in the documentation and help files. I have a 6259 DAQ board. 
    /pek

    Thank you for your answers, but I can't get it to work.
    When I use "ai/SampleClock" as sample clock everything works correct. When I try to use a counter as sample clock the task completes imediately, before any digital signals has been sent/measured. The task even completes before I have started the trigger, which is very confusing. No error appears.
    I think that something is wrong about how I setup the counter. I use the code below:
    // Create counter task
    CNiDAQmxTask m_Task(_T("ATask"));
    m_Task.COChannels.CreatePulseChannelTicks(_T("Dev1/ctr0"), "", _T("20MHzTimebase"), DAQmxCOPulseIdleStateLow, 0, 100, 100);
    m_Task.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("PFI0", DAQmxDigitalEdgeStartTriggerEdgeRising);
    // Create digital output task
    // The code below works with "ai/SampleClock" as sample clock
    CNiDAQmxTask m_Task3(_T("ATask3"));
    m_Task3.DOChannels.CreateChannel("Dev1/port0/line0", "", DAQmxOneChannelForAllLines);
    m_Task3.Timing.ConfigureSampleClock("Dev1/Ctr0InternalOutput" /*"ai/SampleClock"*/, 0, DAQmxSampleClockActiveEdgeRising, DAQmxSampleQuantityModeFiniteSamples, 400);
    // Create samples
    CNiUInt32Vector ui_data;
    for(int i = 0; i < 200; i++)
      for(unsigned int j = 0; j < 2; j++)
        ui_data.Append(j);
    // Create digital writer
    CNiDAQmxDigitalSingleChannelWriter m_writer3(m_Task3.Stream);
    m_writer3.WriteMultiSamplePortAsync(true, ui_data);
    // Wait until task completes
    m_Task3.WaitUntilDone(-1);

  • Do I have to use an external clock with a cDAQ-9188 and NI 9401 to read a linear encoder? I'm seeing error message that implies that but the example code doesn't show it.

    We can set up a task that works on demand but when we go to continuous sampleing we see Error -200303, which claims an external sample clock source must be specified for this application.  However, some of the NI linear encoder example code doesn't show that (uses the cDAQ 80 Mhz clock) and the documentation didn't mention that. 

    It's mentioned in the 918x user manual:
    Unlike analog input, analog output, digital input, and digital output, the cDAQ chassis counters do not have the ability to divide down a timebase to produce an internal counter sample clock.  For sample clocked operations, an external signal must be provided to supply a clock source.  The source can be any of the following signals:
    AI Sample Clock
    AI Start Trigger
    AI Reference Trigger
    AO Sample Clock
    DI Sample Clock
    DI Start Trigger
    DO Sample Clock
    CTR n Internal Output
    Freq Out
    PFI
    Change Detection Event
    Analog Comparison Event
    Assuming you have at least one available counter (there are 4 on the backplane), I would suggest to configure a continuous counter output task and use its internal output as the sample clock.  Specify the internal counter using an "_" for example "cDAQ1/_ctr0".  The terminal to use for the sample clock source would be for example "/cDAQ1/Ctr0InternalOutput".
    Which example uses the 80 MHz timebase as a sample clock?  It is far too fast for a sample clock on the 9188 according to the throughput benchmarks (80 MHz * 4 byte samples = 320 MB/s).  There is also no direct route between the 80 MHz timebase and the sample clock terminal for the counters--making this route would use a second counter anyway.
    Best Regards,
    John Passiak

  • Sample Clock from Numerical Position Output of Digital Encoder

    Hey everyone,
    I'm trying to sample a voltage (pressure inside an engine) with my NI USB-6212 against a rotary encoder position (crankshaft angle). For some brief background, I'm using a producer/consumer structure and my rotary encoder has proprietary VIs from the manufacture to interface. It's from US Digital and it's an HD25A. It makes the most sense to use my rotary encoder as a sample clock so I wind up with a sampled point of pressure data for each crankshaft angle. This makes it far easier to average pressure traces together and work with the data.
    I've found quite a few threads on this (links at the end of my post) but they all rely on having a pulse output from the digital encoder which is then wired into a counter input on their board. I don't have a pulse output, my encoder is outputting a numeric value between 0 and my chosen resolution (currently 3600, so 0 to 3599).
    My question is how can I take this changing numerical output and make a sample clock pulse for each time the value changes? Does this need to be turned into a task to use as a sample clock? I'm essentially using the data acquistion program from the example program Cont Acq&Graph Voltage-Ext Clk.vi.
    Thanks in advance for any help you can lend me and my apologies if I missed a prior thread on this topic. My search-fu wasn't able to turn anything up.
    Some relevant links I found, though I couldn't quite make enough sense of them to get the fog to lift:
    http://forums.ni.com/t5/Counter-Timer/How-to-reset-a-counter-on-external-signal-in-LabView/td-p/1521...
    https://decibel.ni.com/content/docs/DOC-12106
    http://ni.lithium.com/t5/Multifunction-DAQ/Rotary-encoder-data-acquired-simultaneously-with-analog-i...

    I don't think there is anyway you are going to make this work like you think you can.  The US digital encoders I have worked with and their VI's were based on reading the current encoder count through a serial port connection.  To do what you want, you are going to need to read the encoder every time the count changes.  At 216 kHz, a serial connection is not going to be able to do that.  Even if it could, you would essentially still have some latency between when the count changed and when the VI would be able to request a reading and get a response that showed the count had changed.
    You need to use an encoder that has a digital pulse output that you could use as a sample clock on a data acquisition card.

Maybe you are looking for

  • No receiver determination found in spite of correct url

    Hi everybody, our partner tries to reach our XI on https adapter to start a synchronous process. The url is as follows: <u>https://[host]:[port]/sap/xi/adapter_plain?party=[PARTY]&service=[SERVICE]&interface=[INTERFACE]&namespace=[NAMESPACE]</u> I ca

  • What is a full charge?

    ok.. here is the deal ig to my 5G pod for about um... lets say a week....and i have to charge it everyday, because it's always empties in less then 8 hours ( just music with no back lights) so i connect the USB to the pod and after 2 hours it's charg

  • PSE 9 Organiser has stopped working

    Hi  Im having trouble opening pse 9 organiser it just stops working and windows shuts the program down, it worked fine for a week or so, I have no trouble with the edit function,hope someone can help.

  • Images as Links

    I am trying to use an image as a link, I can syle all the text hyperoinks I have but for cant do it with the images and always end up with a border around them, i have tried setting border to none and text decoration to none Can anyone help me please

  • HT5902 Retrieving video from cloud

    Is there any way I can retrieve my photo sharing video from the cloud. I did not save the original videos to my PC computer . They're family videos . Need help