📄 led6show.lst
字号:
C51 COMPILER V8.05a LED6SHOW 08/07/2007 14:58:56 PAGE 1
C51 COMPILER V8.05a, COMPILATION OF MODULE LED6SHOW
OBJECT MODULE PLACED IN LED6Show.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE sources\LED6Show.c BROWSE INCDIR(.\include) DEBUG OBJECTEXTEND PRINT(.\LED6
-Show.lst) OBJECT(LED6Show.obj)
line level source
1 //*************************************************************************************************
2 //*************************************************************************************************
3 //**<程序名>:LED动态扫描子函数。 **
4 //**<功能>: unsigned char * pucLedNum(unsigned long ulNumber); **
5 //** 计算一个在000000到999999之间的数的每位数字并存储在数组中.并返回数组的首地址 **
6 //** void vShowOneNum(unsigned char ucOneNum,unsigned char ucOrder); **
7 //** 输入一个数字以及所要显示的位置,在LED相应位置上显示相应数字. **
8 //*************************************************************************************************
9 //*************************************************************************************************
10
11
12 //*************************************************************************************************
13 //* *
14 //* ******************************头文件及宏定义************************** *
15 //* *
16 //*************************************************************************************************
17 #include "LED6Show.h"
18
19
20
21 //*************************************************************************************************
22 //* *
23 //* ********************************全局变量****************************** *
24 //* *
25 //*************************************************************************************************
26 unsigned char code uca_LEDCode[]=
27 {0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0xFF};
28 //0,1,2,3,4,5,6,7,8,9,空白。
29
30 unsigned char code uca_LEDSelect[]=
31 {0x01,0x02,0x04,0x08,0x10,0x20};
32 //分别点亮第6,5,4,3,2,1号灯。
33
34 unsigned char uca_LedNum[6];
35 //存放数字的各个位。
36
37 unsigned char uc_NumberFront=1; //只是数字的首位。
38
39 extern unsigned char uca_ShowCustom[]; //在自定义模式下,LCD实时显示该字符。main.c
40
41
42 //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<自定义报告显示字符>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
43 unsigned char uca_ReportChar1[]={0xBF,0x86,0xC0,0x88,0xBF,0xF9};
44 //被除数等于0。 -EOR-1
45
46 unsigned char uca_ReportChar2[]={0xBF,0x86,0xC0,0x88,0xBF,0xA4};
47 //被减数小于减数。 -EOR-2
48
49 unsigned char uca_ReportChar3[]={0xC6,0x89,0x88,0xC2,0xBF,0xF9};
50 //表明从计算器模式切换到计时模式。 CHAG-1
51
52 unsigned char uca_ReportChar4[]={0xC6,0x89,0x88,0xC2,0xBF,0xC0};
53 //表明从计时器模式切换到计算器模式。 CHAG-0
54
C51 COMPILER V8.05a LED6SHOW 08/07/2007 14:58:56 PAGE 2
55 unsigned char uca_ReportChar5[]={0xBF,0x8C,0x88,0xC1,0x92,0x86};
56 //暂停 -PAUSE
57
58 //unsigned char uca_ReportChar6[]={0xBF,0x92,0x87,0x88,0x88,0x87};
59 //开始 -START
60
61 unsigned char uca_ReportChar7[]={0xBF,0x92,0x87,0xC0,0x8C,0xBF};
62 //停止 -StoP-
63
64
65 unsigned char uca_ReportChar8[]={0xC0,0x8C,0x8C,0xC0,0x92,0x86};
66 //切换到倒计时模式 OPPPOSE
67
68 unsigned char uca_ReportChar9[]={0xBF,0x86,0xC0,0x88,0xBF,0x90};
69 //超出可显示的最大值。 -EOR-9
70
71
72 //*************************************************************************************************
73 //* *
74 //* ********************************函数实现****************************** *
75 //* *
76 //*************************************************************************************************
77 unsigned char * pucLedNum(unsigned long ulNumber) //将一个数的各个位分别存到数组里。
78 { //并返回首地址。
79 1 if(ulNumber>999999)
80 1 ulNumber=999999;
81 1 if(ulNumber<0)
82 1 ulNumber=0;
83 1 uca_LedNum[5] = ulNumber/100000; //最高位存在数组【5】中。
84 1
85 1 uca_LedNum[4] = (ulNumber-100000*(long)uca_LedNum[5])/10000;
86 1
87 1 uca_LedNum[3] = (ulNumber-100000*(long)uca_LedNum[5]-10000*(long)uca_LedNum[4])/1000;
88 1
89 1 uca_LedNum[2] = (ulNumber-100000*(long)uca_LedNum[5]-10000*(long)uca_LedNum[4]
90 1 -1000*(long)uca_LedNum[3])/100;
91 1
92 1 uca_LedNum[1] = (ulNumber-100000*(long)uca_LedNum[5]-10000*(long)uca_LedNum[4]
93 1 -1000*(long)uca_LedNum[3]-100*(long)uca_LedNum[2])/10;
94 1
95 1 uca_LedNum[0] = (ulNumber-100000*(long)uca_LedNum[5]-10000*(long)uca_LedNum[4]
96 1 -1000*(long)uca_LedNum[3]-100*(long)uca_LedNum[2]-10*(long)uca_LedNum[1]);
97 1
98 1 //最低位存在数组【0】中。
99 1
100 1 for(uc_NumberFront=1;uc_NumberFront<6;uc_NumberFront++)
101 1 {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -