📄 simple_eos.lst
字号:
C51 COMPILER V7.07 SIMPLE_EOS 06/12/2006 21:12:15 PAGE 1
C51 COMPILER V7.07, COMPILATION OF MODULE SIMPLE_EOS
OBJECT MODULE PLACED IN Simple_EOS.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE Simple_EOS.c OPTIMIZE(6,SIZE) BROWSE DEBUG OBJECTEXTEND
stmt level source
1 /*------------------------------------------------------------------*-
2 Simple_EOS.C (v1.00)
3 ------------------------------------------------------------------
4 Main file for Simple Embedded Operating System (sEOS) for 8051.
5 -*------------------------------------------------------------------*/
6 #include "Main.H"
7 #include "Simple_EOS.H"
8 #include "Menu_Data.H"
9 /*------------------------------------------------------------------*-
10 sEOS_ISR()
11 Invoked periodically by Timer 2 overflow:
12 see sEOS_Init_Timer2() for timing details.
13 -*------------------------------------------------------------------*/
14 void sEOS_ISR() interrupt INTERRUPT_Timer_2_Overflow
15 {
16 1 TF2 = 0; // Must manually reset the T2 flag
17 1 //===== USER CODE - Begin =======================================
18 1 // Call MENU_Command_Processor every 5ms
19 1 MENU_Command_Processor();
20 1 //===== USER CODE - End =========================================
21 1 }
22 /*------------------------------------------------------------------*-
23 sEOS_Init_Timer2()
24
25 Sets up Timer 2 to drive the simple EOS.
26 Parameter gives tick interval in MILLISECONDS.
27 Max tick interval is ~60ms (12 MHz oscillator).
28
29 Note: Precise tick intervals are only possible with certain
30 oscillator / tick interval combinations. If timing is important,
31 you should check the timing calculations manually.
32 -*------------------------------------------------------------------*/
33 void sEOS_Init_Timer2(const tByte TICK_MS)
34 {
35 1 tLong Inc;
36 1 tWord Reload_16;
37 1 tByte Reload_08H, Reload_08L;
38 1 // Timer 2 is configured as a 16-bit timer,
39 1 // which is automatically reloaded when it overflows
40 1 T2CON = 0x04; // Load Timer 2 control register
41 1 // Number of timer increments required (max 65536)
42 1 Inc = ((tLong)TICK_MS * (OSC_FREQ/1000)) / (tLong)OSC_PER_INST;
43 1 // 16-bit reload value
44 1 Reload_16 = (tWord) (65536UL - Inc);
45 1 // 8-bit reload values (High & Low)
46 1 Reload_08H = (tByte)(Reload_16 / 256);
47 1 Reload_08L = (tByte)(Reload_16 % 256);
48 1 // Used for manually checking timing (in simulator)
49 1 //P2 = Reload_08H;
50 1 //P3 = Reload_08L;
51 1 TH2 = Reload_08H; // Load Timer 2 high byte
52 1 RCAP2H = Reload_08H; // Load Timer 2 reload capt. reg. high byte
53 1 TL2 = Reload_08L; // Load Timer 2 low byte
54 1 RCAP2L = Reload_08L; // Load Timer 2 reload capt. reg. low byte
55 1 // Timer 2 interrupt is enabled, and ISR will be called
C51 COMPILER V7.07 SIMPLE_EOS 06/12/2006 21:12:15 PAGE 2
56 1 // whenever the timer overflows.
57 1 ET2 = 1;
58 1 // Start Timer 2 running
59 1 TR2 = 1;
60 1 EA = 1; // Globally enable interrupts
61 1 }
62 /* sEOS_Go_To_Sleep() */
63 void sEOS_Go_To_Sleep(void)
64 {
65 1 PCON |= 0x01; // Enter idle mode (generic 8051 version)
66 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 123 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 4
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 + -