📄 armuart.lst
字号:
C51 COMPILER V7.06 ARMUART 08/22/2004 21:22:03 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE ARMUART
OBJECT MODULE PLACED IN ArmUart.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ArmUart.c LARGE OPTIMIZE(7,SIZE) MODA2 DEBUG OBJECTEXTEND
stmt level source
1 //---------------------------------------------------------------------------
2 // Project Title : Armature (Resistance) tester for stator.
3 // Project No. :
4 // Project Ver. : 1.00
5 // File Name : ArmUart.c
6 // Revision : 1.00
7 // Initial Date : 22-Nov,2002
8 // Modify Date : 27-DEC,2003
9 // Description :
10 //---------------------------------------------------------------------------
11 #include <..\atmel\at89s53.h>
12 #include <absacc.h>
13 #include "dom12a.h"
14
15 #define UART_SEND 1
16 #define UART_RECEIVE 0
17
18 #define UART_TEST 0x80
19 #define UART_CONFIG_SLOT 0x81
20 #define UART_CONFIG_PGAIN 0x82
21 #define UART_ROOM_TEMP 0x83
22 #define UART_R180_TEST 0x84
23 #define UART_RCOIL_TEST 0x85
24 #define UART_LCOIL_TEST 0x86
25 #define UART_RESET_TEST 0X87 // test end then reset relay
26 #define UART_EEPR_LSB 0x90
27 #define UART_EEPR_MSB 0x91
28 #define UART_EEPROM_R 0x92
29 #define UART_EEPROM_W 0x93
30 //---------------------------------------------------------------------------
31 #define BAUD96_MSB 0x0ff
32 #define BAUD96_LSB 0x0b2
33 #define BAUD192_MSB 0x0ff
34 #define BAUD192_LSB 0x0d9
35 #define BAUD288_MSB 0x0ff
36 #define BAUD288_LSB 0x0e6
37 #define BAUD576_MSB 0x0ff
38 #define BAUD576_LSB 0x0f3
39
40 //---------------------------------------------------------------------------
41 sbit RS485_WR = P1^0;
42 sbit RS485_RD = P1^1;
43 sbit MPU_CS = P1^2;
44
45 //extern func.
46
47 //------
48 uUART_protocol uart;
49 uUART_protocol uartIn;
50 bit uartReply;
51 //uchar *data ptrSBuf;
52 //uchar *data ptrSBufIn;
53 uchar data uartCNT;
54 uchar data idxrxbuf = 0;
55 uchar data idxtxbuf = 0;
C51 COMPILER V7.06 ARMUART 08/22/2004 21:22:03 PAGE 2
56
57 // Fuctions prototype
58 void _uart_initial (void);
59 char _uart_command (unsigned char cmdcode);
60 char _uart_reply (void);
61 void Disable_Uart(void);
62
63 //---------------------------------------------------------------------------
64 void _uart_initial (void)
65 {
66 1 TH2 = RCAP2H = BAUD96_MSB;
67 1 TL2 = RCAP2L = BAUD96_LSB;
68 1 SCON = 0x50; // SM0=0,SM1=1,SM2=0,REN=1,TB8=0,TR8=0,TI=0,RI=0;
69 1 T2CON = 0x30; // set time2
70 1 TR2 = 1; // turn on timer2
71 1 ES = REN = 1; // enable serial
72 1 RS485_WR = 0;
73 1 RS485_RD = 1;
74 1 uartReply = FALSE;
75 1
76 1 //ptrSBuf = uart.sbuf;
77 1 } // end func.
78
79 //---------------------------------------------------------------------------
80 char _uart_command (unsigned char cmdcode)
81 {
82 1 TI = RI = 0;
83 1 MPU_CS = SBIT_LOW;
84 1 uartReply = FALSE;
85 1 REN = FALSE;
86 1 ES = TRUE;
87 1 SBUF = cmdcode;
88 1
89 1 idxrxbuf = 0;
90 1 idxtxbuf = 1;
91 1
92 1 //ptrSBuf = &uart.sbuf[1];
93 1 //ptrSBufIn = &uartIn.sbuf[0];
94 1 uartCNT = 9;
95 1 return TRUE;
96 1 } // end func.
97
98 //---------------------------------------------------------------------------
99 char _uart_reply (void)
100 {
101 1 return (uartReply);
102 1 } // end func.
103
104 //***************************************************************
105 void Disable_Uart(void)
106 {
107 1 ES = REN = 0;
108 1 MPU_CS = SBIT_HIGH;
109 1 } // end func.
110
111 //---------------------------------------------------------------------------
112 // Serial port RX or TX (vector 4) Interrupt handler.
113 //---------------------------------------------------------------------------
114 void serialport (void) interrupt 4 using 3
115 { // multiple bytes r/tx
116 1 register uchar cx;
117 1
C51 COMPILER V7.06 ARMUART 08/22/2004 21:22:03 PAGE 3
118 1 if ( TI ) {
119 2 TI = 0; // Clear flag
120 2 if (uartCNT--) {
121 3 cx = uart.sbuf[idxtxbuf++];
122 3 SBUF = cx;
123 3 } else {
124 3 REN = 1;
125 3 uartCNT = 10; //FINALIZED ver should be 10
126 3 idxrxbuf = 0;
127 3 } // end else
128 2 } // end if
129 1
130 1 if ( RI ) {
131 2 RI = 0;
132 2 cx = SBUF;
133 2 uartIn.sbuf[idxrxbuf++] = cx;
134 2 //*ptrSBufIn++ = cx;
135 2 if ( !--uartCNT) {
136 3 uartReply = TRUE;
137 3 ES = REN = 0;
138 3 MPU_CS = SBIT_HIGH;
139 3 } // END IF
140 2 } // end if
141 1 } // end isr
142
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 144 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 3 ----
IDATA SIZE = 22 ----
BIT SIZE = 1 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -