📄 communicate.lst
字号:
C51 COMPILER V7.50 COMMUNICATE 05/17/2007 23:04:26 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE COMMUNICATE
OBJECT MODULE PLACED IN communicate.OBJ
COMPILER INVOKED BY: C:\Program Files\keil\C51\BIN\C51.EXE communicate.c BROWSE DEBUG OBJECTEXTEND
line level source
1 /*********************************************
2 file communicate.c
3 by sixiangzhe
4 copyright 2007/5/14-2007/5/15
5 note:
6 please run init_UART() first;
7
8 **************************************************/
9 #include <REG51F.H>
10 #include<communicate.h>
11 unsigned char command[8],commandready,framehead,revtemp,bytetoget,comnext,togetsure;
12 #define RESETCOM (0x00)
13 #define SURECOM (0xff)
14
15 void Init_UART (void)
16 {
17 1 T2CON = 0x34; /* Use Timer 2 For Baudrate */
18 1 RCAP2H = 0xFF;
19 1 RCAP2L = 0xdc; /* 9600 Baud @ 11.0592MHz */
20 1 SCON = 0x50; /* Enable UART */
21 1 TI = 0;
22 1 ES=1;
23 1 RI =0; /* TI: set TI to send first char of UART */
24 1 EA = 1; /* Enable Global Interrupts */
25 1 }
26
27
28 void intUART() interrupt 4
29 {
30 1 unsigned char i;
31 1
32 1 ES=0;
33 1 if(RI)
34 1 {
35 2 RI=0;
36 2 revtemp=SBUF;
37 2 /////////////////////////////////////////////////////////////
38 2 if(revtemp==RESETCOM)
39 2 {
40 3 framehead=0;
41 3 bytetoget=0;
42 3 comnext=0;
43 3 togetsure=0;
44 3
45 3
46 3 }
47 2 else
48 2 {
49 3 if(togetsure)
50 3 {
51 4 if(revtemp==SURECOM)
52 4 {
53 5 commandready=1;
54 5 bytetoget=0;
55 5 togetsure=0;
C51 COMPILER V7.50 COMMUNICATE 05/17/2007 23:04:26 PAGE 2
56 5 }
57 4 }
58 3 else
59 3 {
60 4 if(bytetoget==0) //this is framehead;
61 4 {
62 5 framehead=revtemp;
63 5 bytetoget=(revtemp>>4);
64 5 comnext=0;
65 5
66 5 }
67 4 else
68 4 {
69 5 bytetoget--;
70 5 command[comnext]=revtemp;
71 5 comnext++;
72 5 if(bytetoget==0)//get all command
73 5 {
74 6
75 6 TI=0;
76 6
77 6 SBUF=framehead;
78 6 for(i=0;i<comnext;i++)
79 6 {
80 7 while(!TI);
81 7 TI=0;
82 7 SBUF=command[i];
83 7 }
84 6 framehead=0;
85 6 bytetoget=0;
86 6 comnext=0;
87 6 togetsure=1;
88 6 }
89 5
90 5 }
91 4 }
92 3 }
93 2 ////////////////////////////////////////////////////////////////////////////
94 2
95 2 }
96 1 if(TI)
97 1 {
98 2 TI=0;
99 2
100 2 }
101 1 ES=1;
102 1
103 1 }
104
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 163 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 14 ----
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 + -