Chapter 6: AD12-8 Windows Driver Reference
Manual Number: 00650-014-4
Page 6-15
AD128_MeasureFreq
Function:
Measures an unknown frequency.
Syntax:
Visual BASIC:
AD128_MeasureFreq(Byval range as Integer, freq as Single) as Integer
C:
int PASCAL AD128_MeasureFreq(int range,float *freq);
range:
Range of the unknown frequency.
*freq:
Pointer to return the measured frequency.
Notes:
The following external connections are required:
1.
The counter 1 output, pin 23 should be connected to digital input
bit 0, pin 25, and to the gate of counter 0, pin 21.
2.
The unknown frequency should be connected between the clock of
counter 0, pin 2, and digital ground, pin 11.
Use
range
= 0, if the unknown frequency is less than 500KHz. Use
range
= 1 for frequencies greater than 500KHz, and up to 2.6MHz.
The error of this function at 1Khz is 3%, and increases rapidly for
frequencies less than 1KHz. As frequencies increase above 1KHz, the error
decreases, for example at 10KHz, the error is only 0.3%.
The frequency range for this function is 0.001 to 100kHz.
Error Codes:
AD128_SUCCESS:
Operation was performed without error.
INVALID_PTR:
The point to return the frequency was not valid.
AD128_MeasurePeriod
Function:
Measures an unknown period.
Syntax:
Visual BASIC:
AD128_MeasurePeriod(Byval range as Integer, period as Single) as Integer
C:
int PASCAL AD128_MeasurePeriod(int range,float *period);
range:
Range of the unknown frequency.
*period:
Pointer to return the measured frequency.
Notes:
See
AD128_MeasureFreq
for setup and usage instruction, as this function
is an inverse of
AD128_MeasureFreq()
.
Error Codes:
AD128_SUCCESS:
Operation was performed without error.
INVALID_PTR:
The point to return the period was not valid.
Summary of Error Codes
0: AD128_SUCCESS:
The function was completed without error.
1: RESERVED
2: CONFIG_CODE:
A configuration code passed to the initialization routine was not a
0 for manual configuration or a 1 for auto configuration.
3: BASE_ADDRESS:
The base address provided to the driver was not between 200 hex
and 3F8 hex.