I am designing a Labview code for an array of 32 electrodes that my lab is using. I am able to generate the voltage waveform I want as an analog signal, but need to output it as a digital one. I also need to output the same signal to 32 different DO lines on my NI DAQPad-6259.
I am trying to convert my generated analog signal into a digital one using a DWDT analog to digital vi, I have one physical channel connected currently, but when feeding all this into my mxWrite, I keep getting the error of having 1 line in my channel line (which there should be) yet 16 lines in my data (which there shouldn't be). Is there any way to fix this?
This is my first project with Labview, so I am not really experienced at all in the usage of DAQmx, but was told it was the better method than the DAQ assistant for multi-line output, so I apologize if it is some obvious mistake I made.
Thanks for any help.
Solved! Go to Solution.
I'm not *quite* following what you're doing but it looks like you just want to output a square wave on an output channel.
Try changing the "Resolution" input on your conversion function to 1 bit, that will generate a single line. If you want to duplicate that to multiple channels, duplicate it manually or with a For loop or something.
Right now, your Resolution input is set to 16 and it appears to be generating 16 channels.
As an aside, I'd take out your DAQmx stuff and get your waveform processing stuff working as intended, then add the output stuff back. It'll help isolate your problems.
I'm guessing you are not an EE or BME student, and don't really understand analog and digital signals. You are ultimately dealing with 32 digital 1-bit lines which can only take on two values -- True/False (or numeric 1/0, or TTL levels 5v/0v). If you want to generate a 1000 Hz symmetric square wave, all you have to do is output (at 2KHz) "the opposite logical value that you used the last time" (meaning if you last sent False, send True, and if you last sent True, send False, easily done with a Shift Register and a Not function). You could, of course, use this to build a Digital Waveform (hmm -- I should try this, as I seem to be saying "to get a 1KHz Square Wave, you need a 2KHz Digital Waveform", something I hadn't thought about, and which might not be true -- a reason to do LabVIEW Development in "little pieces" (i.e. with lots of small sub-VIs that "do one thing" that you can test and be sure "does what I want, not what I told it to do")).
You also don't understand LabVIEW's Principle of Data Flow (or else you want to send little bursts of data, restarting the DAQmx Task over and over again, something whose rationale escapes me). Again, there may be something you are trying to do that you aren't clearly communicating.
Something that may help you (which is good reason to do it) and would certainly help us (and anyone else who wants to use your code to control their electrodes) is to write a one-page Document that describes exactly what you want this system to do. For example, do you set Frequency, Amplitude, and Duty Cycle while it is running? What are acceptable parameters? Does it "auto-start" with whatever is set on the Front Panel? Is it supposed to allow the controls to be changed while running? Given that you are turning the individual lines On and Off, why have "amplitude" (On = On)? How does Time enter into this (I notice a Wait function in there)?