⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pwmtest.c

📁 NXP示例编码集,Software that is described herein is for illustrative purposes only which provides custom
💻 C
字号:
/*****************************************************************************
 *   pwmtest.c:  main C entry file for NXP LPC23xx/24xx Family Microprocessors
 *
 *   Copyright(C) 2006, NXP Semiconductor
 *   All rights reserved.
 *
 *   History
 *   2006.07.20  ver 1.00    Prelimnary version, first Release
 *
******************************************************************************/
#include "LPC23xx.h"                        /* LPC23xx/24xx definitions */
#include "type.h"
#include "irq.h"
#include "pwm.h"

extern volatile DWORD match_counter1;

/******************************************************************************
**   Main Function  main()
******************************************************************************/
int main (void)
{	    
    DWORD cycle = PWM_CYCLE, offset = 0;

	/* The test is done on the Keil MCB2300 board, that all the PWM1 pins are
	laid out to the connector for probing. PWM0 is not not tested. */ 
    if ( PWM_Init( 1, 0 ) != TRUE )
    {
		while( 1 );			/* fatal error */
    }

    PWM_Set( 1, cycle, offset );
    PWM_Start( 1 );

    while ( 1 )
    {
		if ( match_counter1 != 0 )
		{
	    	match_counter1 = 0;
	    	if( offset <= PWM_CYCLE )
				offset += PWM_OFFSET;
	    	else
				offset = 0;
	    	PWM_Set( 1, cycle, offset );
		}
    }
    PWM_Stop( 1 );
    return 0;
}

/******************************************************************************
**                            End Of File
******************************************************************************/

⌨️ 快捷键说明

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