12-11-2008 04:10 AM
Hello,
I've got a problem with the BufferedPositionMsr with my pci6602.
The while-loop doesn't stop because there are always no values in the buffers.
My questions are:
Is it possible to use the internal clock as a gate ?
Is it possible to use the pin ND_PFI_32 as a trigger or any other pin ?
Or are there any other problems or confilcts ?
Thank you very much for your replies !
my source code:
GPCTR_Control(1 /*BoardNumber*/, ND_COUNTER_0, ND_RESET);
GPCTR_Control(1 /*BoardNumber*/, ND_COUNTER_1, ND_RESET);
GPCTR_Set_Application(1/*BoardNumber*/,ND_COUNTER_0, ND_BUFFERED_POSITION_MSR);
GPCTR_Set_Application(1/*BoardNumber*/,ND_COUNTER_1, ND_BUFFERED_POSITION_MSR);
GPCTR_Change_Parameter(1, ND_COUNTER_0, ND_ENCODER_TYPE,ND_QUADRATURE_ENCODER_X1);
GPCTR_Change_Parameter(1, ND_COUNTER_1, ND_ENCODER_TYPE,ND_QUADRATURE_ENCODER_X1);
GPCTR_Change_Parameter (1/*BoardNumber*/, ND_COUNTER_0,ND_BUFFER_MODE, ND_DOUBLE/*ND_SINGLE*/);
GPCTR_Change_Parameter (1/*BoardNumber*/, ND_COUNTER_1,ND_BUFFER_MODE, ND_DOUBLE/*ND_SINGLE*/);
Set_DAQ_Device_Info (1/*BoardNumber*/, ND_DATA_XFER_MODE_GPCTR0,ND_UP_TO_1_DMA_CHANNEL);
Set_DAQ_Device_Info (1/*BoardNumber*/, ND_DATA_XFER_MODE_GPCTR1,ND_UP_TO_1_DMA_CHANNEL);
GPCTR_Change_Parameter (1/*BoardNumber*/,ND_COUNTER_0 , ND_GATE, ND_INTERNAL_20_MHZ);
GPCTR_Change_Parameter (1/*BoardNumber*/,ND_COUNTER_1 , ND_GATE, ND_INTERNAL_20_MHZ);
GPCTR_Change_Parameter(1/*BoardNumer*/, ND_COUNTER_0, ND_INITIAL_COUNT, 0);
GPCTR_Change_Parameter(1/*BoardNumer*/, ND_COUNTER_1, ND_INITIAL_COUNT, 0);
Select_Signal(0/*BoardNumber*/, ND_START_TRIGGER, ND_PFI_32,ND_LOW_TO_HIGH);
GPCTR_Change_Parameter (1/*BoardNumber*/, ND_COUNTER_0,ND_START_TRIGGER, ND_ENABLED);
GPCTR_Change_Parameter (1/*BoardNumber*/, ND_COUNTER_1,ND_START_TRIGGER, ND_ENABLED);
GPCTR_Control(1/*BoardNumber*/, ND_COUNTER_0, ND_PROGRAM);
GPCTR_Control(1/*BoardNumber*/, ND_COUNTER_1, ND_PROGRAM);
unsigned long lges1, lges2;
while((lges1<const1) || (lges2<const2))
{
sprintf(Message,"Points1 %ld Points2 %ld",lges1,lges2);
MessagePopup("Points",Message);
GPCTR_Watch (1,ND_COUNTER_0, ND_AVAILABLE_POINTS,&lges1);
GPCTR_Watch (1,ND_COUNTER_1, ND_AVAILABLE_POINTS,&lges2);
}
GPCTR_Read_Buffer (1 /*BoardNumber*/, ND_COUNTER_0, ND_BUFFER_START, 0, lges1/*Nsamp1*/, 10.0,&count, Tags1);
GPCTR_Read_Buffer (1 /*BoardNumber*/, ND_COUNTER_1, ND_BUFFER_START, 0, lges2/*Nsamp2*/, 10.0,&count, Tags2);
Solved! Go to Solution.
12-11-2008 05:49 AM
Hello,
I've found something addtional:
GPCTR_Watch returns a nosetuperror.
12-15-2008 04:40 AM
Hi,
first I have a question.
does this application have to be programmed with traditional Daq, or would the newer driver,
DAQmx, also be an option?
DAQmx is much easier to handle than trad DAQ.
Marco Brauner NIG
12-16-2008 02:16 AM
Hello,
this source code is traditional daq.
But I've solved the problem by my self. It isn't possible to route the internal clock to the gate of the counters.
(Link: http://digital.ni.com/public.nsf/allkb/63AE9149A2AEF85A86256F2B005D0E7D)
I've got a workaround here:
GPCTR_Control(1,ND_COUNTER_X,ND_RESET); //X for the counter number
GPCTR_Set_Application(1,ND_COUNTER_X,ND_PULSE_TRAIN_GNR);
GPCTR_Change_Parameter(1,ND_COUNTER_X,ND_COUNT_1,2);
GPCTR_Change_Parameter(1,ND_COUNTER_X,ND_COUNT_2,2); //Generate 5Mhz Clock
Select_Signal(1,ND_COUNTERX_OUTPUT,ND_COUNTERX_OUTPUT,ND_LOW_TO_HIGH); //Or route it to the gate
GPCTR_Control(1,ND_COUNTERX,ND_PROGRAM);
PS: I would not like to use DAQmx because I'm just expanding an old project and I think it isn't a good idea to mix DAQ and DAQmx.