50Hz cycling of digital output

Hello,
I would like to cycle a digital output at 50Hz with a 50% duty cycle. I am only able to cycle the output at up to 32Hz. Why?
I am using NiDAQ 7.1 with Visual C++ 6.0 on a 1GHz Pentium with 1GB RAM.
The code is attached.
Please help.
- Tree
Attachments:
DOmain.c ‏4 KB

Hello,
After looking at your code for a few minutes and I have a couple of suggestions that might help to solve this issue:
1. Try removing the printf() function calls inside the while loop that is writing to the digital line. Sometimes the printf() function can take a significant amount of time to execute, this is especially apparent in tight timing loops like this one.
2. I�m not sure what DAQ board you are using but all of our E-series DAQ boards have counter/timers onboard. These timers are better suited to generating pulse trains at various frequencies. There is an example which demonstrates how to do this that installs with NI-DAQ. Just go to your NI-DAQ install directory on your hard drive (usually �C:\Program Files\National Instruments\NI-DAQ
\�), from there go to �\Examples\DAQmx ANSI C\Counter\Generate Pulse\Dig Pulse Train-Cont�. This project generates a continuous pulse train from one of the counters on a multifunction DAQ board.
I hope this helps. Please let me know if this doesn�t solve your problem or there is anything I need to clarify. Have a great day!
Ken S.
National Instruments

Similar Messages

  • How to use Digital output to turn on sensor for Analog Input?

    I am trying to use a digital output to turn on an array of sensors that I then wish to read on 16 analog input lines. I have a 6024E DAQ card. I am planning to take data at 10-20 hz, so not terribly fast, but I will be acquiring for long periods of time (days) so I will be streaming data to disk.
    I have a fair bit of experience in Labview basics, but can quickly get out of my depth when I try something new (like this). I have V6.01.
    It looks as though the best way might be to do the DO and then a single AI as individual events, then write to disk and continue through the loop. I am puzzled, however, how to keep this cycle on schedule given that I don't know how long it will take to sample 16 channels
    , write the data to disk and get back to the starting point... perhaps this is so fast that I don't need to worry about it? The actual timing of the samples (be it 10 or 20 hz) isn't too critical, as long as I can record at what time they were taken... it would be frustrating to find that I was several seconds off after days of data.

    Hello,
    Thank you for contacting National Instruments.
    If you are worried about the time of your acquisition being off, then you should associate each voltage measurement with a timestamp. This will allow you to know the exact time at which the sample was taken and you will never be off. You can use the Get Date/Time in Seconds.vi in our while loop with your AI code so that you can read a sample and read the time. You can than log the voltage value and the timestamp to your file.
    Regards,
    Bill B
    Applications Engineer
    National Instruments

  • Do I need to buy SignalExpr​ess to use a ENET-9472 Digital Output Module.

    I’ll describe my application and then ask the question. We are life testing DC motors.  For each motor we measure the armature temperature. We are controlling the on/off duty cycle with a PLC.  If the temperature exceeds a limit we want to send a signal to the PLC to shut down the test. Here are my question: LabVIEW SignalExpress LE comes with the purchase of the ENET-9213 thermocouple module. It does not have the alarm feature. LabVIEW SignalExpress does have the alarm feature but costs $749.
      If we use an ENET-9213 thermocouple module to measure the temperature and a ENET-9481 Digital Output module do we need to purchase LabVIEW SignalExpress to send an over temp signal to the PLC?
    Thanks;
    Tom Renner

    Hello Tom,
    Judging from your application, it sounds like you need to be able to send a software trigger when your thermocouple module reaches  a certain value. If that is the case from the LabVIEW SignalExpress Help comparison table, it appears you are going to need a licensed SignalExpress
    To verify whether or not the software suits your application, I recommend downloading  and installing LabVIEW SignalExpress and using the 30-day free trial of the full edition software. Just download the latest version of DAQmx, this will install SignalExpress and allow you to simulate the hardware so you can try programing the application during your 30-day trial and verify SignalExpress is right for your application. 
    Three Levels of Data-Logging Software from National Instruments
    Message Edited by ManLongAtNI on 01-11-2010 10:43 PM
    Regards,
    Glenn

  • Externally Triggered 6534E Digital Output

    Hi Dear Friends,
    I have get a question on how to do the triggered output for the 6534E card. Right now I am using the 6534E card to output a digital gate pulse, and I want to synchronize the output of this gate pulse to an external source, which is the Sync output of a Angilent 33220A function generator(10 kHz). I want the rising edge of one trigger pulse(the sync output) to start one digital gate pulse output, and when one digital gate pulse if finished it waits for another rising edge of the trigger pulse to start another digital gate pulse.
    For the more detailed description, please have a look at the attached waveform. Hope you can shed some light on the possibility of doing this.
    Thanks a lot for the help.
    Attachments:
    6534 Triggered Digital Output.JPG ‏95 KB

    Hello tiddlycorona,
    From the diagram you provided, you can try the Gen Dig Pulse-Retriggerable.vi. This LabVIEW example demonstrates how to generate a digital pulse from a Counter Output Channel on a digital trigger. The Initial Delay, High Time, Low Time, and Idle State are all configurable. It also shows how to use a Digital Start trigger, so the digital pulse is not started until a trigger signal is received. Though the pulse is configured in terms of ticks, it can easily be modified to generate a pulse in terms of Frequency/Duty Cycle or Time.
    Best regards,
    Ali M
    Applications Engineer
    National Instruments
    www.ni.com/support

  • Digital stimulus-f​requency response: Need to drive with digital output trigger. Using counters for response.

    I need to drive stimulus-response with a software driven digital trigger and NI-TIO counter based response. No analog I/O is really relevant, although I have a PCI-6035E multi-function DAQ as part of my gear. I intend to use the analog, but its timing is non-critical and can be software timed.
    The real trick is that I want to set the basic timing of the system (in the range of 1 - 50Hz) from the timer0 on the 6035E. This signal needs to be replicated to drive a trigger pulse and to route through RTSI (or a PFI) to trigger frequency counts using the four possible groups of counter/timers on the 6602.
    What I need is:
    while( enabled )
    Repeat at (
    software controllable rate = 1-50Hz)
    Trigger Sets a PFI line for 10-20us
    same trigger sets an RTSI line
    - Software Set Delay (usually zero)- stable is more important than the delay time!
    Count for software set time on 4 counters
    analog samples
    Post-process
    I want to do this in LabView. I have checked out the Advanced sychronization demos online, but the examples all use analog triggering and buffered digital I/O. This doesn't really address what I need to do.
    I have made some failed attempts which relied on software to sync up the trigger and the response frequency acquisition. This is definately flawed. I need to start the counting right after setting the digital output trigger, and stop the count after a fixed interval for frequency calculation.
    I am having trouble working through the signal routing to get the timing to trigger off the digital stimulus output pulse.
    Any help would be appreciated
    Thanks,
    Joe

    Joe
    What are you using the trigger from the 6035E for? I do not know what you mean by, "to trigger frequency countes."
    If you are having problems just routing the signal to the 6602, here is a vi that shows you how to route a signal through the RTSI cable to use as the source of a counter.
    Brian
    Attachments:
    Route_RTSI_to_Source.vi ‏67 KB

  • PCI-6023E & digital output

    Hello,
    I have a PCI-6023E and I want to generate a continous pulse train with a digital output line, and I need to know the maximum frequency for this pulse train that I can generate.
    Thanks a lot for your answer.
    Regards, Anacelia

    Hi Anacelia,
    You should not realy on this answer without verifying with NI first. So here goes.
    Page 347 of the catalog indicates the supported data transfer mode is "programed I/O". This indicates that each line state change must be initiated by an operation of the controlling software. Therefore, the upper frequency limit is determined by how often the code that sets or resets the line runs.
    So, the upper limit is determined by the software and the environment it is running in. If you are woring in Windows environment, and your machine is faster than about 400 Mhz then there are two factors to concider when answering your question. How fast does the code run, and how deterministic is it.
    If determinism is not an issue, you could resonably expect to get
    about one update every 10ms if the code is clean. This would give you 100 update per second or about 50Hz.
    If determinism is required, and you are not running in a Real Time environment, the above estimates should be backed off. Anything above 5-10Hz is going to be questionable.
    Like I said, verify what I have said with NI.
    I hope this helps,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Triggered signal = digital output

    Hello everyone,
    I am using the following:
    NI6220(PCI, M-series)
    Visual Studio 2003 C#
    The project I am working uses a watchdog. I get a serial signal which I have to pass on. I was thinking of a trigger to read this serial signal, and then pass it directly on by using a digital output. At moment I read the serial signal with a pausetrigger which starts a pulsgenerator when it is high and pauses the generation when it is low. This is not what I want, because in this situation you are working with a predefined pulstrain generator(initialization of frequency, duty cycle et cetera). While the serial signal is randomly high an low I cannot use this predefined signal. Is there an other way to get this working.
    Can anyone please help me with this problem.
    Thanks in advance,
    Souza

    Hello everyone,
    I am using the following:
    NI6220(PCI, M-series)
    Visual Studio 2003 C#
    The project I am working uses a watchdog. I get a serial signal which I have to pass on. I was thinking of a trigger to read this serial signal, and then pass it directly on by using a digital output. At moment I read the serial signal with a pausetrigger which starts a pulsgenerator when it is high and pauses the generation when it is low. This is not what I want, because in this situation you are working with a predefined pulstrain generator(initialization of frequency, duty cycle et cetera). While the serial signal is randomly high an low I cannot use this predefined signal. Is there an other way to get this working.
    Can anyone please help me with this problem.
    Thanks in advance,
    Souza

  • Controlling fpga digital output node from realtime boolean

    I have a system where I want to turn on / off a digital output running on the FPGA.    
    Once I set the boolean on my realtime side (which turns on the FPGA output), I see the output turn on the CRIO, but it flickers on and off.   (not latching?).   I just want the FPGA to stay on as long as the output is turned on, on the realtime side.  I cant change the mechanical action of the switch due to limitations on FPGA / RT according to labview ( I get an error at compile)
    Any suggestions on how to correct this?
    Solved!
    Go to Solution.

    I have simplified my program to something very basic to replicate the problem. 
    The digital output D0 switches on and off everytime the realtime loop cycles through. 
    If I run just the FPGA seperate and turn on the digital output control D0 it stays on solid. (until I turn it off again)
    What am I doing wrong?
    Attachments:
    FPGA_RT_TEST.zip ‏144 KB

  • Route counter ouputs to same Digital Output

    Hi,
    I'm not sure this is possible but i'd like to route the outputs of 2 counters (PCI-6602) to the same Digital Output line.
    My 2 counters each generate a pulse train defined by frequency, dut-cycle and delay. I want to combine the 2 pulse trains into one resulting pulse train. How would this be possible if I can't route the outputs of the counters to the same digital line ? Do i have to abandon this idea and define the desired pulse train in binary and repeatedly output that to a digital line ?
    Many thanks in advance for any feedback here.
    Cheers, Shaun.
    Solved!
    Go to Solution.

    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.

  • Sequential Digital Outputs or Counters

    I am trying to sequentially flash four digital outputs.  I want to run them at a frequency, with 25% duty cycle, one after the other.  To be clear, output one on for 25%, output two for 25-50%, output three for 50-75%, output four 75-100%, then repeat.  I tried using four counters, but they are not synchronized, so the pulses do not stay sequential.  I am using a USB-6143.  This seems really basic, but I am a pretty new user.
    Thank you - 

    Assuming you are using the USB-6343 (there is no USB-6143, although there is a PCI variant), you can either run 4 counter output tasks with triggering and appropriate initial delays, or you can use a single digital output task with the appropriate waveform--for example, using lines 0:3 you could generate {1, 2, 4, 8, 1, 2, 4, 8 ...} to get the desired waveform.  The frequency of each output would be 1/4 of your sample rate (the sample rate is configurable).
    Either method would work, but using digital output seems like a much more straightforward way to go about generating your signals.
    Best Regards,
    John Passiak

  • Digital input and digital output at the same time

    Hi all
    I have a PCI-6503 board. I have done 2 task that run simultaneously: the first one is port0_16 output and the second one is port2 input.
    I get sometimes (not every times...this is strange...) error-200587 saying:
    'Requested operation could not be performed, because the specified digital lines are either reserved or the device is not present in NI-DAQmx.
    It is possible that these lines are reserved by another task, the device is being used through the Traditional NI-DAQ interface, or the device is being reset. You might also get the error if the specified resource is currently in use by LabVIEW network variables bound to the DAQ Channel, or if the DAQ Channel is being used in any OPC Client software.
    If you are using these lines with another task, wait for the task to complete.  If you are using the device through the Traditional NI-DAQ interface, and you want to use it with NI-DAQmx, reset (initialize) the device using the Traditional NI-DAQ interface. If you are resetting the device, wait for the reset to finish.'
    In the attached VI i have recreated the basic structure of my real VI (the error is present even here of course...).
    How can i do?
    I want to have both digital input and digital output with the same PCI-6503 every single cycle... Is it possible?
    Please help me!!!
    Kind regards.
    I love the smell of napalm in the morning
    Attachments:
    DIO simultaneously error.vi ‏31 KB

    Hello Maverick,
    Did you have any luck with the example Raven sent you?
    In Raven's example, it properly passes the DAQmx task from one SubVI to another to avoid having to open the task again. These errors are likely to occur when you have multiple DAQmx calls in a VI that call the same task again without clearing the previously opened task. If at any given time you try to open a task that already is being used, you might receive an error "resource is reserved"... similar to your original example.
    If you are interested, here is an awesome link that gives a detailed explanation of the LabVIEW dataflow paradigm
    Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications
    Thanks and good luck!
    Jordan Randall
    National Instruments Italy

  • Microseconds delay to control digital outputs in WSN-3202

    Hi,
    I’m using the LabVIEW WSN Module to control the digital outputs of the WSN-3202 node. Is there a way to add a microseconds delay in my flat sequence structure? Because I’m using a pulse driven optical sensor which requires delays intervals in microseconds.
    Thanks,
    Ahmed

    Hi Ahmed,
    The availability of a microsecond resolution for timing depends on the onboard clocks or setup that the system allows. These nodes are often used to control/acquire in a non-continuous way to save battery. Therefore, they are required to wake/sleep in cycles that take a couple of minutes generally. What are you exactly trying to do with the node?

  • Probleme digital output

    hello I would like to implement a program in LabVIEW to control a triac with digital output module compact FieldPoint So the goal is to change the value of the duty cycle to change the harsh suppression of the triac
    Attachments:
    Untitled 1.vi ‏11 KB

    You posted a question in the forum that is for feedback on how the Discussion Forums operate.
    You need to post your question in the LabVIEW board.

  • Duplicate digital output on 32-bit port

    Hi all, any help appreciated with the last (!) step in a very time consuming puzzle...
    I have a PCI-6254 card with 2 x 64 channel breakout cables. Each cable goes to a remote box, each of which essentially runs a multiplexer and acquires analog signals.
    Each multiplexer needs an array of  4-bit addresses (eg. 0 to 15) to cycle the multiplexer channels, which I can succesfully generate on port0\line0:3 which are found in cable 1 going to box 1.
    My mission is now to duplicate this digital signal in the second cable going to the second box. For this card, Cable 1 has port0\line0:7 and cable 2 has port0\line8:31. I understand that it's a 32-bit port, so I need to send it a 32-bit address.
    So I simply (!) want to send identical digital outputs on port0\line0:3 and on (say) port0\line8:11. They should be triggered by the same clock, etc.
    Is this possible? However I try so far I can only generate an output on lines 0:3. From what I've read, I'm wondering if the whole of the port is tied up by writing a 32-bit number to the first 4 lines....
    Thanks!
     

    Thanks both, really appreciate your input. I think I tried something like that today with no success but maybe I did it wrong. It ran without errors but just generated the output on 0:3. I'll try your suggestion in the morning (New Zealand evening now).
    I think I need to replace the 1D boolean with a 1D U32 array to send the right bit address (I am sending the mux channels in a funny order, something like 4,0,3,6,10,etc). But then I fear that it will only run one task, as the whole 32-bit port is being addressed each time.
    GerdW - could you explain how I would go about setting the right bits to send, say, a value to 4 to both sets of lines? I can't get my head around it...
    Thanks guys!

  • Solution to my Audigy 4 Digital Output probs... please make a stic

    I was recently playing Q3TA with my son when my overheat protection kicked in. I exited to windows to see the temp and throttle back my CPU a tad, and when I returned I had no sound from my digital output. Analog was working fine, however.
    Setup:
    Giga-byte GA-MA78GM-S2H w/780g chipset
    Athlon 64 X2 5000+ BE
    Integrated Realtek HD audio (disabled)
    Integrated ATI HD 3200
    2xGB 800MHZ DDR2
    Creative Audigy 4
    Boston acoustics Digital BA735 2. speakers
    I went over every setting in all of my consoles, HQ's and drivers. I played with driver versions, DirectX versions, diagnostic programs and procedures in the knowledge base. In defeat, I even wiped out my XP install and started fresh with the Aud-4 removed, using analog on the integrated card thru headphones. Then I disabled the integrated card and reinstalled the Audigy 4 only to find that there was still no sound from the digital speakers.
    Solution?
    I[color="#ff0000"] unplugged the power to my speakers, and reconnected everything. As soon as the power was back up, the sound started playing (I had a .MP3 on for testing).
    This stumped me for two reasons that occur to me know:
    . These speakers (and possibly many others) don't fully power down when you turn the volume knob off and the light on the satellites goes out. The decoder and subwoofer unit keep their light on.
    2. Apparently, some situations introduce a faulty signal to the digital output that scrambles the speaker units and they refuse to operate any longer.
    Now I know, unplug the power to my speakers. My system works on all three sampling frequencies in "audio console" 44., 48, and 96KHz. None of the troubleshooting procedures touched my problem, because they didn't even mention the speaker setup, let alone doing a hard reset.
    Please please please!
    Make this a sticky for future me!!!

    The Digital output jack on the card isn't of optical signal type.....you will need to get those I/O module mention bt johnston2 for optical connection.

Maybe you are looking for