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

📄 pwmtest.c

📁 NXP产品LPC23XX的开发板的源文件
💻 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)
{	
	int i;
	DWORD cycle = PWM_CYCLE, offset = 0;
    
    lcd_init();
    lcd_clear();
    lcd_print ("   LPC2378-EK    ");
    set_cursor (0, 1);
    lcd_print (" www.po-star.com");    
	for (i = 0; i < 20000000; i++);       /* Wait for initial display           */
//================================
  lcd_init();
  lcd_clear();
  lcd_print ("    PWM DEMO    ");
  set_cursor (0, 1);
  lcd_print ("   LPC2378-EK    ");   
//================================			
	/* 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 + -