03-02-2015 12:37 PM - last edited on 10-26-2015 04:48 PM by LiliMcDonald
So I decided to modify the code that way im not always reading. I created a case structure. when it's true I write data and when it's false i do nothing. but when I turn the case to falso I get error:
Error -200621 occurred at DAQmx Write (Analog 1D Wfm NChan NSamp).vi:6390002
This is what the explain error give me:
Onboard device memory underflow. Because of system and/or bus-bandwidth limitations, the driver could not write data to the device fast enough to keep up with the device output rate.
I notice when that happen the size of my data being read changed. It usually is 20 x 1613 but changed to 20 x16.
Also What is I wanted to select the channels I want to feed the waveform to, how would I go about that. Right now I am feeding the waveform to all 8 channels. I tried the waveform as 1x1 array but I get error 200524. Help please
see attached, it is only a modified portion of my code. I initialized 8 channels and used Diane S model to do the data read and write.
Admin Note - Attachments removed per user's request
03-02-2015 01:32 PM - last edited on 10-26-2015 04:48 PM by LiliMcDonald
I realize I had some missing Vi. Here's one with all the Vi attached
Admin Note - Attachments removed per user's request
03-02-2015 08:21 PM
There's not enough information in what you posted for me to be able to tell exactly what's going on, since just showing me the AO code is only half the picture. I can make some guesses, but I'd like to see more code...specifically, your entire DAQmx loop which contains both DAQmx Read and DAQmx Write.
Note that since those operations are synchronized, if you call DAQmx Read without also calling DAQmx Write (you know, as happens when your case structure is in the False case), you're going to get buffer errors. You need to call them both, exactly as I showed in an earlier post, every loop iteration. They are synchronized. They need to stay synchronized. Calling one without calling the other ruins the synchronization. Therefore...
If you don't want to Read with every loop iteration, too bad. You still have to do it. However, what you can do is decide to either ignore the data you read, or do something with it. If you don't want to send it to another loop for processing (for instance), have your Enqueue function in a case structure and then have logic which either enqueues the data or not.
Same with Write. You need to write data with every loop iteration. If you don't want to output any voltage on your AO lines for a particular loop iteration, write an appropriately-sized 1D array of waveforms where the data is all zeroes, so that the channels output 0V. It's your waveform generator that needs to be in your case structure, not DAQmx Write.
You also need to write to all of the channels with every loop iteration. If your task contains 8 channels, then you need to write to all 8 channels. If you only want a waveform coming out of channel 0, then write a waveform of the same size and sample rate, but containing all zeroes, to the other channels, so that those lines will output 0V. But you always need to provide a buffer for all channels in your task.
Please post the code which contains all of your DAQmx operations, and we'll take it from there. Sound good?
03-02-2015 08:45 PM
03-02-2015 08:47 PM
03-02-2015 11:20 PM
Your explanation isn't really very clear. Also, if you can't upload your entire code (which is fine), then take the time to write an example which illustrates your problem, and upload that. You need help, so it's up to you to make some effort here.
I'm not understanding your problem very well. Ok, you have a client which tells you which channel upon which to output data. Output data on that channel and output all zeroes on the other channels. Why is that a problem? Of course you cannot use an empty constant waveform, I pointed that out in my very first response to this thread. I have no idea what you mean when you say "I want it to output all zeroes data so I can see only noise". Then build a waveform which outputs all zeroes, as I advised...why is that difficult?
None of this is difficult, so I think you might just be confusing yourself! If you configure a task with 8 channels, then you must have data for all 8 channels. That is a requirement. You cannot get around it, so you need to work with it.
Look at the code below. If you don't understand something, try the LabVIEW help first. It really is a wonderful resource! Then ask for help. Before you ask for more help, write the example code that illustrates your problem.
03-03-2015 09:44 AM - last edited on 10-26-2015 04:48 PM by LiliMcDonald
Thanks for your reply, Here's my server vis. see attached
Admin Note - Attachments removed per user's request
03-03-2015 12:31 PM
Wow, that's some messy code. I'm not trying to be mean, but readability is very important. You have wire bends all over the place, many of which are hidden by various structures so you can't see which terminals are connected where, you have way too many error wires -- your next step should be to tidy up, to help you (and others!) read your code easily. Use a single error wire to enforce data flow. Branch where necessary, then recombine. Straighten out your wires. All of them.
That being said, you've done a nice job with adding comments here and there, especially in your case structures, so good for you!
I'm not sure what further help you need. I've already told you that you need to take DAQmx Write out of the case structure. So take DAQmx Write out of the case structure. I've already shown you how you can write a waveform only to selected channels, and write a waveform containing all zeroes to the other channels in the task.
You do have one problem with your DAQmx task setup that I can see. You're set to start your AO using the AI Start Trigger. Therefore your Write task will start when your Read task does. Right now, you're not controlling the order in which those tasks start, and you need to. Don't start your Read task until after your Write task has started. Use the error wire to enforce that:
Call DAQmx Write to preload the buffer.
Call DAQmx Start for your DAQmx Write task.
Route the "error out" wire to the "error in" input of DAQmx Start for your Read task.
Now your tasks are synchronized.
It seems like I've already told you how to solve your main problems, so try incorporating my advice (after cleaning up your code) and see how you do. Ok? I'd still recommend putting together a little example application for yourself which concentrates on the DAQmx aspect. Experiment with only outputting a sine wave on selected channels, as I showed you. You need to develop a bit more understanding of DAQmx, and taking it one piece at a time will help you. I frequently write little examples for myself when I'm trying to understand a concept, so I can play with things and see how they work. It's very valuable.
You've come a long way, so don't give up now. Keep working at it! You're doing fine.
03-03-2015 01:36 PM
I know thanks for helping. I appreciate it very much.
Somewhat that 200621 error keep popping up. and when it doesnt happen the server works fine. As soon as I select the channel I want to affect with the waveform it crashes and give me error 200524. I 'm trying to troble shoot it but I cant seem to put my hands on it yet.
03-03-2015 04:00 PM
I see one issue. Inside the for loop when you select 2 channels, that changes the dimension of the array from 8 to 10 therefore causing the 200524 error.