![]() |
Demo program for AnalogThreshold IP Core.
The Usage() function shows how to execute the test program, options available and default values set for different configuration variables. The Variables section specifies variables used in the test program, what they specify, the values it holds and can take. The main() function specifies sequence of api calls executed and tested.
Functions | |
void | AnalogThresholdUsage () |
int | main (int argc, char *argv[]) |
Variables | |
uint | enable =1 |
Enable mode variable to activate or deactivate the Analog Threshold IP Core Channel. It takes values 0 or 1 and defaults to 1. | |
int | channel =-1 |
Channel number for the Analog Threshold IP Core Channel. It takes values 0 to (number of IP Core channels-1) and defaults to -1 (test program executed for all channels) | |
fpgawb_ipcore_t | ip_core |
fpgawb_ipcore_t struct which stores useful information about the IP Core after executing the get IP Info api call. Check fpgawb_lib.h or api call documentation for more information | |
double | rising_threshold =1.25 |
rising_threshold specifies analog threshold voltage in the rising direction. It takes values -MinVoltage to +MaxVoltage and defaults to 1.25 volts | |
double | falling_threshold =1.25 |
falling_threshold specifies analog threshold voltage in the falling direction. It takes values -MinVoltage to +MaxVoltage and defaults to 1.25 volts | |
double | peak_threshold =-999 |
peak_threshold specifies analog threshold voltage in the rising direction very close to the maximum value of the signal. It takes values MaxVoltage-1 or MaxVoltage-hysteresis and defaults to MaxVoltage-1 | |
double | valley_threshold =-999 |
valley_threshold specifies analog threshold voltage in the falling direction very close to the minimum value of the signal. It takes values MinVoltage+1 or MinVoltage+hysteresis and defaults to MinVoltage+1 | |
double | hysteresis_factor =0.1 |
Hysteresis_factor is voltage for the Hysteresis factor which determines if the signal is rising or falling. It takes values -MinVoltage to +MaxVoltage and efaults to 0.1 volts. | |
uint | config_mode =0 |
Configuration mode for the test program. Indicates to run the program in configure mode or get channel information such as digital output and average input value on the fly. It takes values 0-Configuration mode/1-Read channel information on the fly. It defaults to 0. | |
fpgawb_ipcore_analog_threshold_info_t | info |
fpgawb_ipcore_analog_threshold_info_t struct to read channel data for the Analog Threshold IP Core. Check fpgawb_lib.h or api call documentation for more information on the struct members | |
void AnalogThresholdUsage | ( | ) |
Usage:
./fpgawb_ipcore_analog_threshold [-b Board] [-c ChannelNumber] [-C ConfigMode] [-e Enable] [-f FallingThresholdVoltage] [-h HysteresisFactor] [-p PeakThresholdVoltage] [-r RisingThresholdVoltage] [-v ValleyThresholdVoltage]
Options | Default value |
---|---|
-b Board Number | 0 |
-c Channel Number (0- (NumChans-1)) | -1 |
-C Config Mode (0-Configuration mode/1-Read channel information on the fly | 0 |
-e Enable (0/1) | 1 |
-f FallingThresholdVoltage (-MinVoltage to +MaxVoltage) | 1.25 volts |
-h HysteresisFactor (-MinVoltage to +MaxVoltage) | 0.1 volts |
-p PeakThresholdVoltage (-MinVoltage to +MaxVoltage) | MaxVoltage-1 |
-r RisingThresholdVoltage (-MinVoltage to +MaxVoltage) | 1.25 volts |
-v ValleyThresholdVoltage (-MinVoltage to +MaxVoltage) | MinVoltage+1 |
Examples:
./fpgawb_ipcore_analog_threshold
./fpgawb_ipcore_analog_threshold -b0 -c0 -C0 -e1 -h0.1 -p3.75 -v0.8 -r2.5 -f2.5
./fpgawb_ipcore_analog_threshold -C1 > result
int main | ( | int | argc, |
char * | argv[] | ||
) |
Step 1: OPEN DEVICE
ccrtNGFC_Open(&handle,board_no,oflags)
Before using any API calls, the user needs to open the device and get a handle. This handle is then used as the first argument in most of the following APIs.
Step 2: GET DRIVER INFO
ccrtNGFC_Get_Driver_Info(handle, &binfo)
This call returns useful driver information and saves in the ccrtngfc_driver_info_t structure for later use.
Step 3: GET LIBRARY INFO
ccrtNGFC_Get_Library_Info(handle, &linfo)
This call returns useful library information and saves in the ccrtngfc_library_info_t structure for later use.
Step 4: GET IP INFO
fpgawb_AT_Get_Ip_Info(handle, &ip_core)
This call returns useful IP Core information and saves in the fpgawb_ipcore_t structure for later use
Step 5: CONFIGURE HYSTERESIS FACTOR
fpgawb_AT_Set_Ch_Hysteresis_Factor(handle,chan,hysteresis_factor)
This call configures hysteresis_factor voltage which determines if the signal is rising or falling, for the Analog Threshold IP Core Channel.
Step 6: CONFIGURE PEAK AND VALLEY THRESHOLD VOLTAGE
fpgawb_AT_Set_Ch_Peak_Valley_Threshold(handle,chan,peak_threshold,valley_threshold)
This call configures analog threshold voltage in the rising direction very close to the maximum value of the signal and analog threshold voltage in the falling direction very close to the minimum value of the signal for the Analog Threshold IP Core Channel.
Step 7: CONFIGURE RISING AND FALLING THRESHOLD VOLTAGE
fpgawb_AT_Set_Ch_Rising_Falling_Threshold(handle,chan,rising_threshold,falling_threshold)
This call configures analog threshold voltage in the rising and falling direction for the Analog Threshold IP Core Channel.
Step 8: ACTIVATE ANALOG THRESHOLD
fpgawb_AT_Activate_Ch(handle,chan,enable)
This call activates the Analog Threshold IP Core Channel.
Step 9: READ CHANNEL INFORMATION
fpgawb_AT_Get_Ch_Info(handle,chan,&info)
This call returns digital output and average input voltage of the Analog Threshold IP Core Channel.
Step 10: CLOSE DEVICE
ccrtNGFC_Close(handle)
Closes the device with the handle