51_LanQiaoBei/2025/User/Listings/main.lst
2025-04-13 01:02:19 +08:00

130 lines
4.4 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/13/2025 00:35:53 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
8 /* 变量申明*/
9 unsigned char Key_Slow_Down;//按键减速变量
10 unsigned char Key_Val,Key_Old,Key_Down,Key_Up;
11 unsigned int Seg_Slow_Down;
12 unsigned char Seg_Pos;
13 unsigned char Seg_Buf[8]=
14 {
15 16,16,16,16,16,16,16,16
16 };
17 unsigned char Seg_Point[8]=
18 {
19 0,0,0,0,0,0,0,0
20 };
21 unsigned char ucLed[8]=
22 {
23 1,0,0,0,0,0,0,0
24 };
25
26 unsigned char Seg_Show;
27
28 /* 处理函数key,seg,led*/
29 void Key_Proc()
30 {
31 1 if(Key_Slow_Down) return;
32 1 Key_Slow_Down = 1;
33 1
34 1 Key_Val = Key_Read();
35 1 Key_Down = Key_Val & (Key_Old ^ Key_Val);
36 1 Key_Up = ~Key_Val & (Key_Old ^ Key_Val);
37 1 Key_Old = Key_Val;
38 1
39 1 if(Key_Down != 0)
40 1 Seg_Show = Key_Down;
41 1 }
42
43 void Seg_Proc()
44 {
45 1 if(Seg_Slow_Down) return;
46 1 Seg_Slow_Down = 1;
47 1
48 1 Seg_Buf[0] = Seg_Show /10 %10;
49 1 Seg_Buf[1] = Seg_Show %10;
50 1 }
51
52 void Led_Proc()
53 {
54 1
C51 COMPILER V9.60.7.0 MAIN 04/13/2025 00:35:53 PAGE 2
55 1 }
56
57 /* 定时器函数(初始化、中断函数)*/
58 void Timer0_Init(void) //1毫秒@12.000MHz
59 {
60 1 AUXR &= 0x7F; //定时器时钟12T模式
61 1 TMOD &= 0xF0; //设置定时器模式
62 1 TL0 = 0x18; //设置定时初始值
63 1 TH0 = 0xFC; //设置定时初始值
64 1 TF0 = 0; //清除TF0标志
65 1 TR0 = 1; //定时器0开始计时
66 1 ET0 = 1;
67 1 EA = 1;
68 1 }
69
70 void Timer0_Server() interrupt 1
71 {
72 1 if(++Key_Slow_Down == 10) Key_Slow_Down = 0;
73 1 if(++Seg_Slow_Down == 500) Seg_Slow_Down = 0;
74 1 if(++Seg_Pos == 8) Seg_Pos = 0;
75 1 Seg_Disp(Seg_Pos,Seg_Buf[Seg_Pos],Seg_Point[Seg_Pos]);
76 1 Led_Disp(Seg_Pos,ucLed[Seg_Pos]);
77 1
78 1 }
79 /* 主函数*/
80 void main()
81 {
82 1 System_Init();
83 1 Timer0_Init();
84 1 while(1)
85 1 {
86 2 Key_Proc();
87 2 Seg_Proc();
88 2 Led_Proc();
89 2 }
90 1 }
91
92
93
94
95
96
97
98
99
100
101
102
103
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 246 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 33 ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)