01-22-2008 04:49 AM
01-22-2008 08:16 AM
I cannot replicate your system since I do not have a similar hardware here, but in my opinion you could avoid some hardware conflict by configuring a single task that acquires both of your channels at a time. You can do it in DAQ Assistant by selecting both channels when defining the new task. This will imply you use one TaskHandle, one creation function and one StartTask only in your program.
As per plotting on a different axis, the plot handle is the value returned by PlotY function, which you need to pass to SetPlotAttribute function.
An alternative to this is calling SetCtrlAttribute (dvdxt, DVDXT_SpeedTorqGraph, ATTR_ACTIVE_YAXIS, VAL_LEFT_YAXIS) (or VAL_RIGHT_YAXIS as required) before any plot.
Finally, your program does not responds to user interface events because while in the do loop you do not permit the system to handle UI events. Try adding a call to ProcessSystemEvents () in the loop so that user interaction on controls can be handles by the system.
01-22-2008 08:37 AM
The other issue with is new code is that I d like to write data to a file, I already have a control which contains the path for the data file, so I have tried to pick up this path by getctrlval function and then write to this file using writefile, but first I must open the file to get a filehandle which doesn't seem to work correctly, and the issue is that the array is 1024 double values and write file only write strings.
So I don't know how to handle that. Do you have any suggestions.
Although the ProcessSystemEvents function work perfectly thanks
Olivier
01-22-2008 09:01 AM
01-22-2008 10:14 AM
01-23-2008 03:46 PM
Hi Olivier,
The best place to get you started is by having you use the shipping examples. I’ve attached the KnowledgeBase from ni.com/kb that outlines where they are installed on your computer.
NI-DAQmx Shipping Examples in LabWindows/CVI
There is an example called “ContAcq-IntClk” (in the Analog In » Measure Voltage folder) that uses continuous acquire based on the internal clock. It’s equivalent to the example in LabVIEW. All it lacks is writing data to your file, so you can read about the different options for file reads/writes in the NI LabWindows/CVI Help (Start » All Programs » National Instruments » LabWindows CVI x.x » LabWindows CVI x.x Help) under Library References » NI-DAQmx Library » NI-DAQmx C Functions » Write Functions. These can also be found in the NI-DAQmx C References Help under NI-DAQmx C Functions » Write Functions.
If you keep getting error -200279, you can look at this KB:
Why Do I Get Error -200279 When Writing Continuously Acquired Data to a File?
I hope this helps.