LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Retriggerable AI questions for the experts

  I am using a PCI-6111 and would like to acquire 2048 points at 5 MHz triggered at 100 Hz.  I am trying to use DAQmx.
 
Question 1:
 I downloaded the retriggerable pulse train generation example for analog input and it seems fine except that I need an analog trigger and the counter trigger only allows digital.  I modified the code (see attached) so that the analog input task has an analog trigger and then tried using AIStartTrigger as the source for my digital trigger for the pulse train generation.  This works sometimes, but not others.  Annoyingly when it doesn't work I receive no errors.  The check for available samples always returns 0 and I can see the counter is not triggering on a scope (well it changes level once, but never generates a pulse train).  I searched around and found another example posted (http://forums.ni.com/ni/board/message?board.id=170&message.id=189503#M189503) where a dummy analog output task is created to get an analog trigger.  Instead of using AIStartTrigger they use AnalogComparisonEvent.   Using AnalogComparisonEvent in my code instead of AIStartTrigger (but still in the AI task) seems to work fine.  Is there a reason I shouldn't be using AIStartTrigger?
 
Question 2:
  It seems that if my buffer is too small I get a similar sort of problem.  That is, I receive no errors, the available samples always return 0, and the counter never triggers.   In the retrig pulse generation example there is a cryptic remark about making the buffer 1000 points bigger than you need.  I find I generally need something more like 10x points if I purposely try to slow down the system by moving a window around, for example.  My question, though, is why do I not receive an error message and/or is there something I can check that will tell me there is a problem?  I think the problem has something to do with the buffer being overwritten before the first check, but I'm not sure...
 
0 Kudos
Message 1 of 4
(2,950 Views)
Hello Phamton,

To answer your questions:

1.  I know that using the AnalogComparisonEvent is the typical way to trigger a counter off of an analog signal.  The is the generally recommended method because the AnalogComparisonEvent comes straight from the analog comparison circuitry, however, the ai/StartTrigger signal should also work to start your counter task.  If this approach was not working sometimes, I would first suspect the signal that was connected to the trigger line, and whether or not it was actually meeting the trigger condition at those times.  Have you tried connecting a scope to the analog trigger signal when your program is not working? 

2.  I'm not sure of the exact reasoning for that comment in the example code, but even still, if you task is not starting, I would first suspect the actual analog signal that is being used as the trigger.  Connect it to a scope and make sure that it is meeting the trigger condition when you run that program.

In any case, if your analog input task never receives the start trigger, you should get a timeout error.  Let me know if you have any further questions about this issue.

Best regards,
0 Kudos
Message 2 of 4
(2,927 Views)

Jarrod,

I don't think it is a problem with the trigger meeting the specified conditions.  I can run the program changing only from AnalogComparisonEvent to AIStartTrigger for my digital edge and it will work every time with the AnalogComparisonEvent but only sporadically with AIStartTrigger.  It is also not like it is missing a trigger here and there.  When I use AIStartTrigger it either starts fine and triggers every single time or it doesn't trigger at all.  Similarly if I make the buffer size too small it just never triggers but returns no errors. 

My trigger is coming in continously at 100 Hz and it definitely is not changing on the scope.

Message Edited by Phamton on 03-22-2007 09:29 AM

0 Kudos
Message 3 of 4
(2,906 Views)
I saw that in your first post that you said you downloaded a retriggerable pulse train generation example.  Have you tried the 'Gen Dig Pulse-Retriggerable.vi?'   This example demonstrates how to generate a digital pulse from a Counter Output Channel on a digital trigger.  This example also shows how to use a Digital Start trigger, so the digital pulse is not started until a trigger signal is received.

The counter will output the pulse on the output terminal of the counter specified in the Physical Channel I/O control.  The output will be sent to the default output terminal on ctr0.  The trigger used to signal the start of the generation should be connected to the Trigger Source (PFI9) on your DAQ Device.

Give this a try and see if it works.  Let me know if you have any problems.
Elijah Kerry
NI Director, Software Community
0 Kudos
Message 4 of 4
(2,875 Views)