I was hoping I could get this done on my own and that it would not be that difficult. After all, I recently got through a pDaq-55 (Omega sells one of your USB units) project OK. I've quickly found myself needing to ask someone a few questions. That, of sample code to study. Anyway... this is a PCI-6229 project.
At this point I am trying to do a little digital-out. In one case I am just trying to toggle one line using the following sequence:
DAQmxCreateTask create the task
DAQmxCreatDoChan selecting one line for output Dev1/Port0/Line0
DAQmsStartTask start the task
DAQmxDigitalWriteU32 do the write, the data is simply one longint = FFFFFFFFh or 0 and only one is written.
DAQmxStopTask stop the task
DAQmxClearTask clear the task
This seems to work OK, but, I have a question. Can I create the task, then start/stop it many times and then close it, or do I need to create/start/stop/clear each time I want to toggle the same line?
Next job, create a task where I write to several lines at once:
DAQmxCreateTask create the task
DAQmxCreateDoChan selecting six lines for output Dev1/Port0/Line0, line1, line3, line8, line9, line10
DAQmsStartTask start the task
DAQmxDigitalWriteU32 do the write, trying different values for the data but nothing works so far. Again, only one integer is sent.
DAQmxStopTask stop the task
DAQmxClearTask clear the task
Here I am not getting the results I expect, and I think my question boils down to what data I need to send. I've tried sending one 32-bit integer where the bits corresponding to each line (0,1,2,8,9,10) are set to 1 or 0 (i.e. hex 707 to set lines 0-2 and 8-10 high), then I tried sending a 32-bit integer where only bits 0-5 were set, each bit corresponding to a channel instead of a line (hex 3F for channels 0-5). Finally, I have tried sending a sequence of numbers to see what happens, and all that happens is line 0 is toggled low every time I send an even number, and high if I send and odd number. This makes me think that I need to send one integer per line, 6 data total, for six channels.
But, the other thing that is odd about this is that lines while line 0 toggles, line 2,9,1 and 0 are low and lines 1 and 10 are either high or high-z. (The LED I have hooked to them do not light.) This makes me think I've screwed up the channel configuration, but I've viewed every argument the ChanU32 function is sent and it looks OK, plus I'm using the same procedure in both cases here. When I write to one line it works, which tells me I can configure at least one channel correctly, when I write to 6 lines, it doesn't. In this latter case I call the Chan function 6 times, each time specifying one channel.
So far the help files have been able to explain the commands, but not really how to use them. After the install all of the sample code provides using functions other than the DAQmx type. I seem to recall having more sample code with my v7.4 drivers, but the update seems to have deleted them.
Thanks in advance.