Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

PCI 6601 ANSI C example codes in Linux

Hello,

 

I'm trying to use the provided ANSI C example codes to test PCI 6601 card. The example code is in following path: usr/local/natinst/nidaqmx/examples/ansi_c/Digital/ReadValues/ReadDigChan

 

there are 3 files in the folder: Makefile, NIDAQmx.h, ReadDigChan.c

 

i'm trying to complie ReadDigChan.c by using "gcc" command.

 

However i recevied the following message:

 

/temp/ccosRed4.o(.text+0x52): In funtion 'main':

: undefined reference to 'DAQmxCreateTask' 

/temp/ccosRed4.o(.text+0x77): In funtion 'main':

: undefined reference to 'DAQmxCreateChan'

/temp/ccosRed4.o(.text+0x93): In funtion 'main':

: undefined reference to 'DAQmxStartTask'

/temp/ccosRed4.o(.text+0xd8): In funtion 'main':

: undefined reference to 'DAQmxReadDigitalLines' 

/temp/ccosRed4.o(.text+0x149): In funtion 'main':

: undefined reference to 'DAQmxGetExtendedErrorInfo'

/temp/ccosRed4.o(.text+0x15d): In funtion 'main':

: undefined reference to 'DAQmxStopTask'  

.

.

 

I just wonder how to fix the above errors ? is there any step I have to do before I complie ReadDigChan ? How does Makefile work ? 

 

I'm very new to linux system. I dun actaully know how to "create task" like the "Steps" mentioned in the ReadDigChan.c

 

if possible, can you provide me an example code ?   

  

 

The OS I'm using is SUSE 9.2

 

 

Thanks a lot,

 

 

Kevin

  

 

0 Kudos
Message 1 of 12
(4,585 Views)

Hi Kevin,

 

Based on the error messages you are receiving, it looks like you have not downloaded DAQmx.  You should be able to use this driver:  http://joule.ni.com/nidu/cds/view/p/id/1194/lang/en

 

Here are a couple of links that may be helpful:   

 

Makefiles: http://www.wlug.org.nz/MakefileHowto

GCC:  http://www.faqs.org/docs/Linux-HOWTO/GCC-HOWTO.html

 

Regards,


h_baker
National Instruments
Applications Engineer
0 Kudos
Message 2 of 12
(4,562 Views)

hello,

 

thanks for quick reply. I think I fixed that problem already.  but I'm having the other problem regarding the power supply pin of PCI 6601.

 

I have a lieanr encoder connect to the power supply pin of PCI 6601. However, it seems that the encoder not received any voltage from that particular pin ( I think it is "pin 1" on PCI 6601). I just wonder whether there is any power control bit that i have to turn on first or the power trace supported to be connect to encoder directly regardless.

 

 

Kevin

0 Kudos
Message 3 of 12
(4,548 Views)

Hi Kevin,

There is no bit that you have to turn for the 5 V pin. This is connected to the power supply from the computer, so it is always on, always high.

 

What linear encoder are you using, can you link the specifications? Do you know what the current draw of the encoder is? Looking at the Power section of the 6601 specifications page, it looks like the 6601 has 4.75-5.25 V at 1 A available at the IO connector.

 

Do you have a handheld DMM or another measurement device that you can use to measure and verify that the 5 V pin is outputting? It is possible for this pin to be bent or damaged while the rest of the card works, so that is something to check.

 

Regards,

Mallori

Mallori M
National Instruments
Sr Group Manager, Education Services

ni.com/training
0 Kudos
Message 4 of 12
(4,532 Views)

hi !

 

thanks a for the quick reply again! i found out that the fues was burned ! but we fixed that.

 

 

Kevin 

0 Kudos
Message 5 of 12
(4,525 Views)

hello,

 

I just wondering where I can find the ANSI_C function definition and body ?

 

 

Kevin

0 Kudos
Message 6 of 12
(4,496 Views)
What function are you referring to in particular?  How is this affecting your current program?
Regards,


h_baker
National Instruments
Applications Engineer
0 Kudos
Message 7 of 12
(4,469 Views)

hi,

 

I'm trying to figure out whether provided c - functions for PCI 6601 are able to exectue the following instuctions:

 

(1) First, I want to open a terminal and create a program to run "count" commands for linear encoder ( the progam runs 24 hours a day and 7 days a week ), it keeps counting

 

the positions of linear codes regardless and runs like a background program. but not "retriving"  or "reading" positions from memory.

 

(2) second, open the other terminal to "read" current position (access the memory where it is located) whenever it is needed without closing the "counting" terminal. Meanwhile,

      the "counting" program is still counting and updating the data for current position.

 

it is kinda like running two programs in parallel, and two of programs can access each other's. The reason why we want to do this is to prevernt the incorrect readings from linear codes happening. For example, linear encoders move accidently overnight.

 

if the described process is possibly to be done,  what functions I suppose to use ? or is there any alternative way to achieve the above process ?

 

Kevin

 

   

0 Kudos
Message 8 of 12
(4,459 Views)
You need to write a program that uses a parallel structure.  In one loop you need to have your counting program, look at the Count Digital Events example. In the second loop use the counting program and implement an event structure that will return the value at that time upon user requests.
Regards,


h_baker
National Instruments
Applications Engineer
0 Kudos
Message 9 of 12
(4,422 Views)

hello Baker,

 

thanks for the reply. I'm write the code by applying multiThreadings concept. However i'm having touble to compling the code by using "make" commend.

It gives me a "segmentation fault" . is there any step required to modifiy the "Make" file in order to complie the ni ansi_c code with pthread.h lib ?

 

kevin

0 Kudos
Message 10 of 12
(4,395 Views)