📄 timer_func.lst
字号:
C51 COMPILER V7.00 Beta 6 TIMER_FUNC 02/19/2003 15:59:28 PAGE 1
C51 COMPILER V7.00 Beta 6, COMPILATION OF MODULE TIMER_FUNC
OBJECT MODULE PLACED IN timer_func.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE timer_func.c LARGE BROWSE DEBUG OBJECTEXTEND
stmt level source
1
2 /*---------------------------------------------------------------------------
3 Copyright (c) 2002 ST Microelectronics
4 This example demo code is provided as is and has no warranty,
5 implied or otherwise. You are free to use/modify any of the provided
6 code at your own risk in your applications with the expressed limitation
7 of liability (see below) so long as your product using the code contains
8 at least one uPSD products (device).
9
10 LIMITATION OF LIABILITY: NEITHER STMicroelectronics NOR ITS VENDORS OR
11 AGENTS SHALL BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA,
12 INTERRUPTION OF BUSINESS, NOR FOR INDIRECT, SPECIAL, INCIDENTAL OR
13 CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER THIS AGREEMENT OR
14 OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
15 --------------------------------------------------------------------------*/
16
17
18 #include "upsd_cfg.h"
19
20 #include "general.h"
21 #include "timer.h"
22
23 //Timer functions are ready for 1ms interval
24
25 #define TIMER0_SCALE TIMER0_PERIOD/1000
26
27 int counter;
28
29 /*------------------------------------------------------------------------------
30 This function extend Timer0 operation in every timer0 interrupt
31 ------------------------------------------------------------------------------*/
32 void do_timer0(void) {
33 1
34 1 // put your extended functions for timer0 interrupt
35 1
36 1 counter++;
37 1 }
38
39 /*------------------------------------------------------------------------------
40 // Following are a collection of timer routines.
41 ------------------------------------------------------------------------------*/
42 void delay_ms(count)
43 uint count;
44 {
45 1 if(count <= TIMER0_SCALE)
46 1 timer0_wait(count);
47 1 else
48 1 {
49 2 count /= TIMER0_SCALE;
50 2 timer0_wait(count);
51 2 }
52 1 }
53 /*
54 void delay_1sec(void)
55 {
C51 COMPILER V7.00 Beta 6 TIMER_FUNC 02/19/2003 15:59:28 PAGE 2
56 timer0_wait(1000);
57 }
58
59
60 void delay_2sec(void)
61 {
62 timer0_wait(200);
63 }
64
65 void delay_10sec(void)
66 {
67 timer0_wait(1000);
68 }
69
70 void delay_0_5sec(void)
71 {
72 timer0_wait(50);
73 }
74
75 void delay_0_1sec(void)
76 {
77 timer0_wait(10);
78 }
79
80 void delay_46us(void) // Delay of 44.8 usec. measured
81 {
82 delay_14us();
83 delay_14us();
84 delay_14us();
85 }
86
87 void delay_14us(void) // Delay of 14.8us w/16Mhz 8031 measured
88 {
89 uchar a;
90 uchar b;
91 data uint c;
92 a=1;
93 b=2;
94 c=a+b;
95 a=3;
96 b=c;
97 c=4;
98 }
99 */
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 60 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 2 2
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
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 + -