3pwm.c

来自「ADI公司的ARM7的功能模块的源码」· C语言 代码 · 共 39 行

C
39
字号
/*********************************************************************

 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 + =
减小字号Ctrl + -
显示快捷键?