timer_test.c

来自「IARSOURCECODE是基于LPC2478嵌入式软件IAR EWARM V4」· C语言 代码 · 共 44 行

C
44
字号
#include "LPC2468.h"                        /* LPC24xx definitions */
#include "type.h"
#include "irq.h"
#include "target.h"
#include "timer.h"

#include "fio.h"

extern volatile DWORD timer0_counter;

/*****************************************************************************
**   Main Function  main()
******************************************************************************/
int main (void)
{
    DWORD counter=0;

    TargetResetInit();

    /* GPIOInit() need to be carefully called if you want to run some
	other peripherals, it will set the PINSEL to default value and change
	the direction of IOs. */

    GPIOInit( 3, FAST_PORT, DIR_OUT );

    /* Initialize port for LED display, the LEDs on Keil MCB2300 is Port 2.0~2.7 */
    LedsInit();

    init_timer( 0, Fpclk/2);  /* 每0.5秒产生一个timer0中断 */
    enable_timer( 0 );        /* 使能定时器0 */

    while( 1 )
    {

      /* 此处代码请自己编写 */
      
    }

}

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

⌨️ 快捷键说明

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