06-03-2008 09:04 AM
06-11-2008 09:45 AM
06-12-2008 02:06 AM
void
test(iBus *bus){
tAddressSpace cardSpace;
tTIO *board;
cardSpace = bus->createAddressSpace(kPCI_BAR1);
board =
new tTIO(cardSpace); //Resetboard->G01_Joint_Reset_Register.writeG0_Reset(1);
//load initial value of 0board->G0_Load_A_Registers.writeG0_Load_A(0x00000000);
board->G0_Command_Register.writeG0_Load(1);
//set source to internal timebase 3, the 80MHz internal clockboard->G0_Input_Select_Register.writeG0_Source_Select(30);
//set gate to external gateboard->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 gateboard->G0_Second_Gate_Register.writeG0_Second_Gate_Gating_Mode(1);
board->G0_Second_Gate_Register.writeG0_Second_Gate_Select(30);
//primary gateboard->G0_Second_Gate_Register.writeG0_Second_Gate_Polarity(1);
board->G0_Counting_Mode_Register.writeG0_Alternate_Synchronization(1);
//set counting direction to upboard->G0_Command_Register.writeG0_Up_Down(1);
//arm counterprintf("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.
06-23-2008 04:20 AM