Download Embedded C Tutorial - (8051)

Transcript
8322 Chapter 9 p217-254
250
21/2/02
10:04 am
Page 250
Embedded C
Listing 9.11
Part of a data-acquisition example
/*------------------------------------------------------------*Simple_EOS.C (v1.00)
------------------------------------------------------------Main file for Simple Embedded Operating System (sEOS) for 8051.
– This version for project DATA_ACQ (Chapter 9).
-*------------------------------------------------------------*/
#include "Main.H"
#include "Simple_EOS.H"
#include "Menu_Data.H"
/*------------------------------------------------------------*sEOS_ISR()
Invoked periodically by Timer 2 overflow:
see sEOS_Init_Timer2() for timing details.
-*------------------------------------------------------------*/
void sEOS_ISR() interrupt INTERRUPT_Timer_2_Overflow
{
// Must manually reset the T2 flag
TF2 = 0;
//===== USER CODE – Begin ==================================
// Call MENU_Command_Processor every 5ms
MENU_Command_Processor();
//===== USER CODE – End ====================================
}
/*------------------------------------------------------------*sEOS_Init_Timer2()
Sets up Timer 2 to drive the simple EOS.
Parameter gives tick interval in MILLISECONDS.
Max tick interval is ~60ms (12 MHz oscillator).