?? simple_eos.lst
字號:
C51 COMPILER V6.21 SIMPLE_EOS 01/23/2002 18:05:24 PAGE 1
C51 COMPILER V6.21, 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
3 Simple_EOS.C (v1.00)
4
5 ------------------------------------------------------------------
6
7 Main file for Simple Embedded Operating System (sEOS) for 8051.
8
9 - This version for project DATA_ACQ (Chapter 9).
10
11 COPYRIGHT
12 ---------
13
14 This code is associated with the book:
15
16 EMBEDDED C by Michael J. Pont
17 [Pearson Education, 2002: ISBN: 0-201-79523-X].
18
19 This code is copyright (c) 2001 by Michael J. Pont.
20
21 See book for copyright details and other information.
22
23 -*------------------------------------------------------------------*/
24
25 #include "Main.H"
26 #include "Simple_EOS.H"
27
28 #include "Menu_Data.H"
29
30 /*------------------------------------------------------------------*-
31
32 sEOS_ISR()
33
34 Invoked periodically by Timer 2 overflow:
35 see sEOS_Init_Timer2() for timing details.
36
37 -*------------------------------------------------------------------*/
38 void sEOS_ISR() interrupt INTERRUPT_Timer_2_Overflow
39 {
40 1 TF2 = 0; // Must manually reset the T2 flag
41 1
42 1 //===== USER CODE - Begin =======================================
43 1 // Call MENU_Command_Processor every 5ms
44 1 MENU_Command_Processor();
45 1
46 1 //===== USER CODE - End =========================================
47 1 }
48
49 /*------------------------------------------------------------------*-
50
51 sEOS_Init_Timer2()
52
53 Sets up Timer 2 to drive the simple EOS.
54
55 Parameter gives tick interval in MILLISECONDS.
C51 COMPILER V6.21 SIMPLE_EOS 01/23/2002 18:05:24 PAGE 2
56
57 Max tick interval is ~60ms (12 MHz oscillator).
58
59 Note: Precise tick intervals are only possible with certain
60 oscillator / tick interval combinations. If timing is important,
61 you should check the timing calculations manually.
62
63 -*------------------------------------------------------------------*/
64 void sEOS_Init_Timer2(const tByte TICK_MS)
65 {
66 1 tLong Inc;
67 1 tWord Reload_16;
68 1 tByte Reload_08H, Reload_08L;
69 1
70 1 // Timer 2 is configured as a 16-bit timer,
71 1 // which is automatically reloaded when it overflows
72 1 T2CON = 0x04; // Load Timer 2 control register
73 1
74 1 // Number of timer increments required (max 65536)
75 1 Inc = ((tLong)TICK_MS * (OSC_FREQ/1000)) / (tLong)OSC_PER_INST;
76 1
77 1 // 16-bit reload value
78 1 Reload_16 = (tWord) (65536UL - Inc);
79 1
80 1 // 8-bit reload values (High & Low)
81 1 Reload_08H = (tByte)(Reload_16 / 256);
82 1 Reload_08L = (tByte)(Reload_16 % 256);
83 1
84 1 // Used for manually checking timing (in simulator)
85 1 //P2 = Reload_08H;
86 1 //P3 = Reload_08L;
87 1
88 1 TH2 = Reload_08H; // Load Timer 2 high byte
89 1 RCAP2H = Reload_08H; // Load Timer 2 reload capt. reg. high byte
90 1 TL2 = Reload_08L; // Load Timer 2 low byte
91 1 RCAP2L = Reload_08L; // Load Timer 2 reload capt. reg. low byte
92 1
93 1 // Timer 2 interrupt is enabled, and ISR will be called
94 1 // whenever the timer overflows.
95 1 ET2 = 1;
96 1
97 1 // Start Timer 2 running
98 1 TR2 = 1;
99 1
100 1 EA = 1; // Globally enable interrupts
101 1 }
102
103 /*------------------------------------------------------------------*-
104
105 sEOS_Go_To_Sleep()
106
107 This operating system enters 'idle mode' between clock ticks
108 to save power. The next clock tick will return the processor
109 to the normal operating state.
110
111 *** ADAPT AS REQUIRED FOR YOUR HARDWARE ***
112
113 -*------------------------------------------------------------------*/
114 void sEOS_Go_To_Sleep(void)
115 {
116 1 PCON |= 0x01; // Enter idle mode (generic 8051 version)
117 1 }
C51 COMPILER V6.21 SIMPLE_EOS 01/23/2002 18:05:24 PAGE 3
118
119 /*------------------------------------------------------------------*-
120 ---- END OF FILE -------------------------------------------------
121 -*------------------------------------------------------------------*/
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)
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -