📄 userspc3 0810.lst
字号:
C51 COMPILER V7.02b USERSPC3_0810 11/01/2004 20:51:05 PAGE 1
C51 COMPILER V7.02b, COMPILATION OF MODULE USERSPC3_0810
OBJECT MODULE PLACED IN userspc3 0810.OBJ
COMPILER INVOKED BY: D:\KEIL\C51\BIN\C51.EXE userspc3 0810.c LARGE ROM(COMPACT) BROWSE DEBUG OBJECTEXTEND
stmt level source
1 /*PROFIBUS-DP从站的参数化见PROFIBUS-DP.pdf 16
2
3 +------------------------------------------------------------------------+
4 | Project: D P S 2 w i t h S P C 3 |
5 | |
6 | File: USERSPC3.C |
7 | Date: 24-Mar-1997 |
8 | Version: V 1.30 |
9 | Initial Editor: Schmidt Xaver |
10 +------------------------------------------------------------------------+
11 | Description: |
12 | This module contains the main routine and some supporting |
13 | routines.( 包含主要的程序和一些支持程序) |
14 | |
15 | In this example the input and output bytes are transfered to the |
16 | IO area, which is addressed by the io_byte_ptr. |
17 | In the case of the IM183-1 there is RAM. |
18 | The first byte of the input data is used as a service byte |
19 | for the change diag function. |
20 |The received user parameter data were copied to an interim(过渡的)buffer |
21 | and from this to the user diagnosis data. |
22 |(接受到的用户参数先复制到过渡buf再由此得到用户诊断数据) |
23 +------------------------------------------------------------------------+
24 | following environments are supported |
25 | Processor: SAB C165 |
26 | Compiler: BSO Tasking 80166 C Cross-Compiler, V 4.0 |
27 | Processor: iNTEL 8032 |
28 | Compiler: Keil |
29 | |
30 | |
31 +------------------------------------------------------------------------+
32 | Copyright (C) SIEMENS AG, 1994 |
33 | All Rights reserved |
34 +------------------------------------------------------------------------+
35 | History: |
36 | V0.9,SX,24-Oct-1995, Pilot verion |
37 | V1.0,SX,02-Nov-1995, 1st version |
38 | V1.1,SX,09-Nov-1995, Delete RAM from 0x16H, not from 16d |
39 | no initialization of the interrupt 1 level/egde |
40 | V1.2,SX,05-Aug-1996, changes for Keil-C51 V5 |
41 | V1.2,SX,09-Aug-1996, IM182 support added |
42 | V1.3,MM,25-Mar-1997, IM182 support extracted |
43 | |
44 +------------------------------------------------------------------------+
45 | Technical support: Siemens Schnittstellencenter |
46 | AUT7 WKF B1 TDL2 |
47 | |
48 | Schmidt Xaver Mittelberger Martin |
49 | Tel.: 0911/750-2079 Tel.: 0911/750-2072 |
50 | |
51 | Fax.: -2100 |
52 | Mailbox: 0911/737972 |
53 | |
54 +------------------------------------------------------------------------+
55 */
C51 COMPILER V7.02b USERSPC3_0810 11/01/2004 20:51:05 PAGE 2
56 /*#define SPC3_INTEL_MODE TRUE*/
57
58 #define SPC3_FAR
59
60 #define SPC3_DPS2
61 #define SPC3_DATA_XDATA
62
63 #include "spc3dps2.h"
64
65 #if defined __C51__ /*$ 要定义么 */
66
67 #include <reg52.h>
68
69 #define huge
70 #define global
71 #define public
72
73 /* Defines for the IM183-1 */
74 sbit HW_WATCHDOG_TRIGGER = P1^0; /* trigger input of the HW-WD看门狗 */
75 sbit SPC3_RESET = P3^4; /* SPC3-reset-Pin */
76 sbit R_BUSY = P1^7; /* DPRAM busy线 $ */
77 #define SPC3_RESET_SET 1 /* reset-polarity 复位极性 */
78 #define SPC3_INTERRUPT_ENABLE EX0 /* SPC3 做为外部中断 */
79 #define I_ENABLE 1 /* enable interrupt */
80 #define SPC3_INTERRUPT_PRIOR PX0 /* ext Interrupt SPC3 polarity */
81 #define P_HIGH 1 /* ext Interrupt SPC3 prio high */
82 #define GLOBAL_INTERRUPT_ENABLE EA /* global interrupt */
83
84 #elif _C166
/* C166 */
#include "reg.h"
#pragma global
#pragma class hb=SPC3_CLASS
#pragma default_attributes
#pragma public
#pragma class hb=DIN_CLASS
#pragma default_attributes
#endif
96
97
98 /*----------------------------------------------------------------------*/
99 /* STRUCTURES AND TYPEDEFS(类型定义) */
100 /*----------------------------------------------------------------------*/
101
102 /* This is an example for a structure of a diagnosis 诊断 with user data */
103 struct diag_data_blk
104 {
105 UBYTE stationstatus_1;
106 /*如typedef unsigned char UBYTE*/
107 UBYTE stationstatus_2;
108 UBYTE stationstatus_3;
109 UBYTE master_add;
110 UBYTE ident_high;
111 UBYTE ident_low;
112
113 /*--------------------- extern diag data ----------------------*/
114 UBYTE header;
115 UBYTE ext_diag_0;
116 UBYTE ext_diag_1;
117 UBYTE ext_diag_2;
C51 COMPILER V7.02b USERSPC3_0810 11/01/2004 20:51:05 PAGE 3
118 UBYTE ext_diag_3;
119 UBYTE ext_diag_4;
120 UBYTE ext_diag_5;
121 UBYTE ext_diag_6;
122 UBYTE ext_diag_7;
123 UBYTE ext_diag_8;
124 UBYTE ext_diag_9;
125 UBYTE ext_diag_10;
126 UBYTE ext_diag_11;
127 UBYTE ext_diag_12;
128 UBYTE ext_diag_13;
129 UBYTE ext_diag_14;
130 UBYTE ext_diag_15;
131 UBYTE ext_diag_16;
132 UBYTE ext_diag_17;
133 };
134
135 enum ERRORCODES {IO_LENGTH_ERROR,INIT_ERROR,UNUSED};
136
137 /*----------------------------------------------------------------------*/
138 /* EXTERNAL FUNCTIONS */
139 /*----------------------------------------------------------------------*/
140
141 /*----------------------------------------------------------------------*/
142 /* INTERNAL FUNCTIONS */
143 /*----------------------------------------------------------------------*/
144 void main (void);
145
146 void user_dps_reset (void);
147 void build_diag_data_blk (struct diag_data_blk*);
148 void user_error_function (enum ERRORCODES);
149 /*----------------------------------------------------------------------*/
150 /* LITERALS */
151 /*----------------------------------------------------------------------*/
152
153 #define TSDRMIN 11
154
155 #define OWN_ADDRESS 2;/* $原为3*/
156 #define IDENT_HIGH 0x00
157 #define IDENT_LOW 0x08
158
159
160 #define DPS2_DISI() IEN = 0
161 #define DPS2_ENI() IEN = 1
162
163 #define CFG_LEN 2
164 #define CONFIG_DATA_INP 0x15
165 #define CONFIG_DATA_OUTP 0x25 /* $ */
166
167
168 /*----------------------------------------------------------------------*/
169 /* MACROS */
170 /*----------------------------------------------------------------------*/
171
172 /*----------------------------------------------------------------------*/
173 /* GLOBAL VARIABLES */
174 /*----------------------------------------------------------------------*/
175 #pragma global
176 /*UBYTE SPC3_PTR_ATTR *L_FLAG_R ; 输入(测控仪至IM183)在DPRAM标志字地址*/
177 UBYTE xdata *i_byte_ptr;
178 /*UBYTE xdata LR_flag ; 输入标志字*/
179
C51 COMPILER V7.02b USERSPC3_0810 11/01/2004 20:51:05 PAGE 4
180 /*UBYTE SPC3_PTR_ATTR *R_FLAG_L ; 输出(IM183至测控仪)在DPRAM标志字地址*/
181 UBYTE xdata *o_byte_ptr;
182 /*UBYTE xdata RL_flag ; 输出标志字*/
183 UBYTE xdata TEST_flag;// UBYTE xdata TEST_flag _at_ 0x2FFD;
184 UBYTE xdata RL_flag _at_ 0x2FFE;
185 UBYTE xdata LR_flag _at_ 0x2FFF;
186
187 UBYTE real_no_add_chg;
188 UBYTE this_station;
189 UBYTE cfg_akt [20]; /* cfg */
190 UBYTE cfg_len_akt;
191 DPS2_IO_DATA_LEN SPC3_PTR_ATTR *user_io_data_len_ptr;
192 #pragma public /*public伪指令列出了可以在其他目标模块使用的符号tp312s27m 341 */
193
194 struct diag_data_blk *diag_ptr;
195 DPS2_BUFINIT dps2_buf;/*--已定义structure for DPS2-Buffer-Initialization .H p4*/
196
197 UBYTE SPC3_PTR_ATTR *user_output_buffer_ptr;/* 见#define SPC3_PTR_ATTR xdata--*/
198 UBYTE SPC3_PTR_ATTR *user_input_buffer_ptr;
199 UBYTE SPC3_PTR_ATTR *real_config_data_ptr;
200 UBYTE SPC3_PTR_ATTR *user_diag_buffer_ptr;/*$*/
201
202 UBYTE ident_numb_high;
203 UBYTE ident_numb_low;
204 UBYTE dps_chg_diag_srvc_byte_new;
205 UBYTE dps_chg_diag_srvc_byte_old;
206 UBYTE diag_service_code;
207 UBYTE diag_len;
208 UWORD user_baud_value;
209 UBYTE user_diag_flag;
210 UBYTE *io_byte_ptr;
211 UBYTE i;
212 UBYTE zyk_wd_state;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -