02-24-2020 05:41 AM - edited 02-24-2020 05:45 AM
Hi all,
I have a 6509 PXI module. I would like to write an array of values across multiple digital output lines. I have been looking at the NI examples, but I'm missing something. The code snippet I have, is as follows:
Is this sufficient to write the array, 'digitalWritedataArray' across 32 lines, starting at port0, line 0? Or, is some loop necessary?
Any clarification would be great.
Thanks..
Paul
03-05-2020 11:10 AM
I'm a LabVIEW guy who doesn't know the text API in any detail, but I think you might need to make a change to this code.
It looks like you're writing to a 32-bit port and you've configured the task to handle all lines as 1 shared channel. Under LabVIEW (and I suspect probably also under, what, C?), you would update all 32 lines simultaneously by writing a single unsigned 32-bit integer value where each individual bit represents a line. Line 0 is the LSB, line 31 is the MSB.
Another way to do things is to configure the task to treat each line as a separate channel. Then the way to update all lines at once under LabVIEW is to write a length-32 array of booleans to the task. It's possible (though I'm not anywhere near sure) that the text API will take a length-32 array of integers such as you have in your code.
It doesn't have to matter which method you choose, but you have to keep the config and the datatype consistent. Right now you have one from each category which probably won't do what you want.
As to the 2nd question, you should plan to have a loop where you write different data each iteration. (It isn't entirely clear what your full dataset will be as the posted code appears to define only 1 single static value for all your digital lines.) You'll likely need some kind of timing control in the loop to slow it down, and can start by using some kind of software delay function. That's probably all you can do as I don't think your device supports hardware-timed DO.
-Kevin P