📄 main.lst
字号:
C51 COMPILER V6.12 MAIN 12/15/2006 21:57:31 PAGE 1
C51 COMPILER V6.12, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\main.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE .\main.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #include<AT89x51.h>
2
3
4 int i,j,rate,direction1,direction2;
5 unsigned int s1,s2;
6 //unsigned int v1[20]={2800,2820,2840,2860,2880,2900,2920,2940,2980,3000,3020,3040,3060,3080,3100,3120,314
-0,3160,3180,3200};
7 //unsigned int v3[20]={2000,2100,2200,2300,2400,2500,2600,2700,2800,2900,2900,3000,3100,3200,3300,3400,350
-0,3600,3700,3800};
8 //unsigned int v2[20]={2900,2910,2920,2930,2940,2950,2960,2970,2980,2990,3000,3010,3020,3030,3040,3050,306
-0,3070,3080,3090};
9 unsigned int v1[20]={900,1000,1125,1250,1375,1500,1625,1750,1875,2000,1875,1750,1625,1500,1375,1250,1125,1
-000,950,900};
10 unsigned int v2[20]={1450,1455,1460,1465,1470,1475,1480,1485,1490,1495,1500,1505,1510,1515,1520,3025,1530,
-1535,1540,1545};
11 //unsigned int v1[20]={90,100,112,125,137,150,162,175,187,200,187,175,162,150,137,125,112,100,95,90};
12
13
14 void timer0(void) interrupt 1 using 2{
15 1
16 1 // if(j>=20) {i=0;}
17 1 if(s1>2500) {
18 2 TH0=255-(s1/256);
19 2 TL0=255-(s1%256);
20 2 P1_7=0;
21 2 i++;
22 2 s1=v1[i];
23 2 }//if
24 1 else if(500<s1<2500){
25 2 TH0=255-(s1/256);
26 2 TL0=255-(s1%256);
27 2 P1_7=1;
28 2 s1=20000-s1;
29 2 }//else if
30 1 else ;
31 1 }
32
33
34 void initial(void){
35 1 i=j=0;
36 1 rate=1;
37 1 s1=v1[i];
38 1 s2=v2[j];
39 1 direction1=0;
40 1 direction2=0;
41 1 P3_7=1;
42 1 P3_4=1;
43 1
44 1 }
45 /****************************************************************************
46 角度的大小按公式计算:90*(angle-3000)/(1000-3000) +:顺时针; -:逆时针;
47 *****************************************************************************/
48 void main(){
49 1 initial();
50 1 TMOD=0x11;
C51 COMPILER V6.12 MAIN 12/15/2006 21:57:31 PAGE 2
51 1 TH0=255;
52 1 TL0=240;
53 1 TH1=255;
54 1 TL1=230;
55 1 ET0=PT0=1;
56 1 ET1=PT1=1;
57 1 EA=1;
58 1 TR0=1;
59 1 TR1=1;
60 1 while(1){
61 2 if(P3_6==1){
62 3 if(P3_5==1) rate=1;//11
63 3 else if(P3_5==0) rate=2;//10
64 3 }
65 2 else if(P3_6==0){
66 3 if(P3_5==1) rate=3;//01
67 3 else if(P3_5==0) rate=4;//00
68 3 }
69 2 }
70 1
71 1 }
72
73
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 263 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 94 ----
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 + -