51_LanQiaoBei/模板/蓝桥杯全模块测试例程/DS18B20温度模块/User/Listings/Led.lst
2025-04-13 01:02:19 +08:00

102 lines
3.5 KiB
Plaintext
Raw Permalink 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.

C51 COMPILER V9.59.0.0 LED 05/02/2024 15:57:34 PAGE 1
C51 COMPILER V9.59.0.0, COMPILATION OF MODULE LED
OBJECT MODULE PLACED IN .\Objects\Led.obj
COMPILER INVOKED BY: D:\Keil_v5\C51\BIN\C51.EXE ..\Driver\Led.c OPTIMIZE(8,SPEED) BROWSE INCDIR(..\Driver) DEBUG OBJECTE
-XTEND PRINT(.\Listings\Led.lst) TABS(2) OBJECT(.\Objects\Led.obj)
line level source
1 #include "Led.h"
2 /// @brief Led显示
3 /// @param addr 需要书写的Led的位置0-7
4 /// @param enable 是否点亮 0灭 1亮
5 void Led_Disp(unsigned char addr, unsigned char enable)
6 {
7 1 static unsigned char temp = 0x00;
8 1 static unsigned char temp_old = 0xff;
9 1 // 指定位置点亮
10 1 if (enable)
11 1 temp |= 0x01 << addr;
12 1 else
13 1 temp &= ~(0x01 << addr);
14 1 if (temp != temp_old)
15 1 {
16 2 P0 = ~temp;
17 2 P2 = P2 & 0x1f | 0x80;
18 2 P2 &= 0x1f;
19 2 temp_old = temp;
20 2 }
21 1 }
22 /// @brief 蜂鸣器
23 /// @param enable 0 关 1 开
24 void Beep(bit enable)
25 {
26 1 static unsigned char temp = 0x00;
27 1 static unsigned char temp_old = 0xff;
28 1 if (enable)
29 1 temp |= 0x40;
30 1 else
31 1 temp &= ~(0x40);
32 1 if (temp != temp_old)
33 1 {
34 2 P0 = temp;
35 2 P2 = P2 & 0x1f | 0xa0;
36 2 P2 &= 0x1f;
37 2 temp_old = temp;
38 2 }
39 1 }
40 /// @brief 继电器
41 /// @param enable 0 关 1 开
42 void Relay(bit enable)
43 {
44 1 static unsigned char temp = 0x00;
45 1 static unsigned char temp_old = 0xff;
46 1 if (enable)
47 1 temp |= 0x10;
48 1 else
49 1 temp &= ~(0x10);
50 1 if (temp != temp_old)
51 1 {
52 2 P0 = temp;
53 2 P2 = P2 & 0x1f | 0xa0;
54 2 P2 &= 0x1f;
C51 COMPILER V9.59.0.0 LED 05/02/2024 15:57:34 PAGE 2
55 2 temp_old = temp;
56 2 }
57 1 }
58 /// @brief 引脚输出方波的高还是低电平
59 /// @param enable 0 关 1 开
60 void MOTOR(bit enable)
61 {
62 1 static unsigned char temp = 0x00;
63 1 static unsigned char temp_old = 0xff;
64 1 if (enable)
65 1 temp |= 0x20;
66 1 else
67 1 temp &= ~(0x20);
68 1 if (temp != temp_old)
69 1 {
70 2 P0 = temp;
71 2 P2 = P2 & 0x1f | 0xa0;
72 2 P2 &= 0x1f;
73 2 temp_old = temp;
74 2 }
75 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 163 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 8 ----
IDATA SIZE = ---- ----
BIT SIZE = ---- 3
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)