Logo
PWMOut_Demo

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

Variables

int channel =-1
 Channel number for the PWMOut IP Core. It takes values 0 to (number of IP Core channels-1) and defaults to -1 (test program executed for all channels)
 
int one_shot_mode =0
 One shot mode for PWMOut IP Core. It takes values 0 or 1 and default to 0.
 
int one_shot_repeat_count =0
 One shot mode repeat count for PWMOut IP Core. It takes values 0 or 255 and defaults to 0.
 
int immediate_mode =0
 Immediate mode for PWMOut IP Core. It takes values 0 or 1 and defaults to 0.
 
int sim_frame_count =0
 Sim frame count for PWMOut IP Core. It takes values 0 to 15 and defaults to 0.
 
int enable =1
 Enable mode for PWMOut IP Core. It takes values 0 or 1 and defaults to 1.
 
int active_high =1
 Active high for PWMOut IP Core. It takes values 0 or 1 and defaults to 1.
 
fpgawb_ipcore_pwmout_get_channel_info_t info
 fpgawb_ipcore_pwmout_get_channel_info_t struct to read channel data for the PWMOut IP Core. Check fpgawb_lib.h or api call documentation for more information on the struct members
 
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 frequency =10
 Frequency for PWMOut IP Core. It default to 10.
 
double dutycycle =10
 Dutycycle for PWMOut IP Core. It takes values 0 to 100 and defaults to 10.
 

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_PWMOut_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: RESET PWMOUT CHANNEL
fpgawb_PWMOut_Reset_Ch(handle, Chan)
This call resets the PWMOut IP Core channel

Step 6: ACTIVATE PWMOUT CHANNEL
fpgawb_PWMOut_Activate_Ch(handle, Chan,enable,&current_state)
This call activates the PWMOut IP Core channel. Current state of the IP Core is returned in the current_state parameter

Step 7: CONFIGURE PWMOUT CHANNEL
fpgawb_PWMOut_Configure_Ch(handle, Chan, &config) This call configures the PWMOut channel with the confguration parameters in the config struct

Step 8: SET PWMOUT CHANNEL FREQUENCY AND DUTYCYCLE
fpgawb_PWMOut_Set_Ch_Frequency_And_Dutycycle(handle, Chan, frequency, dutycycle) This call configures the PWMOut channel frequecy and dutycycle

Step 9: GET PWMOUT CHANNEL INFO
fpgawb_PWMOut_Get_Ch_Info(handle, Chan, &info)
This call is used to get PWMOut channel information which is populated in the info struct

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

void PWMOutUsage ( )

Usage:
./fpgawb_ipcore_pwmout [-A ActiveHigh] [-b BoardNumber] [-c channelNumber] [-D DutyCycle] [-E Enable] [-f SimFrameCount] [-F Frequency] [-i ImmediateMode] [-o OneShotMode] [-r OneShotRepeatCount]

Options Default value
-A Active High (0/1) 1
-b Board Number or Device Number 0
-c channel Number (0- (NumChans-1)) -1 (all channels)
-D Dutycycle (0-100) 10
-E Enable (0/1) 1
-f Sim frame count (0 to 15) 0
-F Frequency in Hertz 10
-i Immediate mode (0/1) 0
-o one shot mode (0/1) 0
-r One shot repeat count (0-255) 0


Examples:
./fpgawb_ipcore_pwmout
./fpgawb_ipcore_pwmout -A0 -b0 -c0 -D80 -E1 -i0 -f0 -F25 -o0 -r0