Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

PXI-6528 access with DLL in Python

I'm trying to access my PXI-6528 to set and read ports from the DIO. I've imported the DLL, and am able to set up tasks, but can't actually write anything to a port. I haven't tried reading from a port yet, but that will be next.

The basic flow of the program is:
Create a task (DAQmxCreateTask)
Set up a digital output channel with 1 digital Output line: port 5, line 0 (DAQmxCreateDOChan)
Write to the task (DAQmxWriteDigitalLines or DAQmxWriteDigitalU8)

The main problem I've had (and where I suspect the problem is) is with the writing to the task. For some reason, when I write the function according to the function prototype in the DAQmx C Reference help, I get an error from Python stating "4 bytes missing". If I throw another Null pointer on the end, the function call works, and I don't get any error from the dll, but the output doesn't do anything. I can, however, set the output in the NI test panel.

I'll post the actual code that I'm using shortly.
0 Kudos
Message 1 of 2
(3,341 Views)
Found the problem . . . The ctypes "float" data type in python is actually 32 bits. I changed that to a C double and all seems to be working.

So now my question is: If I set a timeout value as a double, am I actually getting the timeout value that I think I am?
0 Kudos
Message 2 of 2
(3,337 Views)