CH552/projects/examples/PWM/PWM.C

43 lines
1.6 KiB
C++
Raw Normal View History

2018-10-17 10:44:45 +02:00
/********************************** (C) COPYRIGHT *******************************
* File Name : PWM.C
* Author : WCH
* Version : V1.0
* Date : 2017/01/20
* Description : CH554 PWM<EFBFBD>ж<EFBFBD>ʹ<EFBFBD>ܺ<EFBFBD><EFBFBD>жϴ<EFBFBD><EFBFBD><EFBFBD>
*******************************************************************************/
#include "..\Public\CH554.H"
#include "..\Public\Debug.H"
#include "PWM.H"
#include "stdio.h"
#pragma NOAREGS
#if PWM_INTERRUPT
/*******************************************************************************
* Function Name : PWMInterruptEnable()
* Description : PWM<EFBFBD>ж<EFBFBD>ʹ<EFBFBD><EFBFBD>
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void PWMInterruptEnable()
{
PWM_CTRL |= bPWM_IF_END | bPWM_IE_END; //<2F><><EFBFBD><EFBFBD>PWM<57>жϣ<D0B6>ʹ<EFBFBD><CAB9>PWM<57>ж<EFBFBD>
IE_PWMX = 1;
}
/*******************************************************************************
* Function Name : PWMInterrupt(void)
* Description : PWM<EFBFBD>жϷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*******************************************************************************/
void PWMInterrupt( void ) interrupt INT_NO_PWMX using 1 //PWM1&2<>жϷ<D0B6><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,ʹ<>üĴ<C3BC><C4B4><EFBFBD><EFBFBD><EFBFBD>1
{
PWM_CTRL |= bPWM_IF_END; //<2F><><EFBFBD><EFBFBD>PWM<57>ж<EFBFBD>
SetPWM1Dat(0x10);
SetPWM2Dat(0x40);
// printf("PWM_CTRL %02X\n",(UINT16)PWM_CTRL); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ鿴<DAB2>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
}
#endif