Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog Input timings and register programming with the 6034E DAQ

I'm using the NI-6034E DAQ under QNX. I'm programming my own driver and everything works fine except for the timing of the AI. It's a little bit unclear about the minimal timings we should set between each convert and start1 and start, etc. even if I read the chapter 2 of the DAQ-STC Technical Reference Manual. For example, if we want to acquire data from the six first channels in differential mode, I should be able to set the delay between each convert pulse to 50ns (of what I understood). If I load 0x1 in the AI_SI2_LOAD_B register, I will get overruns. Can anyone give help about the minimal timings and how to calculate everything in a simple way?

Here is a sample of code that I made. I tried to follow the chapter 2 of the DAQ-STC Technical Reference Manual and the aiex2.cpp that I downloaded from the Ni website.


void MyClass::AI_Scan_Start(void)
{
WriteWindowedMode16(JOINT_RESET, 0x0010); // ensure that no spurious glitches appear


WriteWindowedMode16(AI_START_STOP_SELECT, (START_STOP_Select_Register = 0x0060));


// AI_SI_Source_Select = 0
// AI_SI_Source_Polarity = 0
WriteWindowedMode16(AI_MODE_1, (Mode_1_Register &= 0xF82F));


WriteWindowedMode16(AI_SI_LOAD_B_HI, 0x0000);
WriteWindowedMode16(AI_SI_LOAD_B_LO, 0x0001); // (number of clocks from START1 to first START) - 1;


WriteWindowedMode16(AI_MODE_2, (Mode_2_Register &= 0xFF7F)); // AI_SI_Initial_Load_Source = 0;
WriteWindowedMode16(AI_COMMAND_1, (Command_1_Register = 0x0200)); // AI_SI_Load = 1;


/****** here, how can we calculate the minimal value for AI_SI_B ? *******/
WriteWindowedMode16(AI_SI_LOAD_B_HI, 0x0000);
WriteWindowedMode16(AI_SI_LOAD_B_LO, 0x00C7); // number of clocks between each START - 1;


WriteWindowedMode16(AI_MODE_2, (Mode_2_Register = 0x0000)); // AI_SI_Reload_Mode = 0;


// AI_SC_Gate_Enable = 0
// AI_Start_Stop_Gate_Enable = 0
// AI_SI_Write_Switch = 0
WriteWindowedMode16(AI_MODE_2, (Mode_2_Register &= 0x3FF7));


WriteWindowedMode16(JOINT_RESET, 0x0100);
}


void MyClass::AI_End_of_Scan(void)
{
WriteWindowedMode16(JOINT_RESET, 0x0010); // ensure that no spurious glitches appear
WriteWindowedMode16(AI_START_STOP_SELECT, (START_STOP_Select_Register = 0x2000));
WriteWindowedMode16(AI_DIV_LOAD_A, 0x0005); // AI_DIV_LOAD_A = number of channels per scan - 1
WriteWindowedMode16(AI_COMMAND_1, (Command_1_Register = 0x0080)); // AI_DIV_LOAD = 1
WriteWindowedMode16(JOINT_RESET, 0x0100);
}


void MyClass::AI_Convert_Signal(void)
{
WriteWindowedMode16(JOINT_RESET, 0x0010); // ensure that no spurious glitches appear


// AI_SI2_Source_Select = 0
WriteWindowedMode16(AI_MODE_3, (Mode_3_Register &= 0xF7FF));


/****** here, how can we calculate the minimal value for AI_SI2_LOAD_A and AI_SI2_LOAD_B ? *******/
WriteWindowedMode16(AI_SI2_LOAD_A, 0x0001);
WriteWindowedMode16(AI_SI2_LOAD_B, 0x0038);
WriteWindowedMode16(AI_MODE_2, (Mode_2_Register = 0x0100));
WriteWindowedMode16(AI_COMMAND_1, (Command_1_Register = 0x0800));
WriteWindowedMode16(AI_MODE_2, (Mode_2_Register = 0x0200));


WriteWindowedMode16(JOINT_RESET, 0x0100);
}


void MyClass::AI_Arming(void)
{
// AI_SI2_ARM AI_SI_ARM AI_DIV_ARM AI_SC_ARM
WriteWindowedMode16(AI_COMMAND_1, (Command_1_Register = 0x1540));
// WriteWindowedMode16(AI_COMMAND_2, (Command_2_Register = 0x4000)); // AI_End_On_End_Of_Scan
}


void MyClass::AI_Start_The_Acquisition(void)
{
WriteWindowedMode16(AI_COMMAND_2, (Command_2_Register = 0x0001));
}


Any help or comments would be appreciated.
If there is anything unclear in what I said, I can give more details.


Thanks a lot.


Francis
0 Kudos
Message 1 of 1
(6,336 Views)