?? 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 + -