![]() |
Demo program for LVDT/RVDT Rx 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 | LVDTRVDTRxUsage () |
int | main (int argc, char *argv[]) |
Variables | |
uint | enable =1 |
enable mode bit for the LVDT/RVDT Rx IP Core Channel. Toggling the enable signal will cause the registers to revert to default power-on states. It takes values 0 or 1 and defaults to 1 | |
uint | activate =0 |
output enable for the LVDT/RVDT Rx IP Core Channel. Enable this after configuring the registers associated with api calls starting with C. It takes values 0 or 1 and defaults to 0 | |
double | external_input_excitation_frequency = 1001 |
The external_input_excitation_frequency input aids in the selection of the clock for the FIR filter. If the frequency of the External Input Excitation is in the range of 0-800 Hz then 2.44 Khz clock will be selected.If the frequency of the External Input Excitation is in the range of 801-2000 Hz then 9.77 Khz clock will be selected. If the frequency of the External Input Excitation is in the range of 2001-8000 Hz then 19.53 Khz clock will be selected. If the frequency of the External Input Excitation is in the range of 8001-13000 Hz then 78.125 Khz clock will be selected. | |
uint | negate_input =0 |
negate_input negates the four input ports vs1, vs2, am and excitation input. This is accomplised by using a four bit one-hot parameter whereby LSB bit negates vs1, second bit negates vs2, third bit negates am and MSB negates excitation_input. | |
uint | select_compute_mode =1 |
mode is used to select between using vs2-vs1 for LVDT distance or am for LVDT distance/RVDT angular position. It takes value 0- am or 1- vs2-vs1 and defaults to 1 | |
uint | mode =1 |
mode indicates if the IP functions as RVDT or LVDT and takes values 1 for RVDT and 2 for LVDT respectively. It defaults to 1 | |
fpgawb_ipcore_t | ip_core |
fpgawb_ipcore_t struct which stores useful information about the IP Core after executing get IP Info api call. Check fpgawb_lib.h or api call documentation for more information | |
int | channel =-1 |
Channel number for the LVDT/RVDT Rx IP Core Channel. It takes values 0 to (number of IP Core channels-1) and defaults to -1 (test program executed for all channels) | |
uint | config_mode =0 |
Configuration mode for the test program. Indicates to run the program in configure/setup IP mode or get angular_position/lvdt_distance on the fly mode. It takes values 0-Static configuration/1-Get data on the fly. It defaults to 0. | |
fpgawb_ipcore_lvdt_rvdt_rx_configure_t | config |
fpgawb_ipcore_lvdt_rvdt_rx_configure_t struct passed as argument for setting the static parameters if the LVDT/RVDT Rx IP Core channel. Check fpgawb_lib.h or api call documentation for more information | |
uint | demod_mode = 0 |
demod_mode takes value 0 for coherent and a value 1 for non-coherent. It defaults to 0 | |
uint | dc_offset_mode = 0 |
dc_offset_mode takes value 0 for no DC offset, value 1 for manual DC offset. It defaults to 0 | |
double | dc_offset_real = 0 |
dc_offset_real is the DC offset of the real part. This is a dynamic parameter and dc_offset_mode should be set to 1 in configuration phase to use this. It defaults to 0 | |
double | dc_offset_imag = 0 |
dc_offset_imag is the DC offset of the imaginary part. This is a dynamic parameter and dc_offset_mode should be set to 1 in configuration phase to use this. It defaults to 0 | |
void LVDTRVDTRxUsage | ( | ) |
Usage:
./fpgawb_ipcore_lvdt_rvdt_rx [-A Activate] [-b BoardNumber] [-c channelNumber] [-C config_mode] [-e Enable] [-f ExternalInputExcitationFrequency] [-d DemodMode] [-i DCOffsetImaginary] [-m mode] [-n NegateInput] [-o DCOffsetMode] [-r DCOffsetReal] [-s SelectComputeMode]
Options | Default value |
---|---|
-A Activate (0/1) | 0 |
-b Board Number | 0 |
-c channel Number (0-(Numchans-1) | -1 (all channels) |
-C Config Mode (0-Static Configuration/ 1-Get Data) | 0 |
-d Demod mode (0/1) | 0 |
-e Enable (0/1) | 1 |
-f External Input Excitation Frequency in Hz (0 to 13000) | 1001 Hz |
-i DC Offset Imaginary | 0 |
-m Mode (1-RVDT/2-LVDT) | 1 |
-n Negate Input Four bit one-hot parameter whereby LSB bit negates vs1, second bit negates vs2, third bit negates am and MSB negates excitation_input | 0 |
-o DC Offset Mode (0/1) | 0 |
-r DC Offset Real (0/1) | 0 |
-s Select Compute Mode (0-am or 1-vs2-vs1) | 1 |
Examples:
Static Configuration: ./fpgawb_ipcore_lvdt_rvdt_rx -C0 -f1001 -s1 -n0
Dynamic mode: ./fpgawb_ipcore_lvdt_rvdt_rx -C1 -m1
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_LVDT_RVDT_Rx_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: ACTIVATE LVDT/RVDT RX CHANNEL
fpgawb_LVDT_RVDT_Rx_Activate_Ch(handle,chan,enable,activate)
This call activates the LVDT/RVDT Rx IP Core Channel. Note to set activate to 0 because we will be using the Config api calls which requires activate be 0. The default for activate is 0 in this test program. It is set to 1 at the end. Please be careful to give in the value as 0 when running the test program.
Step 6: CONFIGURE CHANNEL
C_fpgawb_LVDT_RVDT_Rx_Configure_Ch(handle,chan,&config)
This call configures the static parameters like clock for the FIR Filter, negate input signals for LVDT/RVDT Rx IP Core Channel.
Step 7: ACTIVATE LVDT/RVDT RX CHANNEL
fpgawb_LVDT_RVDT_Rx_Activate_Ch(handle,chan,1,1)
This call activates the LVDT/RVDT Rx channel for Running after the configuration phase. Note that you set the activate to 0 before configuration so make it 1 now.
Step 8: GET LVDT/RVDT RX CHANNEL ANGULAR POSITION
fpgawb_RVDT_Rx_Get_Ch_Angular_Position(handle,chan,&angular_position)
This call returns the current angular position of the LVDT/RVDT Rx IP Core Channel.
Step 8: GET LVDT/RVDT RX CHANNEL ANGULAR POSITION
fpgawb_LVDT_Rx_Get_Ch_Distance(handle,chan,&lvdt_distance)
This call returns the current Distance of the LVDT/RVDT Rx IP Core Channel.
Step 9: CLOSE DEVICE
ccrtNGFC_Close(handle)
Closes the device with the handle.