I'm trying to measure duty cycle but I'm getting inconsistent results. With a function
generator sending 70% duty cycle signal, I randomly get 30%. Looking at
the buffer, it looks like device is starting the counter while the
signal is low and not high so I end up being off by one semi period but I have no way of determining that. Is there a way to configure the card to
always start measurement when signal is high?
Here's the code in VB6 showing how I'm configuring it.
er = GPCTR_Control(m_uiDeviceNumber, ND_COUNTER_0, ND_RESET) er = GPCTR_Set_Application(m_uiDeviceNumber, ND_COUNTER_0, ND_BUFFERED_SEMI_PERIOD_MSR) er = GPCTR_Config_Buffer(m_uiDeviceNumber, ND_COUNTER_0, 0, 22, Buffer&(0)) er = GPCTR_Change_Parameter(m_uiDeviceNumber, ND_COUNTER_0, ND_SOURCE, ND_INTERNAL_100_KHZ) er = GPCTR_Change_Parameter(m_uiDeviceNumber, ND_COUNTER_0, ND_SOURCE_POLARITY, ND_LOW_TO_HIGH) er = GPCTR_Change_Parameter(m_uiDeviceNumber, ND_COUNTER_0, ND_GATE, ND_PFI_9) er = GPCTR_Change_Parameter(m_uiDeviceNumber, ND_COUNTER_0, ND_GATE_POLARITY, ND_LOW_TO_HIGH) er = GPCTR_Change_Parameter(m_uiDeviceNumber, ND_COUNTER_0, ND_INITIAL_COUNT, 0) er = GPCTR_Control(m_uiDeviceNumber, ND_COUNTER_0, ND_PROGRAM)
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.