XJAPI_ReadPinFrequency

Measures the frequency of the signal on an XJLink pin.

XJAPI_ERROR XJAPI_ReadPinFrequency(
    unsigned int pinNumber,
    unsigned int timePeriodMilliSeconds,
    unsigned int *frequencyHz
);

Version

This function was added in XJTAG version 3.2.8 and so requires that XJAPI_VERSION be defined to be greater than or equal to 0x030208.

Arguments

pinNumber
The pin number on the XJLink to read. This value is 1 based, so has a range of 1 to 20 inclusive.
timePeriodMilliSeconds
The time period to measure the frequency over in milliseconds. The hardware supports a limited set of values: 1, 10, 50, 100, 500, 1000, 5000 and 10000. Any value not in this set is rounded up to the next one, unless it exceeds 10000, in which case it is rounded down.
frequencyHz
Receives the measured frequency in Hz. If the function fails, frequencyHz is set to 0.

Return value

An XJAPI_ERROR value indicating whether the function call was successful or not:

XJAPI_ERROR_PARAMETER1
pinNumber is not in the range 1 to 20.
XJAPI_ERROR_PARAMETER3
frequencyHz is NULL.
XJAPI_ERROR_GENERAL
Some other error occurred, e.g. the hardware has not yet been initialised, or there was an error making the measurement.

Notes

XJAPI_HardwareSetup must be called before this function.