?? ti2.c
字號:
/** ###################################################################
** THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
** Filename : TI2.C
** Project : che_free
** Processor : MC9S12DG128BCPV
** Beantype : TimerInt
** Version : Bean 02.118, Driver 01.12, CPU db: 2.87.280
** Compiler : Metrowerks HC12 C Compiler
** Date/Time : 2008-3-24, 下午 08:46
** Abstract :
** This bean "TimerInt" implements a periodic interrupt.
** When the bean and its events are enabled, the "OnInterrupt"
** event is called periodically with the period that you specify.
** TimerInt supports also changing the period in runtime.
** The source of periodic interrupt can be timer compare or reload
** register or timer-overflow interrupt (of free running counter).
** Settings :
** Timer name : ECT (16-bit)
** Compare name : TC2
** Counter shared : Yes
**
** High speed mode
** Prescaler : divide-by-128
** Clock : 187500 Hz
** Initial period/frequency
** Xtal ticks : 4800000
** microseconds : 300000
** milliseconds : 300
** seconds (real) : 0.3000000
** Hz : 3
**
** Runtime setting : none
**
** Initialization:
** Timer : Enabled
** Events : Enabled
**
** Timer registers
** Counter : TCNT [68]
** Mode : TIOS [64]
** Run : TSCR1 [70]
** Prescaler : TSCR2 [77]
**
** Compare registers
** Compare : TC2 [84]
**
** Flip-flop registers
** Mode : TCTL2 [73]
** Contents :
** Enable - byte TI2_Enable(void);
** Disable - byte TI2_Disable(void);
**
** (c) Copyright UNIS, spol. s r.o. 1997-2005
** UNIS, spol. s r.o.
** Jundrovska 33
** 624 00 Brno
** Czech Republic
** http : www.processorexpert.com
** mail : info@processorexpert.com
** ###################################################################*/
/* MODULE TI2. */
#include "Events.h"
#include "TI2.h"
#pragma DATA_SEG TI2_DATA
#pragma CODE_SEG TI2_CODE
#pragma CONST_SEG DEFAULT
/*
** ===================================================================
** Method : TI2_Enable (bean TimerInt)
**
** Description :
** Enables the bean - it starts the timer. Events may be
** generated ("DisableEvent"/"EnableEvent").
** Parameters : None
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ===================================================================
*/
byte TI2_Enable(void)
{
TC2 = TCNT + (word)56250; /* Store new value to the compare register */
TFLG1 = 4; /* Reset interrupt request flag */
TIE_C2I = 1; /* Enable interrupt */
return ERR_OK; /* OK */
}
/*
** ===================================================================
** Method : TI2_Disable (bean TimerInt)
**
** Description :
** Disables the bean - it stops the timer. No events will be
** generated.
** Parameters : None
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ===================================================================
*/
/*
byte TI2_Disable(void)
** This method is implemented as a macro. See header module. **
*/
/*
** ===================================================================
** Method : TI2_Interrupt (bean TimerInt)
**
** Description :
** The method services the interrupt of the selected peripheral(s)
** and eventually invokes the beans event(s).
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
#pragma CODE_SEG __NEAR_SEG NON_BANKED
ISR(TI2_Interrupt)
{
TC2 += (word)56250; /* Add value corresponding with periode */
TFLG1 = 4; /* Reset interrupt request flag */
__EI(); /* Enable maskable interrupts */
TI2_OnInterrupt(); /* Invoke user event */
}
#pragma CODE_SEG TI2_CODE
/* END TI2. */
/*
** ###################################################################
**
** This file was created by UNIS Processor Expert 2.96 [03.76]
** for the Freescale HCS12 series of microcontrollers.
**
** ###################################################################
*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -