tmrctr
Vitis Drivers API Documentation
 All Data Structures Files Functions Variables Typedefs Groups Pages
xtmrctr_pwm_example.c File Reference

Overview

This file contains a design example using the timer counter driver and hardware device using interrupt mode.

The example demonstrates the use of PWM feature of axi timers. PWM is configured to operate at specific duty cycle and after every N cycles the duty cycle is incremented until a specific duty cycle is achieved. No software validation of duty cycle is undergone in the example.

This example assumes that the interrupt controller is also present as a part of the system.

 MODIFICATION HISTORY:
 Ver   Who  Date         Changes


1.00b cjp 03/28/18 First release 4.14 ml 07/14/25 Fixed GCC warnings. 4.15 bdk 12/08/25 Updated comments to support SDT flow for Doxygen documentation. 4.15 ml 02/03/26 Fix codespell warnings

#include "xtmrctr.h"
#include <stdio.h>
#include "xil_printf.h"
#include "xil_exception.h"
#include "xparameters.h"
#include "xinterrupt_wrap.h"

Functions

int TmrCtrPwmExample (XTmrCtr *TmrCtrInstancePtr, UINTPTR BaseAddr)
 This function demonstrates the use of tmrctr PWM APIs. More...
 
int main (void)
 This function is the main function of the Tmrctr PWM example. More...
 

Function Documentation

int main ( void  )

This function is the main function of the Tmrctr PWM example.

Parameters
None.
Returns
XST_SUCCESS to indicate success, else XST_FAILURE to indicate a Failure.
Note
None.

References TmrCtrPwmExample().

int TmrCtrPwmExample ( XTmrCtr TmrCtrInstancePtr,
UINTPTR  BaseAddr 
)

This function demonstrates the use of tmrctr PWM APIs.

Parameters
TmrCtrInstancePtris a pointer to the XTmrCtr driver Instance
BaseAddris the base address of the XTmrCtr device.
Returns
XST_SUCCESS if the Test is successful, otherwise XST_FAILURE
Note
In XSCT/classic flow, DeviceId is used to look up the device configuration.

References XTmrCtr::Config, XTmrCtr_Initialize(), XTmrCtr_InterruptHandler(), XTmrCtr_PwmConfigure(), XTmrCtr_PwmDisable(), XTmrCtr_PwmEnable(), XTmrCtr_SelfTest(), XTmrCtr_SetHandler(), and XTmrCtr_SetOptions().

Referenced by main().