51_LanQiaoBei/2025/User/Listings/main.lst
2025-04-22 17:34:15 +08:00

142 lines
4.9 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

C51 COMPILER V9.60.7.0 MAIN 04/15/2025 20:33:28 PAGE 1
C51 COMPILER V9.60.7.0, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\Objects\main.obj
COMPILER INVOKED BY: C:\Users\ZBright\AppData\Local\Keil_v5\C51\BIN\C51.EXE main.c OPTIMIZE(8,SPEED) BROWSE INCDIR(..\Dr
-iver) DEBUG OBJECTEXTEND PRINT(.\Listings\main.lst) OBJECT(.\Objects\main.obj)
line level source
1 /* 头文件申明*/
2 #include <STC15F2K60S2.H>
3 #include <Key.h>
4 #include <Seg.h>
5 #include <Led.h>
6 #include <Init.h>
7 #include <onewire.h>
8
9 /* 变量申明*/
10 unsigned char Key_Slow_Down;//按键减速变量
11 unsigned char Key_Val,Key_Old,Key_Down,Key_Up;
12 unsigned int Seg_Slow_Down;
13 unsigned char Seg_Pos;
14 unsigned char Seg_Buf[8]=
15 {
16 16,16,16,16,16,16,16,16
17 };
18 unsigned char Seg_Point[8]=
19 {
20 0,0,0,0,0,0,0,0
21 };
22 unsigned char ucLed[8]=
23 {
24 1,0,1,0,0,0,0,0
25 };
26
27 unsigned char Seg_Show;
28 unsigned int Tempr_Show_10x = 0,Relay_Timer;
29 unsigned char Relay_Flag;
30
31 /* 处理函数key,seg,led*/
32 void Key_Proc()
33 {
34 1 if(Key_Slow_Down) return;
35 1 Key_Slow_Down = 1;
36 1
37 1 Key_Val = Key_Read();
38 1 Key_Down = Key_Val & (Key_Old ^ Key_Val);
39 1 Key_Up = ~Key_Val & (Key_Old ^ Key_Val);
40 1 Key_Old = Key_Val;
41 1
42 1 if(Key_Down != 0)
43 1 Seg_Show = Key_Down;
44 1 }
45
46 void Seg_Proc()
47 {
48 1 if(Seg_Slow_Down) return;
49 1 Seg_Slow_Down = 1;
50 1
51 1 Tempr_Show_10x = Tempr_Read() * 10;
52 1 Seg_Buf[0] = Tempr_Show_10x /100 %10;
53 1 Seg_Buf[1] = Tempr_Show_10x /10 %10;
54 1 Seg_Point[1] = 1;
C51 COMPILER V9.60.7.0 MAIN 04/15/2025 20:33:28 PAGE 2
55 1 Seg_Buf[2] = Tempr_Show_10x % 10;
56 1 }
57
58 void Led_Proc()
59 {
60 1 ucLed[4] = 1;
61 1 ucLed[5] = 0;
62 1 ucLed[6] = 0;
63 1 ucLed[7] = 1;
64 1 }
65
66 /* 定时器函数(初始化、中断函数)*/
67 void Timer0_Init(void) //1毫秒@12.000MHz
68 {
69 1 AUXR &= 0x7F; //定时器时钟12T模式
70 1 TMOD &= 0xF0; //设置定时器模式
71 1 TL0 = 0x18; //设置定时初始值
72 1 TH0 = 0xFC; //设置定时初始值
73 1 TF0 = 0; //清除TF0标志
74 1 TR0 = 1; //定时器0开始计时
75 1 ET0 = 1;
76 1 EA = 1;
77 1 }
78
79 void Timer0_Server() interrupt 1
80 {
81 1 if(++Key_Slow_Down == 10) Key_Slow_Down = 0;
82 1 if(++Seg_Slow_Down == 500) Seg_Slow_Down = 0;
83 1 if(++Seg_Pos == 8) Seg_Pos = 0;
84 1
85 1 Seg_Disp(Seg_Pos,Seg_Buf[Seg_Pos],Seg_Point[Seg_Pos]);
86 1 Led_Disp(Seg_Pos,ucLed[Seg_Pos]);
87 1
88 1 }
89 /* 主函数*/
90 void main()
91 {
92 1 System_Init();
93 1 Timer0_Init();
94 1 while(1)
95 1 {
96 2 Key_Proc();
97 2 Seg_Proc();
98 2 Led_Proc();
99 2 }
100 1 }
101
102
103
104
105
106
107
108
109
110
111
112
113
MODULE INFORMATION: STATIC OVERLAYABLE
C51 COMPILER V9.60.7.0 MAIN 04/15/2025 20:33:28 PAGE 3
CODE SIZE = 307 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 38 ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)