Logo
WaveGen_Demo

Demo program for WaveGen 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 WaveGenUsage ()
 
int main (int argc, char *argv[])
 

Variables

double starting_angle =0
 Starting angle of the WaveGen IP Core Channel rotation. It takes values 0 - rotation in degrees and defaults to 0 degree.
 
int rotation =360
 Rotation of the WaveGen IP Core Channel. It takes values 360/720 degrees and defaults to 360 degree.
 
uint enable =1
 enable mode bit for the WaveGen 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 WaveGen 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
 
uint active_high =1
 Active High for the WaveGen IP Core Channel. It takes values 0 or 1 and defaults to 1.
 
double frequency =25
 Frequency for the WaveGen IP Core in Hertz. It defaults to 25 Hz.
 
uint wave_mode =0
 Wave Mode for the WaveGen IP Core Channel. It takes values 0 to 3(0-Sin, 1-Square, 2-Ramp, 3-Triangle) and defaults to 0.
 
uint bipolar_mode =0
 Bipolar mode for the WaveGen IP Core Channel. It takes values 0 or 1 and defaults to 0.
 
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 WaveGen 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 mode or change frequency on fly mode. It takes values 0-Configuration/1-Change Phase Increment. It defaults to 0.
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Step 1: OPEN DEVICE
ccurPMFC_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
ccurPMFC_Get_Driver_Info(handle, &binfo)
This call returns useful driver information and saves in the ccurpmfc_driver_info_t structure for later use.

Step 3: GET LIBRARY INFO
ccurPMFC_Get_Library_Info(handle, &linfo)
This call returns useful library information and saves in the ccurpmfc_library_info_t structure for later use.

Step 4: GET IP INFO
fpgawb_WaveGen_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 WAVEGEN CHANNEL
fpgawb_Wavegen_Activate_Ch(handle,chan,enable,activate)
This call activates the WaveGen 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: SET CHANNEL ACTIVE HIGH
fpgawb_Wavegen_Set_Ch_Active_High(handle,chan,active_high)
This call configures the active high for WaveGen IP Core Channel.

Step 7: CONFIGURE CHANNEL MODE
C_fpgawb_Wavegen_Configure_Ch_Mode(handle,chan,wave_mode,bipolar_mode)
This call configures the wave_mode and bipolar mode for WaveGen IP Core Channel.

Step 8: CONFIGURE CHANNEL INITIAL CONDITION
C_fpgawb_Wavegen_Set_Ch_Initial_Condition(handle,chan,starting_angle,rotation)
This call configures the starting angle and the rotation for the WaveGen IP Core Channel.

Step 9: ACTIVATE WAVEGEN CHANNEL
fpgawb_Wavegen_Activate_Ch(handle,chan,1,1)
This call activates the WaveGen channel for Running after the configuration phase. Note that you put the activate to 0 before configuration so make it 1 now.

Step 10: SET CHANNEL PHASE INCREMENT
fpgawb_Wavegen_Set_Ch_Phase_Frequency(handle,chan,frequency)
This call sets Frequency in Hz for the WaveGen IP Core Channel.

Step 11: CLOSE DEVICE
ccurPMFC_Close(handle)
Closes the device with the handle.

void WaveGenUsage ( )

Usage:
./fpgawb_ipcore_wavegen [-a ActiveHigh] [-A Activate] [-b BoardNumber] [-B BipolarMode] [-c channelNumber] [-C config_mode] [-e Enable] [-f Frequency] [-s StartAngle] [-r Rotation] [-w WaveMode]

Options Default value
-a Active High(0/1) 1
-A Activate (0/1) 0
-b Board Number 0
-B Bipolar Mode (0/1) 0
-c channel Number (0-(Numchans-1) -1 (all channels)
-C Config Mode (0-Configuration/1-No Configuration- change Phase Increment) 0
-e Enable (0/1) 1
-f Frequency in Hz 25
-s Starting Angle (0 degrees - <rotation> degrees) 0
-r Rotation (360 or 720 degrees) 360
-w Wave Mode (0-Sin, 1-Square, 2-Ramp, 3-Triangle) 0


Examples:
./fpgawb_ipcore_wavegen
./fpgawb_ipcore_wavegen -b0 -c0 -a1 -A0 -e1 -r720 -s2 -w2 -B1
./fpgawb_ipcore_wavegen -C1 -f50