码迷,mamicode.com
首页 > 其他好文 > 详细

中颖SH79F1616 timer5初始化程序

时间:2014-06-11 06:21:33      阅读:305      评论:0      收藏:0      [点我收藏+]

标签:中颖sh79f1616

//========timer5.h=============================================
#ifndef _TIMER5_H_
#define _TIMER5_H_
//#include "timer5.h"

//==timer5 define=====
#define  TIM5_DIV1    (0<<4)
#define  TIM5_DIV8  (1<<4)
#define  TIM5_DIV64   (2<<4)
#define  TIM5_DIV256  (3<<4)
//#define  TIMER5_ENB    Bank1;T5CON |= (1<<1);Bank0  //开T5计数 
//#define  TIMER5_DIS    Bank1;T5CON &= ~(1<<1);Bank0 
#define     ClrTF5         T5CON &= ~(1<<7)    
#define     TIMER5_IE_ENB   IEN0 |= (1<<1)  //开T5中断
#define     TIMER5_IE_DIS   IEN0 &= ~(1<<1) //关T5中断
//==============================
extern void Init_Timer5(uint8 Pscr,uint16 Tcon) ;
extern void Timer5_Enb(uint8 EN) ;
#endif
 

//========timer5.c==============================================
                                                                       
#include "global.h"
#include "timer5.h"
//#define    Init_Timer5_CALL
 
//*************************************
// 函数名称:Init_Timer5
// 函数功能:TIM5初始化
// 入口参数:计数个数 分频值
// 出口参数:无
//***************************************
#ifdef  Init_Timer5_CALL
void Init_Timer5(uint8 Pscr,uint16 Tcon)
{
 Bank1;
 T5CON = 0X00 ;
 T5CON |= Pscr ;
 TL5 = (65536-Tcon)&0X00FF ;
 TH5 = (65536-Tcon)>>8 ;
 SWTHL &= ~(1<<1) ; //读TH5 TL5时返回 它的计数值
    T5CON |= (1<<1) ; //开T5计数
 Bank0;
}
#endif //Init_Timer5_CALL

中颖SH79F1616 timer5初始化程序,布布扣,bubuko.com

中颖SH79F1616 timer5初始化程序

标签:中颖sh79f1616

原文地址:http://blog.csdn.net/libiaojs/article/details/29412199

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!