NANO100_BSP V3.04.002
The Board Support Package for Nano100BN Series
NuEdu-Basic01_PWMDAC.c
Go to the documentation of this file.
1/**************************************************************************/
12#include <stdio.h>
13#include "Nano100Series.h"
15
33void Write_PWMDAC(void)
34{
35 /* Enable PWM clock */
37 /* Set HCLK as PWM clock source */
39 // PWM0 frequency is 100Hz, duty 30%,
40 PWM_ConfigOutputChannel(PWM1, 0, 100, 30);
41 // Enable PWM0 output
43 // Start PWM module
44 PWM_Start(PWM1, 0x01);
45}
46
52{
53 SYS->PC_H_MFP = (SYS->PC_H_MFP & ~(SYS_PC_H_MFP_PC12_MFP_Msk ));
55}
56 /* end of group Nano130_Basic01_FUNCTIONS PWM DAC Exported Functions */
58 /* end of group NuEdu-SDK-Nano130_Basic01 Nano130_Basic01 Library */
60 /* end of group NANO100_Library NANO100 Library */
62
63/*** (C) COPYRIGHT 2013 Nuvoton Technology Corp. ***/
Nano100 series peripheral access layer header file. This file contains all the peripheral register's ...
#define SYS_PC_H_MFP_PC12_MFP_Msk
#define PWM1_CH01_MODULE
Definition: clk.h:308
void CLK_EnableModuleClock(uint32_t u32ModuleIdx)
This function enable module clock.
Definition: clk.c:436
void CLK_SetModuleClock(uint32_t u32ModuleIdx, uint32_t u32ClkSrc, uint32_t u32ClkDiv)
This function set selected module clock source and module clock divider.
Definition: clk.c:339
#define PWM1
Pointer to PWM1 register structure.
#define SYS
Pointer to SYS register structure.
uint32_t PWM_ConfigOutputChannel(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Frequency, uint32_t u32DutyCycle)
This function config PWM generator and get the nearest frequency in edge aligned auto-reload mode.
Definition: pwm.c:37
void PWM_Start(PWM_T *pwm, uint32_t u32ChannelMask)
This function start PWM module.
Definition: pwm.c:227
void PWM_EnableOutput(PWM_T *pwm, uint32_t u32ChannelMask)
This function enables PWM output generation of selected channels.
Definition: pwm.c:334
#define SYS_PC_H_MFP_PC12_MFP_PWM1_CH0
Definition: sys.h:394
void Initial_PWM_DAC(void)
This function is used to setup multi-function pin of PC12 for PWM1_CH0.
void Write_PWMDAC(void)
This function is used to set PWM for PWM DAC.