07-11-2018 09:33 AM
Hi everyone,
I am working with a PXI-6259. Port 0 has 32 outputs (0 to 31), I would like to drive it as a 4 8 bit output.
I tried to made two channels and added them to one task (as seen in picture 1) but I was not able to accomplish this.
Something like PXI_AD/port0/line0:7 and PXI_AD/port0/line8:15
Is there any way to modify 8 bit individuals without changing the other ones, also without knowing what is in the other bytes?
07-11-2018 11:22 AM
Hi Jason,
The idea with a task is that configure it, and then carry it throughout your application. So once you configure the task, you can use it as the input for the DAQmx Write function. You don't need the "start task" VI, I think the Write VI can do it automatically if you wire in the correct input.
You can either create a separate task for each group, or just build all your bits into a single array. But don't try to put all your lines onto a single task and then update different portions at different times.
Also, you could greatly reduce the number of controls you have if you turn your boolean controls into arrays, since you just build them into an array on the block diagram anyway.
07-15-2018 11:47 PM
I'm not familiar with your device. Some DIO units I have used allow for several types of "groupings", but as near as I can tell, your device considers P0 as a 32-bit register.
Still, you can (sort of) have your Cake and Eat It, too. Since it takes less time to write 1 32-bit register than to write 4 8-bit registers (since you only have to do one DAQmx Write), and since you "know" at any time the status of the 4 8-bit registers, simply whenever you need to write one, combine all 4 together and write them all at once. To carry the "Cake" analogy further, you can create an array of 4 U8s for the four 8-bit quantities you want to write, modify them as you wish (or as the code dictates), then whenever you need to update your output device, typecast the Array into a single U32 and use a single DAQmx Write to output everything. Very fast, very simple, very logical. [I'd create a sub-VI that takes the Array of 4 Bytes and does the DAQ Write, call it something like "Update Digital Output", and "hide" the details of converting the 4 Bytes to a single U32 and writing to DAQ]
Bob Schor