📄 userspc3.lst
字号:
C51 COMPILER V7.50 USERSPC3 10/24/2007 09:35:20 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE USERSPC3
OBJECT MODULE PLACED IN USERSPC3.OBJ
COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE USERSPC3.C LARGE OPTIMIZE(SIZE) BROWSE DEBUG OBJECTEXTEND
line level source
1 /*
2 +------------------------------------------------------------------------+
3 | Project: D P S 2 w i t h S P C 3 |
4 | |
5 | File: DPS2SPC3.C |
6 | Date: 27-Sep-2007 |
7 | Version: V 1.17 |
8 | Initial Editor: Thomas Lang Final Editor: Wujiang Zhang |
9 +------------------------------------------------------------------------+
10 | Description: |
11 | This module contains the main routine and some supporting |
12 | routines. |
13 | |
14 | In this example the input and output bytes are transfered to the |
15 | IO area, which is addressed by the io_byte_ptr. |
16 | In the case of the IM183-1 there is RAM. |
17 | The first byte of the input data is used as a service byte |
18 | for the change diag function. |
19 | The received user parameter data were copied to an interim buffer |
20 | and from this to the user diagnosis data. |
21 +------------------------------------------------------------------------+
22 | following environments are supported |
23 | Processor: SAB C165 |
24 | Compiler: BSO Tasking 80166 C Cross-Compiler, V 4.0 |
25 | Processor: iNTEL 8032 |
26 | Compiler: Keil |
27 | |
28 | |
29 +------------------------------------------------------------------------+
30 | Copyright (C) SIEMENS AG, 1994 |
31 | All Rights reserved |
32 +------------------------------------------------------------------------+
33 | History: |
34 | V0.9,SX,24-Oct-1995, Pilot verion |
35 | V1.0,SX,02-Nov-1995, 1st version |
36 | V1.1,SX,09-Nov-1995, Delete RAM from 0x16H, not from 16d |
37 | no initialization of the interrupt 1 level/egde |
38 | V1.2,SX,05-Aug-1996, changes for Keil-C51 V5 |
39 | V1.2,SX,09-Aug-1996, IM182 support added |
40 | V1.3,MM,25-Mar-1997, IM182 support extracted |
41 | |
42 +------------------------------------------------------------------------+
43 | Technical support: Siemens Schnittstellencenter |
44 | AUT7 WKF B1 TDL2 |
45 | |
46 | Schmidt Xaver Mittelberger Martin |
47 | Tel.: 0911/750-2079 Tel.: 0911/750-2072 |
48 | |
49 | Fax.: -2100 |
50 | Mailbox: 0911/737972 |
51 | |
52 +------------------------------------------------------------------------+
53 */
54
55 #define SPC3_INTEL_MODE TRUE
C51 COMPILER V7.50 USERSPC3 10/24/2007 09:35:20 PAGE 2
56 #define SPC3_FAR
57
58 #define SPC3_DPS2
59 #define SPC3_DATA_XDATA
60
61
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 #define SPC3_RESET_SET 1 /* reset-polarity */
77 #define SPC3_INTERRUPT_ENABLE EX0 /* external interrupt of SPC3 */
78 #define I_ENABLE 1 /* enable interrupt */
79 #define SPC3_INTERRUPT_PRIOR PX0 /* ext Interrupt SPC3 polarity */
80 #define P_HIGH 1 /* ext Interrupt SPC3 prio high */
81 #define GLOBAL_INTERRUPT_ENABLE EA /* global interrupt */
82
83 #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
95
96
97 /*----------------------------------------------------------------------*/
98 /* STRUCTURES AND TYPEDEFS */
99 /*----------------------------------------------------------------------*/
100
101 /* This is an example for a structure of a diagnosis with user data */
102 struct diag_data_blk
103 {
104 UBYTE stationstatus_1;
105 UBYTE stationstatus_2;
106 UBYTE stationstatus_3;
107 UBYTE master_add;
108 UBYTE ident_high;
109 UBYTE ident_low;
110
111 /*------------------ extern diag data -----------------*/
112 UBYTE header;
113 UBYTE ext_diag_0;
114 UBYTE ext_diag_1;
115 UBYTE ext_diag_2;
116 UBYTE ext_diag_3;
117 UBYTE ext_diag_4;
C51 COMPILER V7.50 USERSPC3 10/24/2007 09:35:20 PAGE 3
118 UBYTE ext_diag_5;
119 UBYTE ext_diag_6;
120 UBYTE ext_diag_7;
121 UBYTE ext_diag_8;
122 UBYTE ext_diag_9;
123 UBYTE ext_diag_10;
124 UBYTE ext_diag_11;
125 UBYTE ext_diag_12;
126 UBYTE ext_diag_13;
127 UBYTE ext_diag_14;
128 UBYTE ext_diag_15;
129 UBYTE ext_diag_16;
130 UBYTE ext_diag_17;
131 };
132
133 enum ERRORCODES {IO_LENGTH_ERROR,INIT_ERROR,UNUSED};
134
135 /*----------------------------------------------------------------------*/
136 /* EXTERNAL FUNCTIONS */
137 /*----------------------------------------------------------------------*/
138
139 /*----------------------------------------------------------------------*/
140 /* INTERNAL FUNCTIONS */
141 /*----------------------------------------------------------------------*/
142 void main (void);
143 void user_dps_reset (void);
144 void build_diag_data_blk (struct diag_data_blk*);
145 void user_error_function (enum ERRORCODES);
146 /*----------------------------------------------------------------------*/
147 /* LITERALS */
148 /*----------------------------------------------------------------------*/
149
150 #define TSDRMIN 11
151
152 #define OWN_ADDRESS 3
153 #define IDENT_HIGH 0x00
154 #define IDENT_LOW 0x08
155
156
157 #define DPS2_DISI() IEN = 0
158 #define DPS2_ENI() IEN = 1
159
160 #define CFG_LEN 2
161 #define CONFIG_DATA_INP 0x13
162 #define CONFIG_DATA_OUTP 0x23
163
164
165 /*----------------------------------------------------------------------*/
166 /* MACROS */
167 /*----------------------------------------------------------------------*/
168
169 /*----------------------------------------------------------------------*/
170 /* GLOBAL VARIABLES */
171 /*----------------------------------------------------------------------*/
172
173 #pragma global
174
175 UBYTE real_no_add_chg;
176 UBYTE this_station;
177 UBYTE cfg_akt [20];
178 UBYTE cfg_len_akt;
179 DPS2_IO_DATA_LEN SPC3_PTR_ATTR *user_io_data_len_ptr;
C51 COMPILER V7.50 USERSPC3 10/24/2007 09:35:20 PAGE 4
180 #pragma public
181
182 struct diag_data_blk *diag_ptr;
183 DPS2_BUFINIT dps2_buf;
184
185 UBYTE SPC3_PTR_ATTR *user_output_buffer_ptr;
186
187 UBYTE SPC3_PTR_ATTR *user_input_buffer_ptr;
188 UBYTE SPC3_PTR_ATTR *real_config_data_ptr;
189 void SPC3_PTR_ATTR *user_diag_buffer_ptr;
190
191 UBYTE ident_numb_high;
192 UBYTE ident_numb_low;
193 UBYTE dps_chg_diag_srvc_byte_new;
194 UBYTE dps_chg_diag_srvc_byte_old;
195 UBYTE diag_service_code;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -