07-31-2009 12:03 PM
I started trying to write a way to control hardware that allows a user to organise hardware based on what they have, and using a configuration file to define what signals (channels) are connected to what line on hardware.
I found
http://forums.ni.com/ni/board/message?board.id=180&message.id=38304&query.id=363765#M38304
I have defined an unnamed task, with a single channel "Ignition" as "Dev0/port0/line4" in a config file. My software loads this config and calls DAQmxCreateTask() and DAQmxCreateDOChan(task, "Dev0/port0/line4", "Ignition", DAQmx_Val_ChanForAllLines). On another computer with the same software, but different configuration file, this might be "Dev1/port1/line2".
I'm using the function DAQmxWriteDigitalScalarU32 to set this port and clear it. How can I determine the correct value when using DAQmxWriteDigitalScalarU32()? A value of 1 generally won't work (unless it's portX/line0)
One solution I have is to write -1 (0xFFFFFFFF), but then if I define multiple lines separated by commas, both lines will be set and I still have the problem if I want to separate them.
Like in the forum highlighted, the original user had initially expected that the DAQmx drivers would do the automatic bitshifting. Since it doesn't, I'm wanting to do that myself (for both reads and writes). So I need to understand how DAQmx internally takes the U32 and maps that to physical hardware. This will then become a DLL internally in our company for multiple programs and configurations.
Some notes:
I found that "Dev0/port2, Dev0/port1" means the lower 8 bits writes to port 2 and upper 8 bits writes to port 1. Is this only for 8-bit hardware (I've tested on a USB 6501, but I also have downstairs in my lab a PCI-DIO-96 card).
If I have 5 lines, over 5 ports, does this imply I can't use DAQmxWriteDigitalScalarU32()?
Thanks in advance,
Jason.
08-05-2009 02:15 PM
Hello Jason,
I would recommend to post this question in the Multifunction DAQ section where you sure would receive a good answer.
Regards
LDP
08-06-2009 03:51 AM