1 |
588 |
jeremybenn |
/** ###################################################################
|
2 |
|
|
** THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
|
3 |
|
|
** Filename : TickTimer.H
|
4 |
|
|
** Project : RTOSDemo
|
5 |
|
|
** Processor : MC9S12DP256BCPV
|
6 |
|
|
** Beantype : TimerInt
|
7 |
|
|
** Version : Bean 02.063, Driver 01.05, CPU db: 2.87.283
|
8 |
|
|
** Compiler : Metrowerks HC12 C Compiler
|
9 |
|
|
** Date/Time : 18/06/2005, 16:21
|
10 |
|
|
** Abstract :
|
11 |
|
|
** This bean "TimerInt" implements a periodic interrupt.
|
12 |
|
|
** When the bean and its events are enabled, the "OnInterrupt"
|
13 |
|
|
** event is called periodically with the period that you specify.
|
14 |
|
|
** TimerInt supports also changing the period in runtime.
|
15 |
|
|
** The source of periodic interrupt can be timer compare or reload
|
16 |
|
|
** register or timer-overflow interrupt (of free running counter).
|
17 |
|
|
** Settings :
|
18 |
|
|
** Timer name : ECT (16-bit)
|
19 |
|
|
** Compare name : TC0
|
20 |
|
|
** Counter shared : No
|
21 |
|
|
**
|
22 |
|
|
** High-speed CPU mode
|
23 |
|
|
** Prescaler : divide-by-8
|
24 |
|
|
** Clock : 3124000 Hz
|
25 |
|
|
** Initial period/frequency
|
26 |
|
|
** Xtal ticks : 16000
|
27 |
|
|
** microseconds : 1000
|
28 |
|
|
** milliseconds : 1
|
29 |
|
|
** seconds (real) : 0.0010000
|
30 |
|
|
** Hz : 1000
|
31 |
|
|
** kHz : 1
|
32 |
|
|
**
|
33 |
|
|
** Runtime setting : period/frequency interval (continual setting)
|
34 |
|
|
** ticks : 16000 to 320000 ticks
|
35 |
|
|
** microseconds : 1000 to 20000 microseconds
|
36 |
|
|
** milliseconds : 1 to 20 milliseconds
|
37 |
|
|
** seconds (real) : 0.0010000 to 0.0200000 seconds
|
38 |
|
|
** Hz : 50 to 1000 Hz
|
39 |
|
|
**
|
40 |
|
|
** Initialization:
|
41 |
|
|
** Timer : Enabled
|
42 |
|
|
** Events : Enabled
|
43 |
|
|
**
|
44 |
|
|
** Timer registers
|
45 |
|
|
** Counter : TCNT [68]
|
46 |
|
|
** Mode : TIOS [64]
|
47 |
|
|
** Run : TSCR1 [70]
|
48 |
|
|
** Prescaler : TSCR2 [77]
|
49 |
|
|
**
|
50 |
|
|
** Compare registers
|
51 |
|
|
** Compare : TC0 [80]
|
52 |
|
|
**
|
53 |
|
|
** Flip-flop registers
|
54 |
|
|
** Mode : TCTL2 [73]
|
55 |
|
|
** Contents :
|
56 |
|
|
** Enable - byte TickTimer_Enable(void);
|
57 |
|
|
** SetPeriodTicks16 - byte TickTimer_SetPeriodTicks16(word Ticks);
|
58 |
|
|
** SetPeriodTicks32 - byte TickTimer_SetPeriodTicks32(dword Ticks);
|
59 |
|
|
** SetPeriodUS - byte TickTimer_SetPeriodUS(word Time);
|
60 |
|
|
** SetPeriodMS - byte TickTimer_SetPeriodMS(word Time);
|
61 |
|
|
** SetFreqHz - byte TickTimer_SetFreqHz(word Freq);
|
62 |
|
|
**
|
63 |
|
|
** (c) Copyright UNIS, spol. s r.o. 1997-2002
|
64 |
|
|
** UNIS, spol. s r.o.
|
65 |
|
|
** Jundrovska 33
|
66 |
|
|
** 624 00 Brno
|
67 |
|
|
** Czech Republic
|
68 |
|
|
** http : www.processorexpert.com
|
69 |
|
|
** mail : info@processorexpert.com
|
70 |
|
|
** ###################################################################*/
|
71 |
|
|
|
72 |
|
|
#ifndef __TickTimer
|
73 |
|
|
#define __TickTimer
|
74 |
|
|
|
75 |
|
|
/* MODULE TickTimer. */
|
76 |
|
|
|
77 |
|
|
#include "Cpu.h"
|
78 |
|
|
|
79 |
|
|
#pragma CODE_SEG TickTimer_CODE /* Code section for this module. */
|
80 |
|
|
|
81 |
|
|
#define TickTimer_SPT16Min 16000 /* Lower bound of interval for method SetPeriodTicks16 */
|
82 |
|
|
#define TickTimer_SPT16Max 65535 /* Upper bound of interval for method SetPeriodTicks16 */
|
83 |
|
|
#define TickTimer_SPT32Min 16000 /* Lower bound of interval for method SetPeriodTicks32 */
|
84 |
|
|
#define TickTimer_SPT32Max 320000 /* Upper bound of interval for method SetPeriodTicks32 */
|
85 |
|
|
#define TickTimer_SPUSMin 1000 /* Lower bound of interval for method SetPeriodUS */
|
86 |
|
|
#define TickTimer_SPUSMax 20000 /* Upper bound of interval for method SetPeriodUS */
|
87 |
|
|
#define TickTimer_SPMSMin 1 /* Lower bound of interval for method SetPeriodMS */
|
88 |
|
|
#define TickTimer_SPMSMax 20 /* Upper bound of interval for method SetPeriodMS */
|
89 |
|
|
#define TickTimer_SFHzMin 50 /* Lower bound of interval for method SetFreqHz */
|
90 |
|
|
#define TickTimer_SFHzMax 1000 /* Upper bound of interval for method SetFreqHz */
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
byte TickTimer_Enable(void);
|
94 |
|
|
/*
|
95 |
|
|
** ===================================================================
|
96 |
|
|
** Method : TickTimer_Enable (bean TimerInt)
|
97 |
|
|
**
|
98 |
|
|
** Description :
|
99 |
|
|
** Enable the bean - it starts the timer. Events may be
|
100 |
|
|
** generated ("DisableEvent"/"EnableEvent").
|
101 |
|
|
** Parameters : None
|
102 |
|
|
** Returns :
|
103 |
|
|
** --- - Error code, possible codes:
|
104 |
|
|
** ERR_OK - OK
|
105 |
|
|
** ERR_SPEED - This device does not work in
|
106 |
|
|
** the active speed mode
|
107 |
|
|
** ===================================================================
|
108 |
|
|
*/
|
109 |
|
|
|
110 |
|
|
byte TickTimer_SetPeriodTicks16(word Ticks);
|
111 |
|
|
/*
|
112 |
|
|
** ===================================================================
|
113 |
|
|
** Method : TickTimer_SetPeriodTicks16 (bean TimerInt)
|
114 |
|
|
**
|
115 |
|
|
** Description :
|
116 |
|
|
** This method sets the new period of the generated events.
|
117 |
|
|
** The period is expressed in Xtal ticks as a 16-bit unsigned
|
118 |
|
|
** integer number.
|
119 |
|
|
** This method is available only if runtime setting type
|
120 |
|
|
** 'from interval' is selected in the Timing dialog box in
|
121 |
|
|
** Runtime setting area.
|
122 |
|
|
** Parameters :
|
123 |
|
|
** NAME - DESCRIPTION
|
124 |
|
|
** Ticks - Period to set [in Xtal ticks]
|
125 |
|
|
** (16000 to 65535 ticks)
|
126 |
|
|
** Returns :
|
127 |
|
|
** --- - Error code, possible codes:
|
128 |
|
|
** ERR_OK - OK
|
129 |
|
|
** ERR_SPEED - This device does not work in
|
130 |
|
|
** the active speed mode
|
131 |
|
|
** ERR_MATH - Overflow during evaluation
|
132 |
|
|
** ERR_RANGE - Parameter out of range
|
133 |
|
|
** ===================================================================
|
134 |
|
|
*/
|
135 |
|
|
|
136 |
|
|
byte TickTimer_SetPeriodTicks32(dword Ticks);
|
137 |
|
|
/*
|
138 |
|
|
** ===================================================================
|
139 |
|
|
** Method : TickTimer_SetPeriodTicks32 (bean TimerInt)
|
140 |
|
|
**
|
141 |
|
|
** Description :
|
142 |
|
|
** This method sets the new period of the generated events.
|
143 |
|
|
** The period is expressed in Xtal ticks as a 32-bit unsigned
|
144 |
|
|
** integer number.
|
145 |
|
|
** This method is available only if runtime setting type
|
146 |
|
|
** 'from interval' is selected in the Timing dialog box in
|
147 |
|
|
** Runtime setting area.
|
148 |
|
|
** Parameters :
|
149 |
|
|
** NAME - DESCRIPTION
|
150 |
|
|
** Ticks - Period to set [in Xtal ticks]
|
151 |
|
|
** (16000 to 320000 ticks)
|
152 |
|
|
** Returns :
|
153 |
|
|
** --- - Error code, possible codes:
|
154 |
|
|
** ERR_OK - OK
|
155 |
|
|
** ERR_SPEED - This device does not work in
|
156 |
|
|
** the active speed mode
|
157 |
|
|
** ERR_MATH - Overflow during evaluation
|
158 |
|
|
** ERR_RANGE - Parameter out of range
|
159 |
|
|
** ===================================================================
|
160 |
|
|
*/
|
161 |
|
|
|
162 |
|
|
byte TickTimer_SetPeriodUS(word Time);
|
163 |
|
|
/*
|
164 |
|
|
** ===================================================================
|
165 |
|
|
** Method : TickTimer_SetPeriodUS (bean TimerInt)
|
166 |
|
|
**
|
167 |
|
|
** Description :
|
168 |
|
|
** This method sets the new period of the generated events.
|
169 |
|
|
** The period is expressed in microseconds as a 16-bit
|
170 |
|
|
** unsigned integer number.
|
171 |
|
|
** This method is available only if runtime setting type
|
172 |
|
|
** 'from interval' is selected in the Timing dialog box in
|
173 |
|
|
** Runtime setting area.
|
174 |
|
|
** Parameters :
|
175 |
|
|
** NAME - DESCRIPTION
|
176 |
|
|
** Time - Period to set [in microseconds]
|
177 |
|
|
** (1000 to 20000 microseconds)
|
178 |
|
|
** Returns :
|
179 |
|
|
** --- - Error code, possible codes:
|
180 |
|
|
** ERR_OK - OK
|
181 |
|
|
** ERR_SPEED - This device does not work in
|
182 |
|
|
** the active speed mode
|
183 |
|
|
** ERR_MATH - Overflow during evaluation
|
184 |
|
|
** ERR_RANGE - Parameter out of range
|
185 |
|
|
** ===================================================================
|
186 |
|
|
*/
|
187 |
|
|
|
188 |
|
|
byte TickTimer_SetPeriodMS(word Time);
|
189 |
|
|
/*
|
190 |
|
|
** ===================================================================
|
191 |
|
|
** Method : TickTimer_SetPeriodMS (bean TimerInt)
|
192 |
|
|
**
|
193 |
|
|
** Description :
|
194 |
|
|
** This method sets the new period of the generated events.
|
195 |
|
|
** The period is expressed in miliseconds as a 16-bit
|
196 |
|
|
** unsigned integer number.
|
197 |
|
|
** This method is available only if runtime setting type
|
198 |
|
|
** 'from interval' is selected in the Timing dialog box in
|
199 |
|
|
** Runtime setting area.
|
200 |
|
|
** Parameters :
|
201 |
|
|
** NAME - DESCRIPTION
|
202 |
|
|
** Time - Period to set [in miliseconds]
|
203 |
|
|
** (1 to 20 milliseconds)
|
204 |
|
|
** Returns :
|
205 |
|
|
** --- - Error code, possible codes:
|
206 |
|
|
** ERR_OK - OK
|
207 |
|
|
** ERR_SPEED - This device does not work in
|
208 |
|
|
** the active speed mode
|
209 |
|
|
** ERR_MATH - Overflow during evaluation
|
210 |
|
|
** ERR_RANGE - Parameter out of range
|
211 |
|
|
** ===================================================================
|
212 |
|
|
*/
|
213 |
|
|
|
214 |
|
|
byte TickTimer_SetFreqHz(word Freq);
|
215 |
|
|
/*
|
216 |
|
|
** ===================================================================
|
217 |
|
|
** Method : TickTimer_SetFreqHz (bean TimerInt)
|
218 |
|
|
**
|
219 |
|
|
** Description :
|
220 |
|
|
** This method sets the new frequency of the generated
|
221 |
|
|
** events. The frequency is expressed in Hz as a 16-bit
|
222 |
|
|
** unsigned integer number.
|
223 |
|
|
** This method is available only if runtime setting type
|
224 |
|
|
** 'from interval' is selected in the Timing dialog box in
|
225 |
|
|
** Runtime setting area.
|
226 |
|
|
** Parameters :
|
227 |
|
|
** NAME - DESCRIPTION
|
228 |
|
|
** Freq - Frequency to set [in Hz]
|
229 |
|
|
** (50 to 1000 Hz)
|
230 |
|
|
** Returns :
|
231 |
|
|
** --- - Error code, possible codes:
|
232 |
|
|
** ERR_OK - OK
|
233 |
|
|
** ERR_SPEED - This device does not work in
|
234 |
|
|
** the active speed mode
|
235 |
|
|
** ERR_MATH - Overflow during evaluation
|
236 |
|
|
** ERR_RANGE - Parameter out of range
|
237 |
|
|
** ===================================================================
|
238 |
|
|
*/
|
239 |
|
|
|
240 |
|
|
#pragma CODE_SEG __NEAR_SEG NON_BANKED /* Interrupt section for this module. Placement will be in NON_BANKED area. */
|
241 |
|
|
__interrupt void TickTimer_Interrupt(void);
|
242 |
|
|
#pragma CODE_SEG TickTimer_CODE /* Code section for this module. */
|
243 |
|
|
/*
|
244 |
|
|
** ===================================================================
|
245 |
|
|
** Method : TickTimer_Interrupt (bean TimerInt)
|
246 |
|
|
**
|
247 |
|
|
** Description :
|
248 |
|
|
** This method is internal. It is used by Processor Expert
|
249 |
|
|
** only.
|
250 |
|
|
** ===================================================================
|
251 |
|
|
*/
|
252 |
|
|
|
253 |
|
|
void TickTimer_Init(void);
|
254 |
|
|
/*
|
255 |
|
|
** ===================================================================
|
256 |
|
|
** Method : TickTimer_Init (bean TimerInt)
|
257 |
|
|
**
|
258 |
|
|
** Description :
|
259 |
|
|
** This method is internal. It is used by Processor Expert
|
260 |
|
|
** only.
|
261 |
|
|
** ===================================================================
|
262 |
|
|
*/
|
263 |
|
|
|
264 |
|
|
#pragma CODE_SEG DEFAULT /* Change code section to DEFAULT. */
|
265 |
|
|
|
266 |
|
|
/* END TickTimer. */
|
267 |
|
|
|
268 |
|
|
#endif /* ifndef __TickTimer */
|
269 |
|
|
/*
|
270 |
|
|
** ###################################################################
|
271 |
|
|
**
|
272 |
|
|
** This file was created by UNIS Processor Expert 03.33 for
|
273 |
|
|
** the Motorola HCS12 series of microcontrollers.
|
274 |
|
|
**
|
275 |
|
|
** ###################################################################
|
276 |
|
|
*/
|