📄 main.lst
字号:
C51 COMPILER V8.02 MAIN 10/31/2008 16:34:59 PAGE 1
C51 COMPILER V8.02, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN MAIN.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE MAIN.c BROWSE DEBUG OBJECTEXTEND
line level source
1 /********************************************************************************/
2 /* filename : MAIN.c */
3 /* created : xillinx */
4 /* descript : 系统的C函数入口 */
5 /********************************************************************************/
6 #include "../CPU/CPU.h"
7 #include "../CFG/CFG.h"
8 #include "../UART/UART.h"
9 #include "../LED/LED.h"
10 #include "../SEG7/SEG7.h"
11 #include "../HC595/HC595.h"
12 #include "../TC1602A/TC1602A.h"
13 #include "../DS18B20/DS18B20.h"
14
15 unsigned int system_timer=0x00; //* 这是系统需要的定时器变量
16
17 /********************************************************************************/
18 /* funname : MAIN_ds18b20_hook() */
19 /* created : xillinx */
20 /* time : 2008-08-06 */
21 /* descript: DS18B20启动转换HOOK函数 */
22 /********************************************************************************/
23 void MAIN_ds18b20_hook(void)
24 { DS18B20_mflag=0x1;
25 1 }
26
27 /********************************************************************************/
28 /* funname : MAIN_proc_ds18b20() */
29 /* created : xillinx */
30 /* time : 2008-08-06 */
31 /* descript: DS18B20调试输出 */
32 /********************************************************************************/
33 void MAIN_proc_ds18b20(void)
34 { unsigned char flag;
35 1 unsigned char dt;
36 1 char buffer[0x20];
37 1 int mdata;
38 1 int lo;
39 1 int hi;
40 1
41 1 if(DS18B20_mflag==0x0)
42 1 { return;
43 2 }
44 1 DS18B20_mflag=0x0;
45 1 mdata=(int)DSB20_read_temperature();
46 1 DSB20_delay_100_us();
47 1 DSB20_start_convert();
48 1 if(mdata<0x0)
49 1 { flag=0x1;
50 2 mdata=-mdata;
51 2 }
52 1 else
53 1 { flag=0x0;
54 2 }
55 1 dt=mdata&0xF;
C51 COMPILER V8.02 MAIN 10/31/2008 16:34:59 PAGE 2
56 1 hi=mdata>>0x4;
57 1 lo=0x0;
58 1 if(dt&0x8)
59 1 { lo+=5000;
60 2 }
61 1 if(dt&0x4)
62 1 { lo+=2500;
63 2 }
64 1 if(dt&0x2)
65 1 { lo+=1250;
66 2 }
67 1 if(dt&0x1)
68 1 { lo+=625;
69 2 }
70 1
71 1 if(flag)
72 1 { sprintf(buffer,"-%d.%d",hi,lo);
73 2 }
74 1 else
75 1 { sprintf(buffer,"%d.%d",hi,lo);
76 2 }
77 1 LCDT_LED_clear();
78 1 LCDT_print_string(0x0,0x0," temperature "); /* 测试点阵LCD */
79 1 LCDT_print_string(0x2,0x1,buffer);
80 1 return;
81 1 }
82
83 /********************************************************************************/
84 /* fun_name : MAIN_interrupt_hook_process() */
85 /* version : v1.00 */
86 /* created : xillinx */
87 /* descript : 定时器钩子函数的处理,如果需要使用这些函数,需要重新挂接,如果不需要 */
88 /* 不需要做任何事情 */
89 /********************************************************************************/
90 void MAIN_interrupt_hook_process (void)
91 { CPU_001_tick_process = CPU_interrupt_proc_null; //* 定时器钩子函数的缺省处理,如果需要使用这些函数,需要
-重新挂接
92 1 CPU_002_tick_process = CPU_interrupt_proc_null;
93 1 CPU_004_tick_process = CPU_interrupt_proc_null;
94 1 CPU_008_tick_process = CPU_interrupt_proc_null;
95 1 CPU_010_tick_process = CPU_interrupt_proc_null;
96 1 CPU_020_tick_process = CPU_interrupt_proc_null;
97 1 CPU_040_tick_process = CPU_interrupt_proc_null;
98 1 CPU_080_tick_process = CPU_interrupt_proc_null;
99 1 CPU_100_tick_process = CPU_interrupt_proc_null;
100 1 CPU_200_tick_process = CPU_interrupt_proc_null;
101 1 CPU_400_tick_process = CPU_interrupt_proc_null;
102 1 CPU_extern_0_process = CPU_interrupt_proc_null;
103 1 CPU_extern_1_process = CPU_interrupt_proc_null;
104 1 CPU_timer_02_process = CPU_interrupt_proc_null;
105 1 //* 重新挂接HOOK函数
106 1 CPU_001_tick_process = HC595_refresh; //* 2MS
107 1 CPU_080_tick_process = LED_refresh; //* 128x2=256MS
108 1 CPU_400_tick_process = MAIN_ds18b20_hook; //* 2秒钟启动一次转换
109 1 }
110
111 /********************************************************************************/
112 /* function : main() */
113 /* recension: xillinx */
114 /* descript : 主函数入口 */
115 /********************************************************************************/
116 void main (void)
C51 COMPILER V8.02 MAIN 10/31/2008 16:34:59 PAGE 3
117 { unsigned int delax=0x8000;
118 1 while(delax--)
119 1 { ;
120 2 }
121 1 LCDT_initialize();
122 1 UART_buffer_initilize();
123 1 MAIN_interrupt_hook_process(); //* CPU的挂接函数处理
124 1 CPU_source_initialize(); //* 控制CPU的资源
125 1 SEG7_clear_screen();
126 1 SEG7_printf_ascii("1234.567"); //* 测试七段数码管
127 1 UART_printf("融益通讯学习板\r\n"); //* 测试UART串口
128 1 LCDT_print_string(0x0,0x0,"rongyitong tech"); /* 测试点阵LCD */
129 1 LCDT_print_string(0x0,0x1,"cchhww11@tom.com");
130 1 DSB20_initialize();
131 1 while(1)
132 1 { MAIN_proc_ds18b20();
133 2 }
134 1 }
135
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 455 ----
CONSTANT SIZE = 88 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 2 39
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 + -