Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

Semi-period measurement with M series board using RLP

Hi,
I'm trying to do a buffered semi-period measurement using register programming for M series board. I started with examples found in the forum but I doesn't work properly. The counter always increments instead od starting from zero for each measurement. I programmed the counter like discribbed in the DAQ-STC Technical Reference Manual and it doesn't work the counter still grows.
 
Can someone help ?
0 Kudos
Message 1 of 4
(7,316 Views)
Hello,
Can you attach your code? what example did you used?
Regards
Manuel R
AE dans une autre vie
0 Kudos
Message 2 of 4
(7,285 Views)
I started with gpct_ex5.cpp provided with ni660x RLP examples. This example do a pulsewidth mesurement. Here's the code :

void

test(iBus *bus)

{

tAddressSpace cardSpace;

tTIO *board;

cardSpace = bus->createAddressSpace(kPCI_BAR1);

board =

new tTIO(cardSpace);

//Reset

board->G01_Joint_Reset_Register.writeG0_Reset(1);

//load initial value of 0

board->G0_Load_A_Registers.writeG0_Load_A(0x00000000);

board->G0_Command_Register.writeG0_Load(1);

//set source to internal timebase 3, the 80MHz internal clock

board->G0_Input_Select_Register.writeG0_Source_Select(30);

//set gate to external gate

board->G0_Input_Select_Register.writeG0_Gate_Select(1);

board->G0_Command_Register.writeG0_Synchronized_Gate(1);

board->G0_Mode_Register.writeG0_Gating_Mode(1);

board->G0_Mode_Register.writeG0_Counting_Once(2);

board->G0_Mode_Register.writeG0_Gate_Polarity(1);

//set second gate mode, to inverse of primary gate

board->G0_Second_Gate_Register.writeG0_Second_Gate_Gating_Mode(1);

board->G0_Second_Gate_Register.writeG0_Second_Gate_Select(30);

//primary gate

board->G0_Second_Gate_Register.writeG0_Second_Gate_Polarity(1);

board->G0_Counting_Mode_Register.writeG0_Alternate_Synchronization(1);

//set counting direction to up

board->G0_Command_Register.writeG0_Up_Down(1);

//arm counter

printf("counter value is 0x%08lx\n",

board->G0_Save_Registers.readRegister());

board->G0_Command_Register.writeG0_Arm(1);

//delay long enough to receive a complete pulse

{

long int i,j;

printf("waiting for an external pulse on the gate...\n");

for(i=0;i<5000000;i++)

if(!board->G01_Status_Register.readG0_Armed_St())

break;

printf("i is %d\n",i);

}

//read counter value

//since the counter is not armed the value won't change, so just read it once

if(!board->G01_Status_Register.readG0_Armed_St()) {

printf("counter value is now 0x%08lx\n",

board->G0_Save_Registers.readRegister());

}

else{

printf("Error: did not detect a full pulse on the external gate.\n");

}

delete board;

bus->destroyAddressSpace(cardSpace);

}

What I want to do is ti modify this example to make a continuous semi-period measurement.

 
0 Kudos
Message 3 of 4
(7,276 Views)
HI,
The counter ASIC of a M series device is a DAQ STC 2 and not a DAQ STC (E series deivce). M Series boards are now supported by the Measurement Hardware Driver Development Kit (MHDDK). You can use RLP examples programming with E series devices and not with M series as you can see on this link:
http://digital.ni.com/public.nsf/allkb/B08F4125A9325B3F862565CC0073E68F?OpenDocument

You will have more informations about the MHDDK at this link:
http://sine.ni.com/nips/cds/view/p/lang/fr/nid/11737

Hope this help.
Regards

Manuel R
AE dans une autre vie
0 Kudos
Message 4 of 4
(7,216 Views)