Microchip® Advanced Software Framework

pwma_example1.c File Reference

Example to illustrate the basic PWMA Function of generating waveform to two different PWMA channels.

Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>

Macros

Example Configuration
#define EXAMPLE_PWMA_GCLK_ID   AVR32_SCIF_GCLK_PWMA
 GCLK number for PWMA Module. More...
 
#define EXAMPLE_PWMA_GCLK_FREQUENCY   48000000
 Output frequency of the PWMA Generic clock. More...
 
#define EXAMPLE_PWMA_GCLK_SOURCE   AVR32_SCIF_GC_USES_CLK_PBA
 Source for PWMA Generic clock. More...
 
#define EXAMPLE_PWMA_OUTPUT_FREQUENCY   2000000
 PWMA output frequency. More...
 
#define EXAMPLE_PWMA_CHANNEL_ID1   11
 Channel index number of PWMA Module. More...
 
#define EXAMPLE_PWMA_PIN1   AVR32_PWMA_11_PIN
 Corresponding GPIO pin number of the EXAMPLE_PWMA_CHANNEL_ID1. More...
 
#define EXAMPLE_PWMA_FUNCTION1   AVR32_PWMA_11_FUNCTION
 Corresponding pin function number of EXAMPLE_PWMA_PIN1. More...
 
#define EXAMPLE_PWMA_CHANNEL_ID2   27
 Channel index number of PWMA Module. More...
 
#define EXAMPLE_PWMA_PIN2   AVR32_PWMA_27_PIN
 Corresponding GPIO pin number of the EXAMPLE_PWMA_CHANNEL_ID2. More...
 
#define EXAMPLE_PWMA_FUNCTION2   AVR32_PWMA_27_FUNCTION
 Corresponding pin function number of EXAMPLE_PWMA_PIN2. More...
 
#define ERROR_LED   LED2_GPIO
 LED Shows the status of the PWMA configuration. More...
 
#define PWMA_SPREAD   10
 SPREAD value to be loaded to the PWMA Module. More...
 
#define PWMA_INTERRUPT_PRIORITY   0
 Priority level of the PWMA interrupt. More...
 

Functions

 ISR (tofl_irq, AVR32_PWMA_IRQ_GROUP, PWMA_INTERRUPT_PRIORITY)
 TOFL ISR Routine. More...
 
int main (void)
 Main Application Routine -Initialize the system clocks
-Configure and Enable the PWMA Generic clock
-Configure and Enable the PWMA Module
-Load Duty cycle value using Interlinked multi-value mode
-Register and Enable the Interrupt
-Enter into sleep mode
. More...
 

Variables

volatile avr32_pwma_t * pwma = &AVR32_PWMA
 Global variable to Store the PWMA module address. More...
 

#define ERROR_LED   LED2_GPIO

LED Shows the status of the PWMA configuration.

Referenced by main().

#define EXAMPLE_PWMA_CHANNEL_ID1   11

Channel index number of PWMA Module.

Referenced by main().

#define EXAMPLE_PWMA_CHANNEL_ID2   27

Channel index number of PWMA Module.

Referenced by main().

#define EXAMPLE_PWMA_FUNCTION1   AVR32_PWMA_11_FUNCTION

Corresponding pin function number of EXAMPLE_PWMA_PIN1.

Referenced by main().

#define EXAMPLE_PWMA_FUNCTION2   AVR32_PWMA_27_FUNCTION

Corresponding pin function number of EXAMPLE_PWMA_PIN2.

Referenced by main().

#define EXAMPLE_PWMA_GCLK_FREQUENCY   48000000

Output frequency of the PWMA Generic clock.

Referenced by main().

#define EXAMPLE_PWMA_GCLK_ID   AVR32_SCIF_GCLK_PWMA

GCLK number for PWMA Module.

Referenced by main().

#define EXAMPLE_PWMA_GCLK_SOURCE   AVR32_SCIF_GC_USES_CLK_PBA

Source for PWMA Generic clock.

Referenced by main().

#define EXAMPLE_PWMA_OUTPUT_FREQUENCY   2000000

PWMA output frequency.

Referenced by main().

#define EXAMPLE_PWMA_PIN1   AVR32_PWMA_11_PIN

Corresponding GPIO pin number of the EXAMPLE_PWMA_CHANNEL_ID1.

Referenced by main().

#define EXAMPLE_PWMA_PIN2   AVR32_PWMA_27_PIN

Corresponding GPIO pin number of the EXAMPLE_PWMA_CHANNEL_ID2.

Referenced by main().

#define PWMA_INTERRUPT_PRIORITY   0

Priority level of the PWMA interrupt.

Referenced by main().

#define PWMA_SPREAD   10

SPREAD value to be loaded to the PWMA Module.

Referenced by main().

ISR ( tofl_irq  ,
AVR32_PWMA_IRQ_GROUP  ,
PWMA_INTERRUPT_PRIORITY   
)

TOFL ISR Routine.

Parameters
tofl_irqISR Routine name
AVR32_PWMA_IRQ_GROUPGroup under which the PWMA interrupt lies
PWMA_INTERRUPT_PRIORITYPriority level of the interrupt

References pwma.

volatile avr32_pwma_t* pwma = &AVR32_PWMA

Global variable to Store the PWMA module address.

Referenced by ISR(), and main().