📄 yizhan.lst
字号:
C51 COMPILER V7.06 YIZHAN 02/07/2007 14:02:59 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE YIZHAN
OBJECT MODULE PLACED IN yizhan.OBJ
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE yizhan.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #include <reg51.h>
2 #include <absacc.h>
3 #include <stdio.h>
4 unsigned char TLV=0x00;
5 unsigned char THV=0xe7;
6 unsigned short SECTICKS=240; //24; //65536/(65536-(THV*256+TLV))*18;
7 unsigned short HALFSECTICKS=120; //12;
8 unsigned short Q1SECTICKS=60; //12;
9 unsigned short Q3SECTICKS=180; //12;
10 unsigned char sbuff[7];
11 unsigned char count=0,triggle=0,chno=0;
12 unsigned char ticks=0,oldP1Stat;
13 sbit RLed = P1^3;
14 sbit GLed = P1^2;
15 bit direction=0,direction1=0,direction2=0;
16 /*void delay()
17 {
18 unsigned short i,j;
19 for(i=0;i<30;i++) j=i;
20 }*/
21 void t0int() interrupt 1
22 {
23 1 //unsigned char i;
24 1 TH0=THV; //Bcause TLV=0,no need to init TL0;
25 1 count++;
26 1 if ((oldP1Stat&0x10)==0x10 && (P1&0x10)==0x00) //UP triggle.
27 1 {
28 2 if ((P1&0x20)==0x20) direction1=1;
29 2 else direction1=0;
30 2 }
31 1 if ((oldP1Stat&0x20)==0x20 && (P1&0x20)==0x00) //UP triggle.
32 1 {
33 2 if ((P1&0x10)==0x10) direction2=1;
34 2 else direction2=0;
35 2 }
36 1 if(direction1 && !direction2) direction=1;
37 1 if(!direction1 && direction2) direction=0;
38 1 if((oldP1Stat^P1) & 0x10) ticks++;
39 1 if((oldP1Stat^P1) & 0x20) ticks++;
40 1 oldP1Stat=P1;
41 1 /*
42 1 if(count == Q1SECTICKS)
43 1 {
44 1 RLed=1;
45 1 sbuff[3]=P1;
46 1 //Notice P1 had been modified.
47 1 if (direction) sbuff[3]=sbuff[3] | 0x20;
48 1 else sbuff[3]=(sbuff[3] & 0xDF);
49 1 triggle=1;
50 1 }
51 1 */
52 1 if(count == HALFSECTICKS)
53 1 {
54 2 RLed=0;
55 2 GLed=1;
C51 COMPILER V7.06 YIZHAN 02/07/2007 14:02:59 PAGE 2
56 2 sbuff[3]=P1;
57 2 //Notice P1 had been modified.
58 2 if (direction) sbuff[3]=sbuff[3] | 0x20;
59 2 else sbuff[3]=(sbuff[3] & 0xDF);
60 2 triggle=1;
61 2 }
62 1 /*
63 1 if(count == Q3SECTICKS)
64 1 {
65 1 RLed=1;
66 1 sbuff[3]=P1;
67 1 //Notice P1 had been modified.
68 1 if (direction) sbuff[3]=sbuff[3] | 0x20;
69 1 else sbuff[3]=(sbuff[3] & 0xDF);
70 1 triggle=1;
71 1 }
72 1 */
73 1 if(count == SECTICKS)
74 1 {
75 2 count=0;
76 2 RLed=0;
77 2 GLed=0;
78 2 sbuff[3]=P1;
79 2 //Notice P1 had been modified.
80 2 if (direction) sbuff[3]=sbuff[3] | 0x20;
81 2 else sbuff[3]=(sbuff[3] & 0xDF);
82 2 sbuff[4]=ticks;
83 2 ticks=0;
84 2 triggle=1;
85 2 }
86 1 }
87 void main (void)
88 {
89 1 unsigned char i;
90 1 sbuff[0]=0xD7;
91 1 sbuff[1]=6;
92 1 sbuff[2]='S';
93 1 sbuff[5]=0;
94 1 sbuff[6]='E';
95 1 SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */
96 1 TMOD |= 0x21; /* TMOD: timer 1, mode 2, 8-bit reload */
97 1 TH1 = 0xd8; //1200bps .0xfb; // 9600 bps,0xd8; /* TH1: reload value for 1200 baud @ 18.432MHz
- */
98 1 TR1 = 1; /* TR1: timer 1 run */
99 1 TR0 = 1;
100 1 TI = 1;
101 1 oldP1Stat=P1;
102 1 IE = 0x82;
103 1 while (1)
104 1 {
105 2 if (triggle)
106 2 {
107 3 triggle=0;
108 3 for(i=0;i<7;i++) putchar(sbuff[i]);
109 3 RLed=1;
110 3 }
111 2 }
112 1 }
113
MODULE INFORMATION: STATIC OVERLAYABLE
C51 COMPILER V7.06 YIZHAN 02/07/2007 14:02:59 PAGE 3
CODE SIZE = 244 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 22 1
IDATA SIZE = ---- ----
BIT SIZE = 3 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -