Logo
NGFC_RegisterWrite_Demo

Demo program for Register Write Hybrid 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 RegisterWriteUsage ()
 
int main (int argc, char *argv[])
 

Variables

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 Register Write Hybrid 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_register_write_configure_t config
 fpgawb_ipcore_register_write_configure_t struct which contains the params for floating point to fixed-point conversion. Check fpgawb_lib.h or api call documentation for more information
 
uint number_of_bits = 32
 Total number of bits to be used to represent the fixed-point number. It takes value 1 to 32 and defaults to 32.
 
uint number_of_integer_bits = 16
 Total number of integer bits to be used to represent the fixed-point number. It takes value 0 to 32 and defaults to 16.
 
uint data_type = 0
 Data type for the fixed-point number. It takes value 0 or 1 representing unsigned and signed number and defaults to 0.
 
double data = 0
 Data is the value to be written to the register.
 

Function Documentation

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_Register_Write_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: READ CHANNEL DATA
fpgawb_IpCore_Register_Write_Set_Data(handle,chan,&config)
This call performs float to fixed conversion based on the parameters specified and writes the data to the register.

Step 6: CLOSE DEVICE
ccrtNGFC_Close(handle)
Closes the device with the handle.

void RegisterWriteUsage ( )

Usage:
./fpgawb_ipcore_register_write [-b BoardNumber] [-c ChannelNumber] [-d Data] [-i IntegerBits] [-n TotalNumBits] [-t DataType]

Options Default value
-b Board Number 0
-c Channel Number (0-(Numchans-1) -1 (all channels)
-d Data 0
-i # Integer Bits (0 to 32) 16
-n Total # Bits (1 to 32) 32
-t Data Type (0-Unsigned/1-Signed) 0


Examples:
./fpgawb_ipcore_register_write -c0 -d2.5
./fpgawb_ipcore_register_write -c0 -d2.4