?? uart.lst
字號:
C51 COMPILER V6.02 UART 08/26/2003 15:05:01 PAGE 1
C51 COMPILER V6.02, COMPILATION OF MODULE UART
OBJECT MODULE PLACED IN D:\LCD_6963\LCD2\UART.OBJ
COMPILER INVOKED BY: C:\COMP51\C51.EXE D:\LCD_6963\LCD2\UART.C DB SB OE
stmt level source
1 #include <reg51.h>
2 #define uchar unsigned char
3 #define uint unsigned int
4 int idata buf[30]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
5 uchar idata buf_point=0;
6 uchar pf;
7 uchar over=0;
8 uchar rec=0;
9 int ch;
10 uchar rec_over=0;
11 int Keybefore;
12 extern void dispes(uchar position1,uchar position2,uchar chanum,uchar* p);
13 extern CLEAR();
14 extern uchar code menu_str[97][30];
15 extern void msec(uint x);
16 extern uchar dispint(uchar,uchar,int);
17 extern uchar dispint_f(uchar position1,uchar position2,int value);
18 extern void dispf(uchar position1,uchar position2,float value,uchar preci);
19 extern void dispf_f(uchar position1,uchar position2,float value,uchar preci);
20 extern KeyState;
21 extern KeyFuncIndex;
22 extern head;
23
24 void Uart_init(void)
25 {
26 1 TMOD=0x20;
27 1 PCON=0x00;
28 1 SCON=0x50;
29 1 TH1=0x0f4;
30 1 TL1=0x0f4;
31 1 TR1=1;
32 1 ES=1;
33 1 EA=1;
34 1 }
35
36 /*void send(uchar idata *d,uchar length)
37 { uchar i;
38 SBUF=0x61;
39 while(over==0);over=0;
40 pf=0;
41 pf=pf^0x61;
42 SBUF=length;
43 while(over==0);over=0;
44 pf=pf^length;
45 for(i=0;i<length;i++){
46 SBUF=d[i];
47 while(over==0);over=0;
48 pf^=d[i];
49 }
50 SBUF=pf;
51 while(over==0);over=0;
52 SBUF=0x6e;
53 while(over==0);over=0;
54 } */
55
C51 COMPILER V6.02 UART 08/26/2003 15:05:01 PAGE 2
56 void send(uchar idata d)
*** WARNING C258 IN LINE 56 OF D:\LCD_6963\LCD2\UART.C: 'd': mspace on parameter ignored
57 { uint i;
58 1 SBUF=d;
59 1 while(over==0);over=0;
60 1 for(i=0;i<100;i++){;}
61 1 }
62 void receive(void)interrupt 4 using 3
63 {
64 1 if(TI)
65 1 {
66 2 TI=0;
67 2 over=1;
68 2 }
69 1 else if(RI)
70 1 {
71 2 RI = 0;
72 2 ch=SBUF;
73 2 if(ch==head||rec)
74 2 { rec=1;
75 3 buf[buf_point++]=ch;
76 3 if(buf_point>=buf[1]+2)
77 3 {buf_point=0;
78 4 rec_over=1; };
79 3 };
80 2 /*此處驗證頭和校驗*/
81 2 if(rec_over==1)
82 2 { rec=0;
83 3 rec_over=0;
84 3 switch(buf[2])
85 3 {
86 4 case 1: KeyState=1; //receive normal display
87 4 KeyFuncIndex=3;
88 4 break;
89 4 case 2: KeyState=1; //receive fault. ack.
90 4 KeyFuncIndex=8;
91 4 break;
92 4 case 3: KeyState=1; //receive fault. acked.
93 4 KeyFuncIndex=10;
94 4 break;
95 4 case 10: KeyState=1; //receive history events
96 4 KeyFuncIndex=14;
97 4 break;
98 4 case 11: KeyState=1; //receive data/time setting
99 4 KeyFuncIndex=17;
100 4 break;
101 4 case 12: KeyState=1; //receive time modified
102 4 KeyFuncIndex=28;
103 4 break;
104 4 case 13: KeyState=1; //receive language
105 4 KeyFuncIndex=31;
106 4 break;
107 4 case 14: KeyState=1; //receive language modified
108 4 KeyFuncIndex=34;
109 4 break;
110 4 case 15: KeyState=1; //receive scale
111 4 KeyFuncIndex=37;
112 4 break;
113 4 case 16: KeyState=1; //receive scale modified
114 4 KeyFuncIndex=40;
115 4 break;
116 4 case 17: KeyState=1; //receive motor specification
C51 COMPILER V6.02 UART 08/26/2003 15:05:01 PAGE 3
117 4 KeyFuncIndex=62;
118 4 break;
119 4 case 18: KeyState=1; //receive motor specification modified
120 4 KeyFuncIndex=73;
121 4 break;
122 4 case 19: KeyState=1; //receive frequency setting
123 4 KeyFuncIndex=74;
124 4 break;
125 4 case 20: KeyState=1; //receive frequency setting modified
126 4 KeyFuncIndex=85;
127 4 break;
128 4 case 21: KeyState=1; //receive group in operation
129 4 KeyFuncIndex=86;
130 4 break;
131 4 case 22: KeyState=1; //receive group in operation modified
132 4 KeyFuncIndex=99;
133 4 break;
134 4 case 23: KeyState=1; //receive control mode
135 4 KeyFuncIndex=100;
136 4 break;
137 4 case 24: KeyState=1; //receive control mode modified
138 4 KeyFuncIndex=106;
139 4 break;
140 4 case 25: KeyState=1; //receive fwd/rev
141 4 KeyFuncIndex=107;
142 4 break;
143 4 case 26: KeyState=1; //receive fwd/rev modified
144 4 KeyFuncIndex=114;
145 4 break;
146 4 case 27: KeyState=1; //receive DC apply
147 4 KeyFuncIndex=115;
148 4 break;
149 4 case 28: KeyState=1; //receive DC apply modified
150 4 KeyFuncIndex=124;
151 4 break;
152 4 case 29: KeyState=1; //receive limit parameters
153 4 KeyFuncIndex=125;
154 4 break;
155 4 case 30: KeyState=1; //receive limit parameters modified
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -