Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

digital IO using daq legacy function in Visual C

Hello.

 

I'm trying to control stage by digital I/O through PCI 6503.

I wrote a Labview program using DAQmx sub VIs, but it's not working.

So I plan to use functions in DAQ legacy such as "DIG_PRT_CONFIG".

The reason what I'm doing is because I have a piece of C code from manufacturer, which is written in DAQ legacy environment.

 

BTW, firstly, I'm trying to read a port. I used the example code in "//National Instrument/NI-DAQ/example" folder.

The following is that code. (I slightly changed)

 

#include

 

"nidaqex.h"

/*

* Main:

void

{

 

* Local Variable Declarations:

*/

main(void)/*

i16 iStatus = 0;

i16 iRetVal = 0;

i16 iDevice = 2;

i16 iPort = 0;

i16 iMode = 0;

*/

 

i16 iDir = 0;

i32 iPattern = 0;

i16 iIgnoreWarning = 0;

 /* Configure port as input, no handshaking. */

 

 

 

iStatus = DIG_Prt_Config(iDevice, iPort, iMode, iDir);

iRetVal = NIDAQErrorHandler(iStatus,

iStatus = DIG_In_Prt(iDevice, iPort, &iPattern);

iRetVal = NIDAQErrorHandler(iStatus,

"DIG_Prt_Config",iIgnoreWarning);"DIG_In_Prt",iIgnoreWarning);"test.txt", "w");" The digital pattern on port %d is (DECIMAL) %ld\n", iPort, iPattern);

FILE *fp;

fp=fopen(

fprintf(fp,

I used "i16 iDevice = 2;", because in MAX, PCI 6503 is assigned as Dev1, first one is another board("PCI 6110E") I'm using.

And, this code gives error code -10401. I know DAQ legacy is supporting PCI 6503, so I don't know why this error is occured.

18993i3F3623B960CA4803

 

Also, I used another VI program which detects board in DAQmx, DAQ legacy. In this program, all devices are well detected by DAQmx, but not in DAQ legacy.(samely, give error code -10401).

I'm attaching the LabView program in this post.

 

 

 

 

aa

 

0 Kudos
Message 1 of 1
(3,725 Views)