You can control NI 5641 programmatically using the supplied NI-5640 instrument driver.

The NI-5640 instrument driver controls the NI 5641 in its default personality of two synchronous input and two synchronous output channels. You also can run the NI-5640 examples to demonstrate the functionality of your device.