110 lines
3.8 KiB
Plaintext
110 lines
3.8 KiB
Plaintext
|
C51 COMPILER V9.59.0.0 MAIN 03/12/2024 11:41:19 PAGE 1
|
|||
|
|
|||
|
|
|||
|
C51 COMPILER V9.59.0.0, COMPILATION OF MODULE MAIN
|
|||
|
OBJECT MODULE PLACED IN .\Objects\main.obj
|
|||
|
COMPILER INVOKED BY: D:\Keil_v5\C51\BIN\C51.EXE main.c OPTIMIZE(8,SPEED) BROWSE INCDIR(..\Driver) DEBUG OBJECTEXTEND PRI
|
|||
|
-NT(.\Listings\main.lst) TABS(2) OBJECT(.\Objects\main.obj)
|
|||
|
|
|||
|
line level source
|
|||
|
|
|||
|
1 #include "main.h"
|
|||
|
2 /* LED<45><44>ʾ */
|
|||
|
3 uchar ucLed[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
|||
|
4
|
|||
|
5 /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ */
|
|||
|
6 uchar Seg_Slow_Down; // <20><><EFBFBD><EFBFBD><EFBFBD>ܼ<EFBFBD><DCBC><EFBFBD>
|
|||
|
7 uchar Seg_Buf[8] = {5, 10, 10, 10, 10, 10, 10, 10}; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ֵ
|
|||
|
8 uchar Seg_Pos; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָʾ
|
|||
|
9 uchar Seg_Point[8] = {0, 0, 0, 0, 0, 0, 0, 0}; // ijλ<C4B3>Ƿ<EFBFBD><C7B7><EFBFBD>ʾС<CABE><D0A1><EFBFBD><EFBFBD>
|
|||
|
10
|
|||
|
11 /* <20><><EFBFBD>̷<EFBFBD><CCB7><EFBFBD> */
|
|||
|
12 uchar Key_Slow_Down;
|
|||
|
13 /* <20><><EFBFBD><EFBFBD> */
|
|||
|
14 uchar dis;
|
|||
|
15 /* <20><><EFBFBD>̴<EFBFBD><CCB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
16 void Key_Proc()
|
|||
|
17 {
|
|||
|
18 1 static uchar Key_Val, Key_Down, Key_Up, Key_Old;
|
|||
|
19 1 if (Key_Slow_Down)
|
|||
|
20 1 return;
|
|||
|
21 1 Key_Slow_Down = 1;
|
|||
|
22 1
|
|||
|
23 1 Key_Val = Key_Read();
|
|||
|
24 1 Key_Down = Key_Val & (Key_Old ^ Key_Val);
|
|||
|
25 1 Key_Up = ~Key_Val & (Key_Old ^ Key_Val);
|
|||
|
26 1 Key_Old = Key_Val;
|
|||
|
27 1 }
|
|||
|
28 /* <20><><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
29 void Seg_Proc()
|
|||
|
30 {
|
|||
|
31 1 if (Seg_Slow_Down)
|
|||
|
32 1 return;
|
|||
|
33 1 Seg_Slow_Down = 1;
|
|||
|
34 1 dis = Ut_Wave_Data();
|
|||
|
35 1 Seg_Buf[0] = dis / 1000 % 10;
|
|||
|
36 1 Seg_Buf[1] = dis / 100 % 10;
|
|||
|
37 1 Seg_Buf[2] = dis / 10 % 10;
|
|||
|
38 1 Seg_Buf[3] = dis % 10;
|
|||
|
39 1 }
|
|||
|
40
|
|||
|
41 /* LED<45><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
42 void Led_Proc()
|
|||
|
43 {
|
|||
|
44 1 }
|
|||
|
45
|
|||
|
46 /* <20><>ʱ<EFBFBD><CAB1>0<EFBFBD>жϳ<D0B6>ʼ<EFBFBD><CABC> */
|
|||
|
47 void Timer0_Init(void) // 1<><31><EFBFBD><EFBFBD>@12.000MHz
|
|||
|
48 {
|
|||
|
49 1 AUXR &= 0x7F; // <20><>ʱ<EFBFBD><CAB1>ʱ<EFBFBD><CAB1>12Tģʽ
|
|||
|
50 1 TMOD &= 0xF0; // <20><><EFBFBD>ö<EFBFBD>ʱ<EFBFBD><CAB1>ģʽ
|
|||
|
51 1 TL0 = 0x18; // <20><><EFBFBD>ö<EFBFBD>ʱ<EFBFBD><CAB1>ʼֵ
|
|||
|
52 1 TH0 = 0xFC; // <20><><EFBFBD>ö<EFBFBD>ʱ<EFBFBD><CAB1>ʼֵ
|
|||
|
53 1 TF0 = 0; // <20><><EFBFBD><EFBFBD>TF0<46><30>־
|
|||
|
54 1 TR0 = 1; // <20><>ʱ<EFBFBD><CAB1>0<EFBFBD><30>ʼ<EFBFBD><CABC>ʱ
|
|||
|
C51 COMPILER V9.59.0.0 MAIN 03/12/2024 11:41:19 PAGE 2
|
|||
|
|
|||
|
55 1 ET0 = 1;
|
|||
|
56 1 EA = 1;
|
|||
|
57 1 }
|
|||
|
58
|
|||
|
59 /* <20><>ʱ<EFBFBD><CAB1>0<EFBFBD>жϺ<D0B6><CFBA><EFBFBD> */
|
|||
|
60 void Timer0_ISR(void) interrupt 1
|
|||
|
61 {
|
|||
|
62 1 if (++Key_Slow_Down == 10)
|
|||
|
63 1 Key_Slow_Down = 0;
|
|||
|
64 1 if (++Seg_Slow_Down == 500)
|
|||
|
65 1 Seg_Slow_Down = 0;
|
|||
|
66 1
|
|||
|
67 1 if (++Seg_Pos == 8)
|
|||
|
68 1 Seg_Pos = 0;
|
|||
|
69 1 Seg_Disp(Seg_Pos, Seg_Buf[Seg_Pos], Seg_Point[Seg_Pos]);
|
|||
|
70 1 Led_Disp(Seg_Pos, ucLed[Seg_Pos]);
|
|||
|
71 1 }
|
|||
|
72
|
|||
|
73 void main()
|
|||
|
74 {
|
|||
|
75 1 System_Init();
|
|||
|
76 1 Timer0_Init();
|
|||
|
77 1 while (1)
|
|||
|
78 1 {
|
|||
|
79 2 Key_Proc();
|
|||
|
80 2 Seg_Proc();
|
|||
|
81 2 Led_Proc();
|
|||
|
82 2 }
|
|||
|
83 1 }
|
|||
|
|
|||
|
|
|||
|
MODULE INFORMATION: STATIC OVERLAYABLE
|
|||
|
CODE SIZE = 258 ----
|
|||
|
CONSTANT SIZE = ---- ----
|
|||
|
XDATA SIZE = ---- ----
|
|||
|
PDATA SIZE = ---- ----
|
|||
|
DATA SIZE = 32 ----
|
|||
|
IDATA SIZE = ---- ----
|
|||
|
BIT SIZE = ---- ----
|
|||
|
END OF MODULE INFORMATION.
|
|||
|
|
|||
|
|
|||
|
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
|