Gary Rubin Posted May 13, 2009 Report Share Posted May 13, 2009 Hello all, I'm trying to get a counter-based application set up using a PCI-6601 counter board. I haven't done NI DAQ in years, and this is my first foray into DAQmx. I feel like I'm really fumbling around here. My current approach is to find an example that has part of what I want to do and cobble it together with parts of other examples. It's a lot of trial and error (mostly error). I'm not finding the DAQmx Help particularly helpful either. It explains how to call each function, but that's really only helpful if you know which function to use in the first place. Any advice on where to start? In case anyone has any insight, here's what I'm trying to do: 1. Counter0 generates a pulse train at a constant rate. This represents the system trigger. 2. Counter1 generates a pulse train which is synchronous with Counter0 and delayed from it. 3. Counter1 uses the Pause Trigger Property so that it is suppressed when one of the DIO lines is high. When the DIO line returns to low, it Counter1 pulses should come back in the same place relative to Counter0. I can get 1 and 2, but not 3, or 1 and 3, but not 2. If I make Counter0 and Counter1 part of the same task, then they are synchronous, but the Pause Trigger property seems to only work on tasks, not channels, so I can't apply it to Counter1 without applying it to Counter0. If I make Counter0 and Counter1 differents tasks, so I can apply the pause to just Counter1, I lose synch between the two counters. I tried using DAQmx Start Trigger (Digital Edge).vi to sync the Counter1 task with Counter0, but get an error that I can't use both Pause and Start triggers in the same task. I then tried using the ArmStart property instead of the VI mentioned above. This worked fine, until I unpaused; Counter1's pulsetrain was then synchronous with the unpause, rather than Counter0. Can anyone offer any advice, or at least point me toward some useful resources? If I remember right, it was this confusion of how to find the right tools that led me to use traditional DAQ for my last DAQ project, even though DAQmx was available at the time. Thanks, Gary EDIT: Cross-posted at NI Forums Quote Link to comment
Grampa_of_Oliva_n_Eden Posted May 13, 2009 Report Share Posted May 13, 2009 QUOTE (Gary Rubin @ May 12 2009, 10:27 AM) Hello all,I'm trying to get a counter-based application set up using a PCI-6601 counter board. I haven't done NI DAQ in years, and this is my first foray into DAQmx. I feel like I'm really fumbling around here. My current approach is to find an example that has part of what I want to do and cobble it together with parts of other examples. It's a lot of trial and error (mostly error). I'm not finding the DAQmx Help particularly helpful either. It explains how to call each function, but that's really only helpful if you know which function to use in the first place. Any advice on where to start? In case anyone has any insight, here's what I'm trying to do: 1. Counter0 generates a pulse train at a constant rate. This represents the system trigger. 2. Counter1 generates a pulse train which is synchronous with Counter0 and delayed from it. 3. Counter1 uses the Pause Trigger Property so that it is suppressed when one of the DIO lines is high. When the DIO line returns to low, it Counter1 pulses should come back in the same place relative to Counter0. I can get 1 and 2, but not 3, or 1 and 3, but not 2. If I make Counter0 and Counter1 part of the same task, then they are synchronous, but the Pause Trigger property seems to only work on tasks, not channels, so I can't apply it to Counter1 without applying it to Counter0. If I make Counter0 and Counter1 differents tasks, so I can apply the pause to just Counter1, I lose synch between the two counters. I tried using DAQmx Start Trigger (Digital Edge).vi to sync the Counter1 task with Counter0, but get an error that I can't use both Pause and Start triggers in the same task. I then tried using the ArmStart property instead of the VI mentioned above. This worked fine, until I unpaused; Counter1's pulsetrain was then synchronous with the unpause, rather than Counter0. Can anyone offer any advice, or at least point me toward some useful resources? If I remember right, it was this confusion of how to find the right tools that led me to use traditional DAQ for my last DAQ project, even though DAQmx was available at the time. Thanks, Gary First let me suggest cheating. If your I/O is something that can be configured and tested in MAX then use the wizard to save the task. THen in LV drop a task constant and one of the pop-up will generate code that matches what MAX did. I don't think your situation can use that approach. Next (still cheatting) I log a call with NI support and tell them what I am trying to do and ask them to provide an example. Done cheating now suggestions to help with the hard stuff. When you are navigating for properties and methods, make sure you use output tasks on outputs etc. This caught me off-guard since they have the same naames but using the wrong version will return errors. THat basicly gete me through most of my I/O challenges. I hope it helps you! Ben Quote Link to comment
Gary Rubin Posted May 13, 2009 Author Report Share Posted May 13, 2009 :headbang: Quote Link to comment
Anu Kalidas Posted May 14, 2009 Report Share Posted May 14, 2009 QUOTE (Gary Rubin @ May 12 2009, 09:27 AM) 2. Counter1 generates a pulse train which is synchronous with Counter0 and delayed from it. How did you implement the delay between counter 0 and counter 1 generation? Quote Link to comment
Gary Rubin Posted May 14, 2009 Author Report Share Posted May 14, 2009 QUOTE (Kal @ May 13 2009, 12:35 AM) How did you implement the delay between counter 0 and counter 1 generation? DAQmx Create Channel (CO-Pulse Generation-Frequency).vi has an Initial Delay input. I use that. Quote Link to comment
Gary Rubin Posted May 14, 2009 Author Report Share Posted May 14, 2009 QUOTE (neBulus @ May 12 2009, 10:49 AM) Next (still cheatting)I log a call with NI support and tell them what I am trying to do and ask them to provide an example. Ben, Thanks for the feedback. I did try calling NI support. I was pointed at various Knowledge Base articles which were somewhat related to what I wanted. He also said that what I am trying to do should be possible, but requires very low-level timer control, so it might not be very straightforward. We ended up going with an external logic chip on a breadboard that took 20 minutes to setup and is working like a charm. Gary Quote Link to comment
peteski Posted May 23, 2009 Report Share Posted May 23, 2009 QUOTE (Gary Rubin @ May 12 2009, 10:27 AM) In case anyone has any insight, here's what I'm trying to do: 1. Counter0 generates a pulse train at a constant rate. This represents the system trigger. 2. Counter1 generates a pulse train which is synchronous with Counter0 and delayed from it. 3. Counter1 uses the Pause Trigger Property so that it is suppressed when one of the DIO lines is high. When the DIO line returns to low, it Counter1 pulses should come back in the same place relative to Counter0. I can get 1 and 2, but not 3, or 1 and 3, but not 2. If I make Counter0 and Counter1 part of the same task, then they are synchronous, but the Pause Trigger property seems to only work on tasks, not channels, so I can't apply it to Counter1 without applying it to Counter0. If I make Counter0 and Counter1 differents tasks, so I can apply the pause to just Counter1, I lose synch between the two counters. I tried using DAQmx Start Trigger (Digital Edge).vi to sync the Counter1 task with Counter0, but get an error that I can't use both Pause and Start triggers in the same task. I then tried using the ArmStart property instead of the VI mentioned above. This worked fine, until I unpaused; Counter1's pulsetrain was then synchronous with the unpause, rather than Counter0. Hmm, If I remember correctly, there are 4 counter timers on that board. Would it be possible to add a third counter in the mix, so that: Counter 0 is the constant clock Counter 1 is the pausable counter Counter 2 is triggered off of Counter 1 I have not played with the Pause trigger in any way, shape, or form, so I'm not (yet) familiar with its behavior. I have found that the counter timers can be very useful and versatile on these boards and on the MIO boards, but I almost always have to "re-learn" things when I dive back into them. -Pete Liiva Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.