Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital IO Monitoring

I have developing my NiDAQ Application on NI 3036E card using Borland Delphi 6 on Windows XP.
My Application is to monitor the input on D6 (digital IO), my application is working fine so far if the periode of High level on D6 signal is greater then 1ms. If below that value, some change on D6 may be lost.

I just pooling the status of D6. This is a part of my application :

   Status:= DAQ_Start(1,1,-1,@LocalRawDataArray,10000,0,0);

   Repeat
      Status:=DAQ_Check(1,@DAQStopped,@Retrived);
      Dig_In_Line(1,0,6,@StateOut);
      If Retrived <> LastRetrived then begin
          LastRetrived := Retrived;
          BitD6[LastRetrived] := StateOut;
      End
   Until (Retrived = 10000);

   Status := DAQ_VScale(1,1,-1,1,0,10000,@LocalRawDataArray,@LocalDataVoltArray);

I start data acquisition using DAQ start to get 10000 sample on AI channel 1, then waiting until Data Retrived equal to 10000 data. While data acquitsition is not complete, I check the status of D6.
Because the actual high level periode signal applied to D6 is 300us only, my application is not working. Can you have any idea or solution ?
For your information I used P4 2.8G with 512Mb RAM.

I have another question. If I set break point at "status := DAQ_VScale(...), this mean the data acquisition have got 10000 samples on LocalRawDataArray, but when I look at that array, there are only 5000 data... only half ? but after i execute DAQ_VScale, on LocalDataVoltArray have 10000 data ? Why ?
Can you explain that ? This is wierd....
Please help me.

Thank you for any help from National Instrument Engineer.

Susanto W


0 Kudos
Message 1 of 11
(4,206 Views)
 

Hi Susanto-

If you are using a PCI-6036E you should consider programming in NI-DAQmx instead.  It is much more intuitive and easier to use and offers considerably better performance than Traditional DAQ.  This KB explains how to use NI-DAQmx with Borland C and Delphi.

Because of the polling nature of your reading you will only be able to observe signals that are in a high state long enough for the polling step to occur again.  One alternative would be to use a counter to measure a rising edge on the signal and to read the count value to see if there has been a change.

The reason your DAQ_VScale changes the array size is that it converts an integer binary array to a double-precision volt array.  This results in a doubling of the effective size of the array.

I would strongly suggest that you consider updating to NI-DAQmx for your programming.  Examples of various operations are installed with NI-DAQ versions 7.x in this location on your local drive: C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C

 

Thanks-

Tom W
National Instruments
0 Kudos
Message 2 of 11
(4,193 Views)

Hallo Tom,

Thank you for your answer,
I am wondering, what is the difference between Traditional NiDAQ and NiDAQmx ? Is it a new driver for my niDAQ card ?

Susanto W

0 Kudos
Message 3 of 11
(4,184 Views)
 

Hi Susanto-

Yes, NI-DAQmx is indeed a new driver API for controlling your DAQ board.  It is a really awesome and easy to use package that makes programming much more intuitive and offers better performance in most applications.  All of the new M Series DAQ boards and any other boards to be released in the future are and will only be supported by NI-DAQmx, so while your E Series board will continue to be supported in Traditional NI-DAQ it would be a great idea to switch over to NI-DAQmx now for all new applications.

More information about the differences between Traditional NI-DAQ and NI-DAQmx are summarized in this article.  In order to illustrate the power and versatility of NI-DAQmx we have published this tutorial Learn 10 Functions in NI-DAQmx and Solve 80% of Data Acquisition Applications.

I hope this helps!

Thanks-

Tom W
National Instruments
0 Kudos
Message 4 of 11
(4,166 Views)
Hi Tom,

After learning all information from your links pointed to me, I could not find any function call information. When I bought Ni 3036E and DAQ-card 700 3 years ago, on that package include 2 books : NI-DAQ User Manual for PC Compatibles and NI-DAQ Referrence Manual.
From NI-DAQ Referrence Manual, I knew the function call to controll my Ni 3036E using Delphi, but I am not sure the function call on that book also support for Ni-DAQmx driver 7.4. So, where I could find any information to point me to that function call library for NiDAQmx 7.4 ?

Thank you for your help.

Susanto W








0 Kudos
Message 5 of 11
(4,144 Views)
 
Hi Susanto-
 
The function calls for NI-DAQmx are very different from the NI-DAQ (now known as Traditional (Legacy) NI-DAQ) calls you read about in the book you indicated.
 
Your DAQcard 700 is now obsoleted and is only supported up to NI-DAQ 6.9.3.  Your E Series card is supported by the current available version of NI-DAQmx 7.4.
 
The NI-DAQmx C Reference Help file installs with the NI-DAQmx 7.4 installer and contains documentation of all of the NI-DAQmx functions.  I have attached it to this message in case you would like to check it out before installing.  NI-DAQmx also installs examples for various ADEs including ANSI C in this location: C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C
 
Since you mentioned you are using Delphi, I should also point you to this KnowledgeBase: How Can I Use The NI-DAQmx ANSI C Function Library With Borland C and Delphi?  
 
I hope this helps-
Tom W
National Instruments
0 Kudos
Message 6 of 11
(4,126 Views)
Hallo Tom,

Thank you, your last answer could make me know what to do with my application.

On Ni-3036E there are 3 kind of GND pin, AIGND, AOGND, and DGND.
If I use AI, AO and Digital I/O... is it posible to connect all those kind of GND or I must connect all those GND pin  ?

I have a wierd situation to control using digital I/O when I connected AO output and AOGnd to  motor servo controller. Do I need to connect all these 3 GND pin ?
For your information, I configured AI to be Single Ended Reference.

Please help me.

Thank you
Susanto W
0 Kudos
Message 7 of 11
(4,102 Views)

Hi Susanto-

That is a great question- in E Series (and M Series) cards all of the grounds are internally referenced together to the same ground plane.  So, all of the various GND pins are internally "wired" together and do not require any external connections for your application.

Thanks-

Tom W
National Instruments
0 Kudos
Message 8 of 11
(4,094 Views)

Hallo Tom,

I am wondering with 2 consecutive command below :

...
        Status := Select_Signal(1,ND_IN_Convert,ND_PFI_2,ND_HIGH_TO_LOW);
        Status := DAQ_Config(1,0,1);

...

Is the NIDAQ configuration that has configured with first command altered by DAQ Config command ?

Thank you for you help.
Susanto W



0 Kudos
Message 9 of 11
(4,060 Views)
Hi Susanto-
 
You should call the DAQ_Config function before the Select_Signal function.  The DAQ_Config settings tells the card to expect an external sample clock.  The Select_Signal then tells the card where to expect the external sample clock (in your case PFI2).  The setting is not explicitly altered, but these two calls definitely rely on each other to work properly
 
I hope this helps-
Tom W
National Instruments
0 Kudos
Message 10 of 11
(4,052 Views)