/***************************************************************************** * Function: Acq_Init * * Preconditions: CPLD_Init has been called * * Overview: Sets delays for each analog channel * * Input: none * * Output: none * ******************************************************************************/ void Acq_Init(); /***************************************************************************** * Function: Set_ACQ_Mode * * Preconditions: everything has been initialized correctly. * * Overview: Sets the charging potential on all enabled channels * * Input: ACQ_MODE_NORM = Normal, No calibration pulse generated * ACQ_MODE_0pC = no charge, but calibration circuit fires as normal * ACQ_MODE_200pC = 200pC charge setting. charges 100pF cap to 2Volts * ACQ_MODE_1000pC = 1000pC charge setting. charges 100pF cap to 10Volts * Preset = 1, Cal Charge Level is set, but need ext cal trigger to activate * meaningless for ACQ_MODE_NORM setting * ******************************************************************************/ void Set_ACQ_Mode(char Mode, char Preset); /***************************************************************************** * Function: Calib_All_Chan * * Overview: Performs calibration on each enabled channel * * Input: none * * Output: adjusts Gain and Offset value based on calibration pulses * ******************************************************************************/ void Calib_All_Chan(); /***************************************************************************** * Function: Init_Delays * * Overview: determines loop delay time and sets cal delays appropriately * * this routine scans each channel through the complete range of delay possible. * at 8.4nS per CPLD click and 8 bit range gives 2.142uS range, or 1.07uS one-way trip. * At 4nS/m, the speed of the LMR-400, that's a max run of 272m or 900feet... * * When Cal_Delay = 0, the INT windows should start on the very next clock after the * trigger is received. (for bench testing) * * Input: Chan_ON[Chan] * * Output: Cal_Delay, INT1_Width, INT2_Width, Reset_Delay * ******************************************************************************/ int Init_Delays(); /***************************************************************************** * Function: Get_Cal_ADC() * * Overview: Performs calibration on each enabled channel * * Input: fake=1 if CPLD not yet programmed for doing three acq. at once... * * Output: adjusts Gain and Offset value based on calibration pulses * ******************************************************************************/ void Get_Cal_ADC(); /***************************************************************************** * Function: Get_Data_ADC() * * Overview: Normal Data Acquisition Routine * * Input: none * * Output: fills pC_Adj with data calibrated in nC * ******************************************************************************/ void Get_Data_ADC(); /***************************************************************************** * Function: Scale_Data_pC() * * Overview: scales raw ADC data into pC * * Input: Data_Raw[] * * Output: fills pC_Adj with data calibrated in nC * ******************************************************************************/ void Scale_Data_pC(); /***************************************************************************** * Function: Clin(reading, Chan) * * Overview: returns linear fit to data, uses 0pC and 1000pC only * * Input: ADC reading and Chan * * Output: linearly adjusted value * ******************************************************************************/ float Clin(unsigned long counts, unsigned Chan); /***************************************************************************** * Function: Trigger_Enable(char data) * * Overview: enables/disables External triggers * * Input: triggers enabled with a '1' in the appropriate bit position * Trig_Chan0 = Bit[0] = Chan 0 trigger enable * Trig_Chan1 = Bit[1] = Chan 1 trigger enable * Trig_Chan2 = Bit[2] = Chan 2 trigger enable * Trig_Chan3 = Bit[3] = Chan 3 trigger enable * Trig_Cal = Bit[4] = External Cal Trigger * Output: none * ******************************************************************************/ void Trigger_Enable(char data); /***************************************************************************** * Function: Read_Ground() * * Overview: Set MUX to read ground pin voltage. * * Input: none * * Output: Averaged Ground Readings * * Author: David G. Brown * * Date: June 5, 2008 * ******************************************************************************/ void Read_Ground(int PON); /***************************************************************************** * Function: Calibrate() * * Overview: Does Calibration. * * Input: none * * Output: * * Author: David G. Brown * * Date: June 9, 2008 * ******************************************************************************/ void Calibrate(int Cal_PON);