pwmmain.c

来自「This program shows how to configure and 」· C语言 代码 · 共 32 行

C
32
字号
/*------------------------------------------------------------------------------
pwmMain.c : Sample Program that demonstrates the pulse width modulator for the
following microcontrollers

Philips 80C552
Philips 80C554
Philips 83/87C552
Philips 83/87C554
Philips 83/87C557E4
Philips 83/87C557E8


Copyright (c) 1988-2001 Keil Elektronik GmbH and Keil Software, Inc.
All rights reserved.
--------------------------------------------------------------------------*/

sfr PWM0   = 0xFC;
sfr PWM1   = 0xFD;
sfr PWMP   = 0xFE;

/*------------------------------------------------------------------------------
main() : Runs a while loop as the PWM automatically loops 
------------------------------------------------------------------------------*/
void main( void )
{
	PWMP = 0x01;				//Set the repition frequenct to 2.85kHz
	PWM0 = 0x3F;				//Set the Duty cycle to 75%
	PWM1 = 0xAA;				//Set the Duty cycle to 33%

	while(1);					//Loop while PWM runs in background
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?