‎10-17-2008 08:36 AM
Solved! Go to Solution.
‎10-20-2008 11:33 AM
Hello Dan,
I understand that you are looking for the NI-DAQmx C Api functions necessary to program your USB-9472 in Visual Basic. Assuming that your computer is running a Windows OS, you can find the NI-DAQmx C API Visual Basic 6.0 Help document by going to Start >> Programs >> National Instruments >> NI-DAQ >> NI-DAQmx C API Visual Basic 6.0 Help. You will also need to refer to the NI-DAQmx C Reference Help document which is in the same folder. Lastly, if you would like to see the examples for DAQmx in Visual Basic, you can find the examples at the following (or a similar) location in your directory structure:
C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\Visual Basic 6.0
Best wishes,
Wallace F.
‎10-20-2008 12:08 PM
Hi Wallace,
I used the function DAQmxWriteDigitalLines.
Initially I tried with parameter: DAQmx_Val_ChanForAllLines and created 1 task for all lines. But the param. writeArray (which is of Byte type) accepts - in VB - only the values 0 or 1 (it should be between 0 and 255) i.e.:Dim ByteArray As Byte
DAQmxErrChk DAQmxCreateTask("", TaskHandle)
DAQmxErrChk DAQmxResetBufInputBufSize(TaskHandle)
DAQmxErrChk DAQmxCreateDOChan(TaskHandle, "Dev1/port0/line0:7", "", DAQmx_Val_ChanForAllLines)
ByteArray = 2
DAQmxErrChk DAQmxWriteDigitalLines(TaskHandle, 1, True, 5000, DAQmx_Val_GroupByChannel, ByteArray, 0, 0)
DAQmxErrChk DAQmxStartTask(TaskHandle)
StopTask (a subroutine to stop and clear the task)
For example, when I assign val. 2 (which is the equivalent to "00000010" in binary), I'm getting the following error message:
DAQmx error code = -200562
Error message = Measurements = Attempting writing digital data that is not supported.
If I assign values 0 or 1 to ByteArray, then everything it's OK, except that I can only activate line 1 (when ByteArray = 1)
So instead of using the param. DAQmx_Val_ChanForAllLines, I used DAQmx_Val_ChanPerLine and I created 4 tasks - 1 for each of the 4 lines that I am using to connect to the Switches.
This way I only need to use 0 (OFF) or 1 (ON) for each Line - and it works.
The Issue should be considered resolved.
Thank you and best regards,