02-14-2005 06:00 AM
02-14-2005 08:26 AM
02-14-2005 09:14 AM
02-14-2005 09:23 AM
02-14-2005 11:40 AM
02-15-2005 07:54 AM
02-15-2005 08:45 AM
05-21-2007 05:18 AM
Hi,
I would like to ask some queries regarding gated event counting to be done by using NIDAQmx using VB 6.0 or VB.Net
1) I would like to use 7 counters ( 6 as source and 1 as gate)
2) Would like to assign the RTSI from the gate to other 6 counter source
3) Have a program written in Traditional DAQ and need to transform the same function of the program using NIDAQmx drivers
4) Sample code from traditional DAQ is
iStatus = GPCTR_Control(i6602DeviceNum, ND_COUNTER_2, ND_RESET)
iStatus = GPCTR_Control(i6602DeviceNum, ND_COUNTER_3, ND_RESET)
iStatus = GPCTR_Control(i6602DeviceNum, ND_COUNTER_4, ND_RESET)
iStatus = GPCTR_Control(i6602DeviceNum, ND_COUNTER_5, ND_RESET)
iStatus = GPCTR_Control(i6602DeviceNum, ND_COUNTER_6, ND_RESET)
iStatus = GPCTR_Control(i6602DeviceNum, ND_COUNTER_7, ND_RESET)
Err "c2-7 reset"
iStatus = GPCTR_Set_Application(i6602DeviceNum, ND_COUNTER_2, ND_SIMPLE_EVENT_CNT)
iStatus = GPCTR_Set_Application(i6602DeviceNum, ND_COUNTER_3, ND_SIMPLE_EVENT_CNT)
iStatus = GPCTR_Set_Application(i6602DeviceNum, ND_COUNTER_4, ND_SIMPLE_EVENT_CNT)
iStatus = GPCTR_Set_Application(i6602DeviceNum, ND_COUNTER_5, ND_SIMPLE_EVENT_CNT)
iStatus = GPCTR_Set_Application(i6602DeviceNum, ND_COUNTER_6, ND_SIMPLE_EVENT_CNT)
iStatus = GPCTR_Set_Application(i6602DeviceNum, ND_COUNTER_7, ND_SIMPLE_EVENT_CNT)
Err "c2-7 set_app"
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_2, ND_GATE, ND_RTSI_0)
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_3, ND_GATE, ND_RTSI_0)
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_4, ND_GATE, ND_RTSI_0)
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_5, ND_GATE, ND_RTSI_0)
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_6, ND_GATE, ND_RTSI_0)
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_7, ND_GATE, ND_RTSI_0)
Err "c2-7 set gate"
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_2, ND_SOURCE, ND_PFI_31) ' SOURCE_2
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_3, ND_SOURCE, ND_PFI_27) ' SOURCE_3
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_4, ND_SOURCE, ND_PFI_23) ' SOURCE_4
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_5, ND_SOURCE, ND_PFI_19) ' SOURCE_5
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_6, ND_SOURCE, ND_PFI_15) ' SOURCE_6
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_7, ND_SOURCE, ND_PFI_11) ' SOURCE_7
Err "c2-7 set source"
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_2, ND_INITIAL_COUNT, 0)
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_3, ND_INITIAL_COUNT, 0)
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_4, ND_INITIAL_COUNT, 0)
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_5, ND_INITIAL_COUNT, 0)
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_6, ND_INITIAL_COUNT, 0)
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_7, ND_INITIAL_COUNT, 0)
Err "c2-7 initial count"
iStatus = GPCTR_Control(i6602DeviceNum, ND_COUNTER_2, ND_PROGRAM)
iStatus = GPCTR_Control(i6602DeviceNum, ND_COUNTER_3, ND_PROGRAM)
iStatus = GPCTR_Control(i6602DeviceNum, ND_COUNTER_4, ND_PROGRAM)
iStatus = GPCTR_Control(i6602DeviceNum, ND_COUNTER_5, ND_PROGRAM)
iStatus = GPCTR_Control(i6602DeviceNum, ND_COUNTER_6, ND_PROGRAM)
iStatus = GPCTR_Control(i6602DeviceNum, ND_COUNTER_7, ND_PROGRAM)
Err "c2-7 program"
' Generate next gate
iStatus = GPCTR_Control(i6602DeviceNum, ND_COUNTER_0, ND_RESET) ' Reset counter
iStatus = GPCTR_Set_Application(i6602DeviceNum, ND_COUNTER_0, ND_SINGLE_PULSE_GNR) ' Set counter type
iStatus = Select_Signal(i6602DeviceNum, ND_RTSI_0, ND_GPCTR0_OUTPUT, ND_DONT_CARE) ' Output to RTSI 0 line
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_0, ND_SOURCE, ND_INTERNAL_100_KHZ) ' Set clock
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_0, ND_COUNT_1, GateLength / 10) ' Low cycles (10%)
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_0, ND_COUNT_2, GateLength) ' High cycles
iStatus = GPCTR_Control(i6602DeviceNum, ND_COUNTER_0, ND_PROGRAM)
5) I have tried to use DAQmxSetChanAttribute to set the channel as source and to also to set the trigger, but I don't have any similar function like that in VB, It will be great if I am getting some assistance in letting me to know the function.
Thanks in advance
05-22-2007 04:04 PM
07-02-2015 11:32 AM
One example of when you would need to set up the gated count this way (instead of using the much simpler frequency) is when the pulses you want to count don't come at regular intervals. For instance, you might be counting nuclear decay events.