Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

ND_BUFFERED_POSTION_MSR with pci6602 Labwindows/cvi 8.5

Solved!
Go to solution

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);

0 Kudos
Message 1 of 4
(4,114 Views)

Hello,

I've found something addtional:

GPCTR_Watch returns a nosetuperror.

 

0 Kudos
Message 2 of 4
(4,110 Views)

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

0 Kudos
Message 3 of 4
(4,091 Views)
Solution
Accepted by topic author andre.wagner.ext@heidelberg.com

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.

0 Kudos
Message 4 of 4
(4,083 Views)