Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog In Reading Order

Hi all,

 

I need your help with the attached code.  What the code does is very sample.

 

1. Initialized my compactdaq.  I am just using my 9204, which is a analog input.  I am using the first 7 channels.  The first six channels would only be read one time at a particular time instance.  The 7th channel need to be read continuously to detect the trigger.

2. Waiting for the trigger

3. After the trigger is set, I need to wait 3 sec before I take data, since the trigger indicate the movement of a motor and it takes 3 sec for the motor to arrive at where I want it to be.

4. Go back to check the trigger.

 

My question are.

 

It seems like I am not read the most recent sample or I am not emptying the buffer as I thought that I could.  I thought I only need to use "n channels 1 samples" since I just need the most recent samples.  Later, I used "n channels n samples", thinking that I can empty the buffer that way.

 

I need some tutorial that go deeper into the DAQ operation.  It would be for the best that if I can declare the trigger channel as a continuous channel and the reading channels finite channels.  But I don't think I can do that. 

 

Yik

 

 

 

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 2
(2,979 Views)

Hello Yik,

 

Thank you for using NI forums.  You mentioned that you were using a 9204, but this is a digital module so I'm assuming you meant the 9205.  One thing I noticed about your code is that you don't seem to have an actual DAQmx Trigger VI.  The 9205 supports analog edge triggering, which would allow you to set a level (2.5 V) and begin acquisition once your signal went above or below this level (programmable by you).  Also, this VI will allow you to set the source of the trigger, so you won't have to constantly read all 7 channels to look for the trigger on the last channel.  There is an article titled Tips and Techniques in Data Acquisition Triggering - NI-DAQmx that I think will help you to setup an analog edge trigger. 

 

There is also an example which performs retriggerable analog acquisition using an analog edge trigger, which is exactly what you are trying to do, but this example requires the use of a counter.  Are you using a cDAQ-9172 chassis or is your module connected using a USB sleeve?  Also, do you have access to any other modules (specifically digital modules)?  The cDAQ chassis has two onboard counters, but you need a digital module to access them.  If you have access to this, you should be able to implement your application fairly easily.  Let me know if you have any further questions.

 

Regards,

0 Kudos
Message 2 of 2
(2,949 Views)