LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

[NI-6602]double counter, counter 2 doesn't trigger

Hi,
 
We have a problem with a simple solution. We are using two counters to generate two wave forms with a shift in it. The solution works perfect with the combination of the counters 0,1,3, 4, 5 and 6. But in a combination with counter 2 on the other hand, it just won't work. If we are using a combination of counter 0 and 2, ctr 0 out generates a wave while the out of ctr2 remains at 0 volt. Ctr1 out has the correct high status, while ctr 3 out remains also low.
 
 
 
FPI 0.7 is used as trigger.
This error occures on the two PXI-boards and a PCI-card with CVI 8.5.
There should be no broken board.
 
Are we missing some information about counter 2?
 
The part of the dll we created:
 
 
int DLLEXPORT DLLSTDCALL i32_NI6602_CreateDAQTaskPhaseShift  (TaskHandle *taskOutPhaseShiftA,
                       TaskHandle *taskOutPhaseShiftB,
{
//Snip -- Definitions for the calculation for delay and frequency.
 
 int32 DAQmxError = DAQmxSuccess;
    TaskHandle taskOutA, taskOutB;
  
// Snip -- Calculations for the phases A and B, period a.s.o..
 
 DAQmxErrChk(DAQmxCreateTask ("TaskOutA", &taskOutA));
 DAQmxErrChk(DAQmxCreateTask ("TaskOutB", &taskOutB));
 DAQmxErrChk(DAQmxCreateCOPulseChanTime (taskOutA, CounterA, "ChannelName0", DAQmx_Val_Seconds, DAQmx_Val_Low,
           PhaseA, LowHighTime, LowHighTime));  
 DAQmxErrChk(DAQmxCreateCOPulseChanTime (taskOutB, CounterB, "ChannelName2", DAQmx_Val_Seconds, DAQmx_Val_Low,
           PhaseB, LowHighTime, LowHighTime));  
 DAQmxErrChk(DAQmxCfgImplicitTiming (taskOutA, DAQmx_Val_FiniteSamps, NrPulses));
 DAQmxErrChk(DAQmxCfgImplicitTiming (taskOutB, DAQmx_Val_FiniteSamps, NrPulses));  
 DAQmxErrChk(DAQmxCfgDigEdgeStartTrig (taskOutA, DigitalIO, DAQmx_Val_Rising));
 DAQmxErrChk(DAQmxCfgDigEdgeStartTrig (taskOutB, DigitalIO, DAQmx_Val_Rising)); 
    *taskOutPhaseShiftA = taskOutA;
    *taskOutPhaseShiftB = taskOutB;
Error:
 return DAQmxError;
}
 
 
Part of the GUI which is calling the function from the dll.
 
     ChannelDIO = 7;
     OnOff = 1;
     i32_NI6602_CreateDAQTaskDigitalIO (&HandleDIO[0], DEVICE, ChannelDIO);
     
     i32_NI6602_CreateDAQTaskPhaseShift (&HandleChannel[0], &HandleChannel[2], DEVICE, Frequency, NrOfPulses, UpDown); 
     
     DAQmxStartTask (HandleChannel[0]);
     DAQmxStartTask (HandleChannel[2]);
     
 
//Generating the arming
     Delay(0.1);
     
     DAQmxWriteDigitalLines (HandleDIO[0], 1, 1, 1.0, DAQmx_Val_GroupByChannel, &OnOff, NULL, 0);
         
     
     Delay(0.1);
     
     OnOff = 0;
     
     DAQmxWriteDigitalLines (HandleDIO[0], 1, 1, 1.0, DAQmx_Val_GroupByChannel, &OnOff, NULL, 0);
    
     Delay(0.1);
//End trigger     

     DAQmxStopTask (HandleDIO[0]);
     DAQmxClearTask (HandleDIO[0]);
 
 
Tanks for your attention.
0 Kudos
Message 1 of 3
(3,282 Views)

Hi Co,

Does it only happen when you use two counters? 

Could you please try it in a project with only counter two? And then post this code in this forum.

thanks,

Bas van Dijke
AE, Netherlands

0 Kudos
Message 2 of 3
(3,228 Views)
Hi,
 
We found the solution to our problem. As far you can name it a solution because we still suspect the presence of a bug in the CVI or the NI-6602 board.
When the autostart of the assignment of PFI7, the signal used to trigger both the counters, is removed and the Handle of PFI7 is done by hand as follow snippet explains.
 
 ChannelDIO = 7;
     OnOff = 1;
 
i32_NI6602_CreateDAQTaskDigitalIO (&HandleDIO[0], DEVICE, ChannelDIO);
DAQmxStartTask (HandleDIO[0]);
 
Counter two will run perfectly when the trigger has been set. The rest of the code, by the way, is the same as in the first post.
 
The second solution is that when we run the code with the autostart untill 'generating arming' comment and then activate PFI7 with the measurement and automation explorer, counter two will run. With this there is an exception, this work-around will only work when the task connected to PFI7 is running while the C-code is running. Otherwise counter 2 will remain low.
 
Counter 2 runs perfectly when used alone and the solved problem only occurs when two counters are used and one counter is counter 2.
 
Is this a bug or are we overlooking some details about conter/timer 2?
 
Greetings,
Co.
0 Kudos
Message 3 of 3
(3,186 Views)