?? rs232.lst
字號:
C51 COMPILER V7.07 RS232 06/15/2006 18:53:54 PAGE 1
C51 COMPILER V7.07, COMPILATION OF MODULE RS232
OBJECT MODULE PLACED IN .\Output\RS232.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE RS232.c BROWSE DEBUG OBJECTEXTEND PRINT(.\LST\RS232.lst) TABS(3) OBJECT(.\O
-utput\RS232.obj)
stmt level source
1 #include <at89x52.H> // SFR definition header file
2 #include <stdio.h> // prototype declarations for I/O functions
3 #include "SystemEvent.h"
4 #include "UART.h"
5 #include <intrins.h>
6 #include "ExtVar.h"
7 #include "function.h"
8 #include "RTOS.h"
9 /*------------------------------------------------
10 PCON Bit Values
11 ------------------------------------------------*/
12 #define IDL_ 0x01
13
14 #define STOP_ 0x02
15 #define PD_ 0x02 /* Alternate definition */
16
17 #define GF0_ 0x04
18 #define GF1_ 0x08
19 #define SMOD_ 0x80
20
21 void InitSERIALPort(void){
22 1 ET1 = 0;
23 1 TI=0;
24 1 _Sync=0;
25 1 _LghOfCommand=0;
26 1 // SCON : SM0 | SM1 | SM2 | REN |TB8 | RB8 | TI | RI
27 1 PCON|=SMOD_;
28 1 SCON&=0xf0;
29 1 SCON=0x51; //01010000B
30 1 TMOD&=0x0f;
31 1 TMOD|=0x20; // MOV TMOD,#00100000B
32 1 TH1=0xfd; // MOV TH1,#FDH
33 1 TCON&=0x3f;
34 1 TCON|=0xc0; // MOV TCON,#01000000B
35 1 ES=1;
36 1 EA = 1; // global interrupt enable
37 1 // SBUF=0x55;
38 1 }
39
40 void StartTriI2C(void){
41 1 TI=0;
42 1 SBUF=*(_PtrI2c+_IndxOfI2C);
43 1 _IndxOfI2C++;
44 1 }
45
46 void LatchI2CHandler(unsigned char _LengthX,unsigned char _SyncX){
47 1 _IndxOfI2C=0;
48 1 _AdrxOfI2C=_AdrX;
49 1 _LengthOfI2C=_LengthX ;
50 1 _Sync=_SyncX;
51 1 }
52
53 void CheckBreak(unsigned char _SyncX){
54 1 if(_Indx>=(_Length-1)){
C51 COMPILER V7.07 RS232 06/15/2006 18:53:54 PAGE 2
55 2 _Sync=_SyncX; _LghOfCommand=0;
56 2 }
57 1 _Indx++;
58 1 }
59
60 void SerialPort (void) interrupt 4 using 3 {
61 1 unsigned char _ix;
62 1 _Busy=1;
63 1 switch(_Sync){
64 2 case _REC_COMMAND:
65 2 RI=0;
66 2 _CommandBufX[_LghOfCommand]=SBUF;
67 2 if((_LghOfCommand==0)) {
68 3 if((_CommandBufX[_LghOfCommand]&0xf0)==0xc0)
69 3 _LghOfCommand++;
70 3 }
71 2 else {
72 3 if(_LghOfCommand==3){
73 4 P2^=0x80; // os_send_signal (_HDMIFuncX);
74 4 _AdrX=(unsigned int)_CommandBufX[_ADDRH];
75 4 _AdrX<<=8;
76 4 _AdrX+=(unsigned int)_CommandBufX[_ADDRL];
77 4 _CommandBufX[_LENGTH]-=3;
78 4 _Length=(unsigned int)_CommandBufX[_LENGTH]&0x00ff;
79 4 _Indx=0;
80 4 switch(_CommandBufX[_COMMAND]){
81 5 case _RDI2C:
82 5 LatchI2CHandler(_Length,_TRI_ECHO_I2C_TO_HOST);
-
83 5 _FuncX|=_ReadI2CMode;
84 5 // isr_send_signal(_Init);
85 5 break;
86 5 case _WRI2C:
87 5 LatchI2CHandler(_Length,_REC_I2C_DATA_FROM_HOST);
88 5 break;
89 5 case _CommandFromHostX:
90 5 LatchI2CHandler(_Length,_REC_CommandX_FROM_HOST);
91 5 break;
92 5 }
93 4 }
94 3 _LghOfCommand++;
95 3 }
96 2 break;
97 2 case _REC_CommandX_FROM_HOST:
98 2 *(_PtrI2c+_IndxOfI2C)=SBUF;
99 2 RI=0;
100 2 _IndxOfI2C++;
101 2 if((_IndxOfI2C>=0x08)||(_Indx>=(_Length-1))){
102 3 for(_ix=0;_ix<8;_ix++){
103 4 *(_WPtrI2c+_ix)=*(_PtrI2c+_ix);
104 4 }
105 3 _IndxOfI2C=0;
106 3 _FuncX|=_CommandX;
107 3 // isr_send_signal(_Init);
108 3 }
109 2 CheckBreak(_REC_COMMAND);
110 2 break;
111 2 case _REC_I2C_DATA_FROM_HOST:
112 2 *(_WPtrI2c+_IndxOfI2C)=SBUF;
113 2 RI=0;
114 2 _IndxOfI2C++;
115 2 if((_IndxOfI2C>=_Length)||(_Indx>=(_Length-1))){
C51 COMPILER V7.07 RS232 06/15/2006 18:53:54 PAGE 3
116 3 _IndxOfI2C=0;
117 3 _FuncX|=_WriteI2CMode;
118 3 // isr_send_signal(_Init);
119 3 }
120 2 CheckBreak(_REC_COMMAND);
121 2 break;
122 2 case _TRI_ECHO_I2C_TO_HOST:
123 2 TI=0;
124 2 if(_IndxOfI2C<_LengthOfI2C){
125 3 SBUF=*(_PtrI2c+_IndxOfI2C);
126 3 _IndxOfI2C++;
127 3 }
128 2 else {
129 3 _IndxOfI2C=0;
130 3 _Busy=0;
131 3 }
132 2 CheckBreak(_TRI_OVER);
133 2 break;
134 2 case _TRI_OVER:
135 2 TI=0;
136 2 _Sync=_REC_COMMAND;
137 2 break;
138 2 }
139 1 }
140
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 470 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
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 + -