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

📄 pit.c

📁 freescale最新的16位单片机
💻 C
字号:
/******************************************************************************
*
* Freescale Semiconductor Inc.
* (c) Copyright 2004-2005 Freescale Semiconductor, Inc.
* ALL RIGHTS RESERVED.
*
***************************************************************************//*!
*
* @file      pit.c
*
* @author    R89994
* 
* @version   1.0.5.0
* 
* @date      Jul-27-2006
* 
* @brief     Settings of periphery Periodic interrupt timer
*
*******************************************************************************/

#include "main.h"
#include "pit.h"

/******************************************************************************
* Module            : void SetupPIT(void)
* Description       : initialization of PIT periphery
* Global Data       : none
* Static Global Data: none
* Returns           : none
* Arguments         : none
* Special Issues    : none
******************************************************************************/

void SetupPIT(void)
{
    PITCE       = 0x0D;     // Channel enable register
    PITMUX      = 0x0E;	    // corresponding 16bit timer with 8bit microtimer

    PITMTLD1    = 0x18;     // Micro timer load register 1 (1 us)

    PITLD2      = 0x4E20;   // Load register 2  [micro timer 1 + trimer 2 = 20 ms (pri 24 MHz)]
    PITLD3      = 0x7530;   // Load register 3  [micro timer 1 + trimer 3 = 30 ms (pri 24 MHz)]
    PITCNT2     = 0x0000;   // Count register 0
    PITCNT3     = 0x0000;   // Count register 0

    PITCFLMT    = 0xE0;     // enable timer
}

⌨️ 快捷键说明

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