08-05-2013 01:49 PM
I am using my PCI-6251 to monitor an incoming voltage, when a voltage rise begins an output signal is triggered thru the use of a counter output. Also in this VI there is a structure for image acquisition. What I am trying to add is data logging for several analog inputs. I have a line for multiple channel read but it does not capturing any data. Could someone give me some direction where I may be making a mistake. I cannot use a while loop, it uses a lot of processing power and makes the triggering unstable.
08-05-2013 02:16 PM
Probe the error wire in the AI loop and see if there's something wrong with the setup.
08-05-2013 02:30 PM
Is there some error I should be looking for? There are no errors in the loop showing, and the vi runs without error.
08-05-2013 03:02 PM
I have only looked at the picture of your code, but I would say that, if the code is, indeed, being run (set breakpoints to confirm), then you either have an error in/out of the DAQmx Read or you are passing in a bad number into the number of samples (or timeout, whichever you wired up to the DAQmx Read) which might make the timeout too small or the number of samples you desire too few. Try setting the timeout to -1 and set the number of samples to something like 1000 and then probe the array coming out of the Read. If you get samples there then you can assume the error is writing it to the file.
08-10-2013 07:30 AM
I had set the timeout to -1 and the samples were set to 1000 per channel. I probed the array and found no data. There must be an error with the task being initiated but I cannot see how. Could the re-triggerable be causing an issue? Can a daqmx read block function outside a while loop?
Thanks
08-12-2013 09:44 AM
Several things I notice about your VI:
1) You have two separate tasks referring to AI channels on Dev 1. I suspect that the first task will error with a -50103 error. Since this is the start trigger for your other tasks, I suspect that none of these tasks will run. You should combine the two AI tasks into one. If you only want to log channels 1-4, then do this by processing the data read.
2) I'm not sure that Start.Retriggerable is supported for AI tasks on M Series devices like the 6251. This may result in an error. In any case, since you've set the task up to be continuous, this property doesn't really make sense.
3) I'd run with highlight execution on... 'Number of buffers 2' exits the sequence structure then feeds your for loop... I'm not sure that this data will be available until the first frame of your sequence structure is done. This may imply that your tasks will start long before you attempt to read data. This can often lead to errors.
Can you provide a description of what does happen when you run this? Which tasks run/return data? Are you certain that none of these tasks return errors? If you had read in a while loop, and didn't stop on error I can see where this would use a lot of CPU, because essentially the loop would spin as fast as it could, while continually returning the same error.
Hope that helps,
Dan
08-12-2013 10:55 AM
I removed the IMAQ stuff which I don't have installed, and cleaned up the DAQmx code to get it working with a simulated 6251. Have a look and see if this works for you. The things I did were the following:
1) Put all channels in same task. I removed channel 0 because nothing was done with the data read.
2) Stopped loops on error (this is something you'll want to do if you're going to use while loops).
3) Don't use Start.Retriggerable for your AI task (not supported on M Series, and not valid for continuous tasks).
Hope that helps,
Dan