📄 scheduler.lst
字号:
182 * mode 16-bit Timer, Time counter
183 * T0_PRIO to be defined in config.h
184 * TIM_LOW & TIM_HIGH defined in scheduler.h
185 *----------------------------------------------------------------------------
186 * REQUIREMENTS:
187 *****************************************************************************/
188 void sch_time_init (void)
189 {
190 1 T0_init(T0_NOT_GATED, T0_TIMER, T0_MODE_1);
191 1 TL0 = TIM_LOW;
192 1 TH0 = TIM_HIGH;
193 1 t0_set_prio(T0_PRIO); /* set-up priority */
194 1 T0_enable_int(); /* enable interrupt */
195 1 T0_start(); /* start time base */
196 1 }
197
198 /*F**************************************************************************
199 * NAME: sch_timer_int
200 *----------------------------------------------------------------------------
201 * PARAMS:
202 *
203 * return:
204 *----------------------------------------------------------------------------
205 * PURPOSE:
206 * Timer 0 interrupt function
207 *----------------------------------------------------------------------------
208 * EXAMPLE:
209 *----------------------------------------------------------------------------
210 * NOTE:
211 * IRQ_T0 defined in extsnd1.h
212 *----------------------------------------------------------------------------
213 * REQUIREMENTS:
214 ******************************************************************************/
215 Interrupt (sch_timer_int(void), IRQ_T0)
216 {
217 1 // T0_stop(); /* stop timer */
218 1 TL0 = TIM_LOW; /* reload timer */
219 1 TH0 = TIM_HIGH;
220 1 // T0_start(); /* restart timer */
221 1
222 1 #if (SCH_TYPE != SCH_FREE)
sch_tick_flag = TRUE;
#endif
225 1 /* increment task tick counters */
226 1 gl_cpt_tick++; /* general timer */
227 1 gl_kbd_tick++; /* keyboard timer */
228 1 gl_mem_tick++; /* memory timer */
229 1 gl_led_tick++; /* LED timer */
230 1 gl_act_tick++; /* Inactivity TIMER */
231 1
232 1
233 1 }
234
235
236 #elif (SCH_TIMER == SCH_TIMER1)
/*F**************************************************************************
* NAME: sch_time_init
*----------------------------------------------------------------------------
* PARAMS:
C51 COMPILER V7.02a SCHEDULER 09/13/2007 11:52:59 PAGE 5
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Scheduler time base (timer 1) initialization
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
* mode 16-bit Timer, Time counter
* T1_PRIO to be defined in config.h
* TIM_LOW & TIM_HIGH defined in scheduler.h
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void sch_time_init (void)
{
T1_init(T1_NOT_GATED, T1_TIMER, T1_MODE_1);
TL1 = TIM_LOW;
TH1 = TIM_HIGH;
t1_set_prio(T1_PRIO); /* set-up priority */
T1_enable_int(); /* enable interrupt */
T1_start(); /* start time base */
}
/*F**************************************************************************
* NAME: sch_timer_int
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Timer 1 interrupt function
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
* IRQ_T1 defined in extsnd1.h
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
Interrupt (sch_timer_int(void), IRQ_T1)
{
// T1_stop(); /* stop timer */
TL1 = TIM_LOW; /* reload timer */
TH1 = TIM_HIGH;
// T1_start(); /* restart timer */
#if (SCH_TYPE != SCH_FREE)
sch_tick_flag = TRUE;
#endif
gl_cpt_tick++;
}
#elif (SCH_TIMER == SCH_TIMER2)
/*F**************************************************************************
* NAME: sch_time_init
*----------------------------------------------------------------------------
* PARAMS:
C51 COMPILER V7.02a SCHEDULER 09/13/2007 11:52:59 PAGE 6
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Scheduler time base (timer 2) initialization
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
* mode 16-bit auto-reload
* T2_PRIO to be defined in config.h
* TIM_LOW & TIM_HIGH defined in scheduler.h
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void sch_time_init (void)
{
T2_init(T2_AUTO_RELOAD, T2_TIMER, T2_NOT_GATED);
RCAP2L = TIM_LOW;
RCAP2H = TIM_HIGH;
t2_set_prio(T2_PRIO); /* set-up priority */
T2_enable_int(); /* enable interrupt */
T2_start(); /* start time base */
}
/*F**************************************************************************
* NAME: sch_timer_int
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Timer 2 interrupt function
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
* IRQ_T2 defined in extsnd1.h
*----------------------------------------------------------------------------
* REQUIREMENTS:
******************************************************************************/
Interrupt (sch_timer_int(void), IRQ_T2)
{
TF2 = 0; /* ack interrupt */
#if (SCH_TYPE != SCH_FREE)
sch_tick_flag = TRUE;
#endif
gl_cpt_tick++;
}
#endif
355
356
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 104 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
C51 COMPILER V7.02a SCHEDULER 09/13/2007 11:52:59 PAGE 7
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -