📄 3pwm.c
字号:
/*********************************************************************
Author : ADI - Apps www.analog.com/MicroConverter
Date : Sept. 2005
File : 3PWM.c
Hardware : Applicable to ADuC702x rev H or I silicon
Currently targetting ADuC7026.
Description : 3-phase PWM with dead time
PWMTRIP (P3.6) low stops the PWMs
*********************************************************************/
#include<aduc7026.h>
int main(void) {
GP4DAT = 0x04000000; // P4.2 configured as an output. LED is turned on
GP3CON = 0x11111111; // Enable the PWM outputs to the GPIO
// Setup the PWM
PWMCON = 0x0001; // 0x01 is enabled
PWMDAT0 = 0x00A0; // Period register
PWMDAT1 = 0x00; // Dead time
PWMCFG = 0x00; //
PWMCH0 = 0x00FFE0; // duty cycle channel 0
PWMCH1 = 0x0020; // duty cycle channel 1
PWMCH2= 0x0030; // duty cycle channel 2
PWMEN = 0x00; // Enable (0=enabled)
GP4DAT ^= 0x00040000; // Complement P4.2
while (1){}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -