Make USB-6001 digital output always high or low in C

Hello all,
I am new to the NI DAQ interface. I have an USB-6001 and I am trying to use this device to control some logic circuit in C. So what I want to do is:
* set some digital output lines to high or low levels, and change their status when needed (in C).
I have tested the device in NI MAX -> Test Panels, and found that the device is able to do this. Then I try to do it in C. I hace checked the examples, and the function I should use is the one called "DAQmxWriteDigitalU32". I have problem in understanding its input parameters. I have tried something with my own understanding, but it does not work as I expected. Here is one test I did:
uInt32   data=1;
int32 written;
TaskHandle taskHandle=0;
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle,"Dev1/port0/line7","",DAQmx_Val_ChanForAllLines));
DAQmxErrChk (DAQmxStartTask(taskHandle));
DAQmxErrChk (DAQmxWriteDigitalU32(taskHandle,1,1,10.0,DAQmx_Val_GroupByChannel,&data,&written,NULL));
taskHandle=0;
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle,"Dev1/port0/line0","",DAQmx_Val_ChanForAllLines));
DAQmxErrChk (DAQmxStartTask(taskHandle));
DAQmxErrChk (DAQmxWriteDigitalU32(taskHandle,1,1,10.0,DAQmx_Val_GroupByChannel,&data,&written,NULL));
I want to simply set "Dev1/port0/line7" and "Dev1/port0/line0" to high level, but only "Dev1/port0/line0" responds me. The second parameter of the function DAQmxWriteDigitalU32 corresponds to numSampsPerChan. If i replace it (currently 1) with a larger value, e.g. 100, I can see that "Dev1/port0/line7" sends a number of 1 out, then return back to 0. So I guess the problem is just that I do not understand well all parameters of the function DAQmxWriteDigitalU32. Can anyone please tell me how I can set a digital output line to 1 or 0? 
Thanks!
Hongkun
Solved!
Go to Solution.

Hello,
Here is a link explaining the inputs of function:
http://zone.ni.com/reference/en-XX/help/370471W-01/daqmxcfunc/daqmxwritedigitalu32/
Also here you can find a lot of examples in ANSI C
http://www.ni.com/example/6999/en/
Randy @Rscd27@

Similar Messages

  • USB-6009 Digital Output Current

    You need to have all those grounds connected together - USB-6009 Digital Ground, ULN2003 GND, and the power supply ground. In this case it will not matter how they are connected.  If they are not connected, then one of the devices could be damaged.
    Lynn

    Hi, I'm trying to increase the voltage of the digital outputs of USB-6009 device. I read a couple topics about using a relay but I could not manage it.
    I was thinking to use 5V supply on the card since it has 200mA current on it, but when I use it with open-collector output, it can not switch the relay. When I measure the current between
    5V and ground: 200mA,
    5V and output, I read a value around 30-40 mA.
    Why can't I use that 200mA with an output? This is the relay I'm using.
    If this is not possible, can I use an external 5V supply (with more current) and a digital output to switch the relay without damage the 6009?

  • Optical Digital Output Always On

    I have a 1-month old 2009 Mac Pro. The Optical Digital Audio Output (red light) is on in the back, but I do not use it. Is this a normal behavior? I've read one one post that it was normal but I was also told it is a "hardware issue" and isn't supposed to do that. Anyone else? Thanks.

    Let me also add, that in addition to the optical light always being on, sometimes when I wake my Mac from sleep, the "volume" and other alerts sounds come out of the internal speaker (even though it's set to Line Out). The only way to restore the alert sounds so they come from Line Out is to plug headphones into the front Line Out port or to logout/login. That's strange!! (I thought the update to 10.6.3 might address it, but I am feeling like it's something else).
    ??? Anyone have these same problems ???
    ((I tried trashing /Library/Preferences/com.apple.audio.DeviceSettings.plist and com.apple.audio.SystemSettings.plist - but it didn't help. I see a folder called Audio with these same to files, maybe I'll try trashing them all again.))

  • Trigger Solenoid Valve (Digital Output)

    I was wondering wether it is possible to use a trigger to send a signal to a digital output. I currently have to send a signal to a solenoid valve when the slope of the data I am acquiring starts to become negative. I know LabVIEW can do triggered data acquisition but can it send a signal to a digital output based on a trigger (falling edge)? I already know what code the signal should send. However, i tried trigger.vi without success. I am relatively new to LabVIEW and would really appreciate any help.
    Attachments:
    Moses_SBE_SSE_Triggered_Continuous_Acquisition.vi ‏76 KB

    Hi M^2,
    If all your trying to do is a software timed trigger as shown in the vi that
    you provided, theres a few things that I would change.  First off, I would
    create the digital output channel and start it prior to the loop.  Second,
    I would initialize the value of the digital output to high (I was using an
    inverse logic LED output) prior to the loop.  Then after the trigger is
    found, write the digital output to the opposite (low).  In addition, I
    changed the DAQmx read to 1 channel with N samples (1D DBL).  This seemed
    more appropriate if you’re just using one analog input channel. 
    I've gone ahead and uploaded the code I modified.  This is setup to my
    parameters.  Basically, I triggered when my thermocouple voltage rising
    edge went over 0.29V.  You will need to change these settings back to what
    you need for your application.  Also, I wanted to note that once the
    digital output is changed low when the trigger is found it will remain low
    until changed high again.
    I hope this helps,
    Paul C.
    Message Edited by Paul C. on 08-16-2007 03:34 PM
    Attachments:
    Moses_SBE_SSE_Triggered_Continuous_Acquisition (REVISED).vi ‏81 KB

  • NI DAQmx Digital Output Trigger To Start Analog Input Task

    Hi everyone.  I am using the NI DAQmx VIs to set a digital output line low (boolean '0').  I want to begin reading an Analog Input voltage (Start Analog Input Voltage reading task) right after the digital output line is set low.  I am using the DAQmx Start Trigger (Digital Edge).vi to try and do this.  I have the digital edge to trigger off a falling edge since the digital output line is being set low.  I am using "do/SampleClock" as the source into the DAQmx Start Trigger (Digital Edge).vi.  
    I don't have the DAQ card (PXI 6229) since someone else is using it but I wanted to write up the SW so that when it becomes available I can have SW to try out.
    I have attached the VI.  Am I setting up this VI correctly?
    Thanks!
    Attachments:
    Trigger AI Task Off DO Edge.vi ‏32 KB

    I think you are going to have to wire that Digital Output to a PFI line on the card with the Analog Input(s).  You then trigger on that PFI line.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Sort by 'High, Medium, Low'

    I've been working on a bit of an organization chart and made a Priority columns containing the values High, Medium and Low. How do I make a custom sort order for -High to Low- and -Low to High-?

    Or use:
    ! Low
    !! Med
    xxx High (Use ! for x. Forum doesn't like three exclamation points in a row, but Numbers can use them, and will sort as shown.)
    Or use:
    0 Low
    1 Med
    2 High
    and sort ascending to get the order above for either set.
    More than One Way Inc.
    Cat-skinning a specialty.
    Regards,
    Barry

  • No Digital Output available in Playback devices (USB audio device)

    If one has USB audio device with coax/toslink out, with proper drivers (like ie TurtleBeach Micro Advantage) available & installed then Digital Output is available to select in Playback devices. (and one can play AC3/DTS to external amplifier with ie
    VLC or MPC-HT with AC3Filter DS filter)
    But some USB devices (ie Phonic Digitrack -
    http://www.phonic.com/en/digitrack.html ) do NOT come with drivers (as Windows has default build in). Digitrack uses TI
    Burr-Brown USB Audio Codec 2906 -
    http://www.ti.com/product/pcm2906
    Sadly these Windows drivers do NOT have a clue about what the device actually has as inputs/outputs
    So even it had coax digital out & the sound IS send via it, the actual data send is in right way, not recognized/played correctly by Digital Amplifier (AC3/DTS)
    Does anybody know of a hack to make Digital Out available?
    Seb

    Hi,
    Generally speaking, An Audio Device do need more driver besides USB driver to make itself work properly. In terms of your situation, USB driver is not enough to make your Audio Device works properly.  I think S.Sengupta
    is right. Actually it would be better to contact Digitrack support to confirm its product compatibility with Windows 7.
    Roger Lu
    TechNet Community Support

  • 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.

  • USB-6009 pulse train generation with digital output....

    Hello!
    I've bought a new USB NI-Card (USB-6009) and now I'm trying to adopt an old vi that uses traditional DAQ drivers. I wrote that vi for a PCI NI-Card (PCI-6024E), which has two counters to generate two pulse trains simultaneously. Now I've only one counter and that's why I'm searching for a good way to create pulse trains using a digital output! The pulse trains are both ranging between 100 Hz and 100 kHz.
    I'm sure somebody has an idea how I can solve the probem in the best way
    Kind regards,
    Peter

    You can't do it with this low cost board. Both digital and analog outputs are software timed only. The analog out is rated at only 150  samples/sec and the digital is about the same. You can't even use one of the counters because it is not a hardware timed counter output. It is an event counter only as an input.

  • How to make Microphone Echo with USB SB Digital Music

    Dear,
    I just purchased USB Soundblaster Digital Music SX for my notebook.
    I personally purchased this one for my recording music and karaoke.
    I check on the "Creative Audio Center" that it doesnt have a profile / EQ for Microphone Echo-ing.....
    Is there anyone out there has or try to make the microphone does echo?
    I am using Windows Vista Home Premium?
    Thanks
    Message Edited by sknet on 04-7-2008 :53 AM

    I wanna know about that too, but i have a X-fi Platinum and Vista Ultimate. If anyone could tell how to add echo to the mic I'd appreciate!
    Regards,
    Notlim?

  • NI PXI 6229 DAQ Card Digital Output High/Low Levels

    Hi everyone, I can't seem to find in the NI PXI 6229 DAQ spec what the Digital Output high voltage and low voltage is when I set a digital signal high and low.  What is the voltage when I set a Digital Output "HIGH" and what is the voltage when I set a Digital Output "LOW"?
    Thanks! 

    See the digital I/O characteristics section of the specs. Typical ttl levels.

  • ITunes Digital Output using M-Audio Transit USB???

    Hi all,
    Having recently attached an M-Audio Transit USB external "soundcard" to my Mac Mini (PPC) and hooked up the TOSlink digital output from the Transit to my AV amplifier, I can definitely state that Apple DVD Player and VLC both utilise the Digital Output, giving me full 5.1 AC3 signals from DVDs/DivX movies etc, which I had hoped to be the case.
    However, I'm curious as to what the actual output from iTunes is. If I'm playing an Apple Lossles audio file, does iTunes decompress this to the original 44kHz PCM and send this through Core Audio straight to the Digital output of the Transit? In other words, am I getting bit-accurate audio information into the AV amp?
    Anyone who can confirm or deny this, please let me know, as this was one reason for me buying the Transit!!!!
    Also, any idea how to get DTS audio from a redbook CD out from this setup? Will VLC handle it? Or even iTunes???
    Thanks,
    JF
    15" Powerbook PPC G4 1.5 (1Gb RAM) + MacMini PPC G4 1.5 (512Mb RAM)   Mac OS X (10.4.6)  

    You can get full 5.1 AC3 signals from DVD because that's what the audio on the disk is encoded with. You won't get 5.1 AC3 or DTS signals from iTunes if the files are only encoded in stereo. I don't have a Transit, but I have the Sonica USB which is the previous model of the same device. They have different drivers (and your Intel Mac mini would have different drivers than a PPC Mac mini with the same Transit device), but I would guess we have similar experiences with the devices. You won't get DTS out of any file that's not DTS to begin with. That's one reason the Transit System Preferences pane will give you options to configure non-surround sound audio coming from your Mac mini to your stereo.
    -Doug

  • My digital output plug on my Imac has a broken rca in it can I disable the plug and make speakers work again?

    Does anyone know a way to restablish my speakers, there is a broken rca plug in the digital output.

    No because there is a micro switch built in the output port that tells the audio to use that output.
    1. Most times the broken jack can be removed with the correct size drill bit or small screw extractor because it is hollow. (shutdown and disconnect the power before attempting to remove the broken jack plug)
    2. If you do not have the correct tools to do the job, then take the iMac into your local Apple Store or AASP and have the broken plug remover.
    For more idea's, visit > removing a broken 3.5mm jack - Google Search

  • Digital output NI 9474

    Hello,
    I am trying to learn labVIEW DAQ, and right now I am trying to figure out how to use NI 9474 with labview. NI 9474 is a device with digital outputs. I have attached a (poorly drawn) schematic of how I have my real circuit wired. For some reason, the voltage across the resistor is 9v instead of whatever the digital output should be when i set daq assistant to be 1 sample on demand. When I change daq assistant to continuous samples, it reads 4.6v. So I am wondering what am I doing wrong and what should my digital output be?
    I have attached my vi file, so can someone please help me figure out how to use NI 9474 with labview?
    Solved!
    Go to Solution.
    Attachments:
    DO example.vi ‏44 KB
    schematic.png ‏16 KB

    You are supplying 9V, so you should have 9V going across the resistor.  I'm thinking what is happening with the Continuous Samples is that it is toggling between High and Low.  If you measured that with a DMM, you will get around 4.5V.  Measure with an oscilloscope to make sure what is happening here.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How can I send digital Output at faster rate than 1ms period?

    Hi!
    I'm using a PCI-6229 to send digital outputs to a power source and I need to send n different numbers in binary code. I need this to be periodic so I've used a while structure and the diferent numbers as the different components of an array. In this way the while loop writes the "task" repetedly at the period I have set to the loop using "wait until next ms multiple". So, it does what I want. The problem is that I need the loop to work at a higher rate than ms. It would be great if I could make it go at 0.01 ms. I have tried and even when the "wait until next ms multiple" doesn't like doubles it tries to work at this rate but the signal is not 100% periodic and I need it to be much more precise.
    Does anyone have an idea to solve my problem?
    Thanks a lot,
    Júlia

    I think the example you want to look at is Digital - Continuous Output.vi.  You can just use the onboard clock and set the sample rate to whatever you need (100kHz it looks like).
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

Maybe you are looking for