Microchip® Advanced Software Framework

pwm_sync_example.c File Reference

PWM SYNC example for SAM.

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

#include "asf.h"
#include "conf_board.h"

Macros

#define DUTY_BUFFER_LENGTH   ((PERIOD_VALUE - INIT_DUTY_VALUE + 1) * 3)
 Duty cycle buffer length for three channels. More...
 
#define INIT_DEAD_TIME   5
 Initial dead time value. More...
 
#define INIT_DUTY_VALUE   0
 Initial duty cycle value. More...
 
#define MAX_SYNC_UPDATE_PERIOD   PWM_SCUP_UPR_Msk
 Maximum synchronous update period. More...
 
#define PERIOD_VALUE   50
 PWM period value. More...
 
#define PWM_FREQUENCY   50
 PWM frequency in Hz. More...
 
#define STRING_EOL   "\r"
 
#define STRING_HEADER
 

Functions

static void configure_console (void)
 Configure the Console UART. More...
 
static void display_menu (void)
 Display menu. More...
 
static uint8_t get_num_value (void)
 Get numeric value from console. More...
 
int main (void)
 Application entry point for PWM PDC example. More...
 
void PWM_Handler (void)
 Interrupt handler for the PWM controller. More...
 

Variables

pdc_packet_t g_pdc_tx_packet
 PDC transfer packet. More...
 
uint16_t g_us_duty_buffer [DUTY_BUFFER_LENGTH]
 Duty cycle buffer for PDC transfer. More...
 

#define DUTY_BUFFER_LENGTH   ((PERIOD_VALUE - INIT_DUTY_VALUE + 1) * 3)

Duty cycle buffer length for three channels.

Referenced by main(), and PWM_Handler().

#define INIT_DEAD_TIME   5

Initial dead time value.

Referenced by main().

#define INIT_DUTY_VALUE   0

Initial duty cycle value.

Referenced by main().

#define MAX_SYNC_UPDATE_PERIOD   PWM_SCUP_UPR_Msk

Maximum synchronous update period.

Referenced by main().

#define PERIOD_VALUE   50

PWM period value.

Referenced by main().

#define PWM_FREQUENCY   50

PWM frequency in Hz.

Referenced by main().

#define STRING_EOL   "\r"
#define STRING_HEADER
Value:
"-- PWM SYNC Example --\r\n" \
"-- "BOARD_NAME" --\r\n" \
"-- Compiled: "__DATE__" "__TIME__" --"STRING_EOL
#define BOARD_NAME
Definition: inc/app_init.h:140
#define STRING_EOL
Definition: pwm_sync_example.c:83

Referenced by main().

static void configure_console ( void  )
static
static void display_menu ( void  )
static

Display menu.

Referenced by main().

static uint8_t get_num_value ( void  )
static

Get numeric value from console.

Returns
Integer value from the console.

References uart_read().

Referenced by main().

void PWM_Handler ( void  )

pdc_packet_t g_pdc_tx_packet

PDC transfer packet.

uint16_t g_us_duty_buffer[DUTY_BUFFER_LENGTH]

Duty cycle buffer for PDC transfer.

Referenced by main(), and PWM_Handler().