📄 light1.lst
字号:
C51 COMPILER V7.01 LIGHT1 05/09/2009 14:20:41 PAGE 1
C51 COMPILER V7.01, COMPILATION OF MODULE LIGHT1
OBJECT MODULE PLACED IN light1.OBJ
COMPILER INVOKED BY: D:\programs and files\keil\C51\BIN\C51.EXE light1.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #include <stdio.h>
2 #include <stdlib.h>
3
4 #include <Fx2.h>
5 #include <Fx2regs.h>
6
7 unsigned char flag;
8 unsigned char count_20;
9 unsigned char i, j ;//i is the index of DSP7LED
10 //j is the count of interrupt
11 unsigned char digbit;//BITTAB[digbit]
12
13 main()
14 {
15 1 OEA = 0xff;//sets the input/output direction
16 1 OEB = 0xff;
17 1
18 1 IOA = 0xff;//set the initial number
19 1 IOB = 0xff;
20 1
21 1 TMOD = 0x11;//use two timers
22 1
23 1 //set initial 50ms
24 1 TL0 = 0xB0;
25 1 TH0 = 0x3C;
26 1
27 1 //1ms
28 1 TL1=0x18;
29 1 TH1=0xFC;
30 1
31 1 EA = 1;//interrupt enable
32 1
33 1 ET0 = 1;// timer0 enable
34 1 ET1 = 1;
35 1
36 1 TR0 = 1;//begin timer0
37 1 TR1 = 1;
38 1
39 1
40 1 while(1);//loop
41 1 }
42
43
44
45 void timer0(void) interrupt 1 using 0{
46 1 TL0=0xB0;
47 1 TH0=0x3C;
48 1
49 1
50 1 if(count_20<19){
51 2 count_20++;
52 2 flag=0;
53 2 }else{
54 2 count_20 = 0;
55 2 flag = 1;
C51 COMPILER V7.01 LIGHT1 05/09/2009 14:20:41 PAGE 2
56 2 }
57 1 if(flag){
58 2 if (j<7) j++;
59 2 else j=0;
60 2 }
61 1 }
62
63
64
65
66
67 void ledcontrol(void) interrupt 3 using 1
68 {
69 1
70 1 unsigned char temp_DSP7LED[16];//add dp to the number
71 1 unsigned char DSP7LED[16] = {0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f}; //ten numbers 0
--9
72 1 unsigned char BITTAB[8]={0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xFE};//8 LED enable
73 1
74 1
75 1
76 1
77 1 // TH0 = (time/256);//put in the time again;
78 1 // TL0 = (time%256);
79 1
80 1 TL1=0x18; //USED FOR AD SAMPLING
81 1 TH1=0xFC;
82 1
83 1
84 1
85 1 // if (j<7) j++;//每中断一次J就加1 显示就变一次
86 1 // else j=0;
87 1
88 1 // do{
89 1 switch(digbit+1)
90 1 {
91 2 case 1 : i = j%10; break;
92 2 case 2 : i = (j+1)%10; break;
93 2 case 3 : i = (j+2)%10; break;
94 2 case 4 : i = (j+3)%10; break;
95 2 case 5 : i = (j+4)%10; break;
96 2 case 6 : i = (j+5)%10; break;
97 2 case 7 : i = (j+6)%10; break;
98 2 case 8 : i = (j+7)%10; break;
99 2 default:;
100 2 }
101 1 //以下的是新加的小数点显示
102 1 if(digbit==j)
103 1 temp_DSP7LED[i] = 0x80 + DSP7LED[i];//dsp7led + 1000 0000
104 1 else
105 1 temp_DSP7LED[i] = DSP7LED[i];
106 1 //小数点操作结束
107 1
108 1 IOA = temp_DSP7LED[i];
109 1 IOB = BITTAB[digbit];
110 1
111 1 if(digbit<7)
112 1 digbit = digbit+1;
113 1 else
114 1 digbit = 0;//扫描显示
115 1
116 1
C51 COMPILER V7.01 LIGHT1 05/09/2009 14:20:41 PAGE 3
117 1 // }while(1);
118 1
119 1
120 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 316 ----
CONSTANT SIZE = 24 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 5 40
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -