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

📄 ma_tmr.c

📁 The EM6125 is a bit map controller and driver for full dot matrix
💻 C
📖 第 1 页 / 共 2 页
字号:

/*
*****************************************************************************
**
**      Project     : My project
**
**      Component   : LPC2106 (LPC2106)
**
**      Modulename  : TIMER
**
**      Filename    : ma_tmr.c
**
**      Abstract    : This file implements a device driver for the TIMER 
**                    module.
**
**      Compiler    : IAR C compiler
**
**      Date        : 2004-06-23 11:00:19
**
**      License no. : 9503-663-863-6224     Ivan
**
**      Warning     : This file has been automatically generated.
**                    Do not edit this file if you intend to regenerate it.
**
**      This device driver was created by IAR MakeApp version 
**      4.02A (Philips LPC210x: 4.00C) for the Philips LPC210x series of
**      microcontrollers.
**
**      (c)Copyright 2004 IAR Systems.
**      Your rights to this file are explained in the IAR MakeApp 
**      License Agreement. All other rights reserved.
**
*****************************************************************************
*/

/*
**===========================================================================
**  1       GENERAL
**  1.1     Revisions
**
**  Please read the IAR MakeApp for Philips LPC210x readme file 
**  
**
**===========================================================================
*/

/*
**===========================================================================
**  1.2     References
** 
**  No   Identification          Name or Description
**  ==   ===================     ================================
**
**  1    02/Oct/2003             Philips LPC210x Hardware Manual
** 
**===========================================================================
*/

/*
**===========================================================================
**  2.      INCLUDE FILES
**  2.1     Standard include files
**===========================================================================
*/

/*
**===========================================================================
**  2.2     Application include files
**===========================================================================
*/

#include "usercode.h"   /* Usercode macros (see <template.h>) */
#include "ma_tgt.h"     /* Target specific header file */
#include "ma_sfr.h"     /* Special function register bitfield macros */
#include "iolpc210x.h"  /* Defines Special function registers */


#include "ma_tmr.h"     /* TIMER Module driver header file */

/*
**===========================================================================
**  3.      DECLARATIONS
**  3.1     Internal constants
**===========================================================================
*/

#define MA_T0TCR_TIMER         0x00000000  /* Timer 0 Timer Control Register */
#define MA_T0TCR_TIMER_MASK    0x00000003  /* Used bits */
#define MA_T0TC_TIMER          0x00000000  /* Timer 0 Timer Counter */
#define MA_T0TC_TIMER_MASK     0xFFFFFFFF  /* Used bits */
#define MA_T0PR_TIMER          0x00000000  /* Timer 0 Prescale Register */
#define MA_T0PR_TIMER_MASK     0xFFFFFFFF  /* Used bits */
#define MA_T0PC_TIMER          0x00000000  /* Timer 0 Prescale Counter */
#define MA_T0PC_TIMER_MASK     0xFFFFFFFF  /* Used bits */
#define MA_T0MCR_TIMER         0x00000000  /* Timer 0 Match Control Register */
#define MA_T0MCR_TIMER_MASK    0x00000FFF  /* Used bits */
#define MA_T0MR0_TIMER         0x000009C4  /* Timer 0 Match Register 0 */
#define MA_T0MR0_TIMER_MASK    0xFFFFFFFF  /* Used bits */
#define MA_T0MR1_TIMER         0x00000000  /* Timer 0 Match Register 1 */
#define MA_T0MR1_TIMER_MASK    0xFFFFFFFF  /* Used bits */
#define MA_T0MR2_TIMER         0x00000000  /* Timer 0 Match Register 2 */
#define MA_T0MR2_TIMER_MASK    0xFFFFFFFF  /* Used bits */
#define MA_T0MR3_TIMER         0x00000000  /* Timer 0 Match Register 3 */
#define MA_T0MR3_TIMER_MASK    0xFFFFFFFF  /* Used bits */
#define MA_T0CCR_TIMER         0x00000000  /* Timer 0 Capture Control Register */
#define MA_T0CCR_TIMER_MASK    0x000001FF  /* Used bits */
#define MA_T0EMR_TIMER         0x00000000  /* Timer 0 External Match Register */
#define MA_T0EMR_TIMER_MASK    0x000003F7  /* Used bits */
#define MA_T1TCR_TIMER         0x00000000  /* Timer 1 Timer Control Register */
#define MA_T1TCR_TIMER_MASK    0x00000003  /* Used bits */
#define MA_T1TC_TIMER          0x00000000  /* Timer 1 Timer Counter */
#define MA_T1TC_TIMER_MASK     0xFFFFFFFF  /* Used bits */
#define MA_T1PR_TIMER          0x00000000  /* Timer 1 Prescale Register */
#define MA_T1PR_TIMER_MASK     0xFFFFFFFF  /* Used bits */
#define MA_T1PC_TIMER          0x00000000  /* Timer 1 Prescale Counter */
#define MA_T1PC_TIMER_MASK     0xFFFFFFFF  /* Used bits */
#define MA_T1MCR_TIMER         0x00000000  /* Timer 1 Match Control Register */
#define MA_T1MCR_TIMER_MASK    0x00000FFF  /* Used bits */
#define MA_T1MR0_TIMER         0x00000000  /* Timer 1 Match Register 0 */
#define MA_T1MR0_TIMER_MASK    0xFFFFFFFF  /* Used bits */
#define MA_T1MR1_TIMER         0x00000000  /* Timer 1 Match Register 1 */
#define MA_T1MR1_TIMER_MASK    0xFFFFFFFF  /* Used bits */
#define MA_T1MR2_TIMER         0x00000000  /* Timer 1 Match Register 2 */
#define MA_T1MR2_TIMER_MASK    0xFFFFFFFF  /* Used bits */
#define MA_T1MR3_TIMER         0x00000000  /* Timer 1 Match Register 3 */
#define MA_T1MR3_TIMER_MASK    0xFFFFFFFF  /* Used bits */
#define MA_T1CCR_TIMER         0x00000030  /* Timer 1 Capture Control Register */
#define MA_T1CCR_TIMER_MASK    0x00000FFF  /* Used bits */
#define MA_T1EMR_TIMER         0x00000000  /* Timer 1 External Match Register */
#define MA_T1EMR_TIMER_MASK    0x00000FFF  /* Used bits */

/*
**===========================================================================
**  3.2     Internal macros
**===========================================================================
*/



/*
**===========================================================================
**  3.3     Internal type definitions
**===========================================================================
*/

/*
**===========================================================================
**  3.4     Global variables (declared as 'extern' in some header file)
**===========================================================================
*/



/*
**===========================================================================
**  3.5     Internal function prototypes (defined in Section 5)
**===========================================================================
*/

/*
**===========================================================================
**  3.6     Internal variables
**===========================================================================
*/

/*
**===========================================================================
**  4.      GLOBAL FUNCTIONS (declared as 'extern' in some header file)
**===========================================================================
*/





void MA_Init_TIMER( void ) 
/*
**---------------------------------------------------------------------------
**
**  Abstract:
**      Initialises the TIMER module. Only sets those registers with values 
**      not equal to the power-on reset values. No channel are started by 
**      this function (clock input is disabled). Use MA_Start_TIMER to start 
**      a channel.
**
**  Parameters:
**      None
**
**  Returns:
**      None
**
**---------------------------------------------------------------------------
*/
{
    /*--- Handle user code on function entry ---*/
    ENTER_MA_INIT_TIMER;
            
    /*--- Channel 0 registers ---*/
    T0IR = 0; /* Clr pending interrupts */
    T0TCR = (U32)(MA_T0TCR_TIMER & ~MA_T0TCR_TIMER_MASK); /* Disable counting of timers */
     
    T0MR0    = MA_T0MR0_TIMER;

    /*--- Channel 1 registers ---*/
    T1IR = 0; /* Clr pending interrupts */
    T1TCR = (U32)(MA_T1TCR_TIMER & ~MA_T1TCR_TIMER_MASK); /* Disable counting of timers */    
    
    T1CCR    = ( T1CCR & ~MA_T1CCR_TIMER_MASK ) | MA_T1CCR_TIMER;

    /*--- Handle user code on function exit ---*/
    EXIT_MA_INIT_TIMER;
    
} /* MA_Init_TIMER */





void MA_Reset_TIMER( void ) 
/*
**---------------------------------------------------------------------------
**
**  Abstract:
**      Resets the TIMER module. Sets all registers. Count operations
**      are halted.
**
**  Parameters:
**      None
**
**  Returns:
**      None
**
**---------------------------------------------------------------------------
*/
{    
    /*--- Handle user code on function entry ---*/
    ENTER_MA_RESET_TIMER;
                
    /*--- Channel 0 registers ---*/
    T0IR = 0; /* Clr pending interrupts */
    T0TCR = (U32)(MA_T0TCR_TIMER & ~MA_T0TCR_TIMER_MASK); /* Disable counting of timers */
     
    T0TC     = MA_T0TC_TIMER;
    T0PR     = MA_T0PR_TIMER;
    T0PC     = MA_T0PC_TIMER;
    T0CCR    = ( T0CCR & ~MA_T0CCR_TIMER_MASK ) | MA_T0CCR_TIMER;
    T0MCR    = ( T0MCR & ~MA_T0MCR_TIMER_MASK ) | MA_T0MCR_TIMER;
    T0MR0    = MA_T0MR0_TIMER;
    T0MR1    = MA_T0MR1_TIMER;
    T0MR2    = MA_T0MR2_TIMER;
    T0MR3    = MA_T0MR3_TIMER;
    T0EMR    = ( T0EMR & ~MA_T0EMR_TIMER_MASK ) | MA_T0EMR_TIMER;

    /*--- Channel 1 registers ---*/
    T1IR = 0; /* Clr pending interrupts */
    T1TCR = (U32)(MA_T1TCR_TIMER & ~MA_T1TCR_TIMER_MASK); /* Disable counting of timers */    
    
    T1TC     = MA_T1TC_TIMER;
    T1PR     = MA_T1PR_TIMER;
    T1PC     = MA_T1PC_TIMER;
    T1CCR    = ( T1CCR & ~MA_T1CCR_TIMER_MASK ) | MA_T1CCR_TIMER;
    T1MCR    = ( T1MCR & ~MA_T1MCR_TIMER_MASK ) | MA_T1MCR_TIMER;

⌨️ 快捷键说明

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