ATMEL公司AT89C51SND1为主控制器MP3源代码

源代码在线查看: timer_drv.h

软件大小: 1291 K
上传用户: w277426078
关键词: ATMEL SND1 89C C51
下载地址: 免注册下载 普通下载 VIP

相关代码

				/*H**************************************************************************
				* NAME:         timer_drv.h         
				*----------------------------------------------------------------------------
				* Copyright (c) 2003 Atmel.
				*----------------------------------------------------------------------------
				* RELEASE:      snd1c-refd-nf-4_0_3      
				* REVISION:     1.3     
				*----------------------------------------------------------------------------
				* PURPOSE:
				* This file contains the timers 0, 1 and watchdog driver definition
				*****************************************************************************/
				
				#ifndef _TIMER_DRV_H_
				#define _TIMER_DRV_H_
				
				/*_____ I N C L U D E S ____________________________________________________*/
				
				
				/*_____ M A C R O S ________________________________________________________*/
				
				#if T0_X2 == TRUE
				  #define FT0_IN        FOSC/2
				#else
				  #define FT0_IN        FPER
				#endif
				
				#if T1_X2 == TRUE
				  #define FT1_IN        FOSC/2
				#else
				  #define FT1_IN        FPER
				#endif
				
				
				#define   T0_MODE_0     0x00
				#define   T0_MODE_1     0x01
				#define   T0_MODE_2     0x02
				#define   T0_MODE_3     0x03
				#define   T0_COUNTER    0x04
				#define   T0_TIMER      0x00
				#define   T0_GATED      0x08
				#define   T0_NOT_GATED  0x00
				
				#define   T1_MODE_0     0x00
				#define   T1_MODE_1     0x10
				#define   T1_MODE_2     0x20
				#define   T1_MODE_3     0x30
				#define   T1_COUNTER    0x40
				#define   T1_TIMER      0x00
				#define   T1_GATED      0x80
				#define   T1_NOT_GATED  0x00
				
				
				/*_____ D E F I N I T I O N ________________________________________________*/
				
				
				/*_____ D E C L A R A T I O N ______________________________________________*/
				
				void    t0_set_prio (Byte);
				void    t1_set_prio (Byte);
				
				#if T0_X2 == TRUE
				  #define T0_init(g,c,m)          (CKCON |= MSK_T1X2); (TMOD &= 0xF0); (TMOD |= (g | c | m))
				#else
				  #define T0_init(g,c,m)          (CKCON &= ~MSK_T1X2); (TMOD &= 0xF0); (TMOD |= (g | c | m))
				#endif
				#define T0_start()                (TR0= 1)
				#define T0_stop()                 (TR0= 0)
				#define T0_enable_int()           (ET0= 1)
				#define T0_disable_int()          (ET0= 0)
				#define T0_set_low(l)             (TL0= l)
				#define T0_set_high(h)            (TH0= h)
				
				#if T1_X2 == TRUE
				  #define T1_init(g,c,m)          (CKCON |= MSK_T1X2); (TMOD &= 0x0F); (TMOD |= (g | c | m))
				#else
				  #define T1_init(g,c,m)          (CKCON &= ~MSK_T1X2); (TMOD &= 0x0F); (TMOD |= (g | c | m))
				#endif
				#define T1_start()                (TR1= 1)
				#define T1_stop()                 (TR1= 0)
				#define T1_enable_int()           (ET1= 1)
				#define T1_disable_int()          (ET1= 0)
				#define T1_set_low(l)             (TL1= l)
				#define T1_set_high(h)            (TH2= h)
				
				
				#endif /* _TIMER_DRV_H_ */
				
				
				
				
							

相关资源