27 Huong Dan Ket Noi Plc s7 300 Voi s7 300 Qua Profibus Cf2ba4e9d5
S7 Profibus connection example - Dimetix AG
Transcript of S7 Profibus connection example - Dimetix AG
Application Note
AN2005
D-Series
S7 Profibs connection example
V 1.04Please check www.dimetix.com
for the latest version
Aistract
This Application Notes describe the connection of the DIMS Profbus converter to a S7 PLC and a D-Series device. To get started more easily a S7 sample project is available for download on our web www.dimetix.com.
This Application Note is provided as is without any warranty for any problems this sample may cause.
File: AN2005 S7 Profbus connection example_V104.odt
Dimetix AG • Degersheimerstr. 14 • 9100 Herisau • Switzerland • Phone +41 71 353 00 00 • Fax +41 71 353 00 01 • [email protected] • www.dimetix.com
LASER DISTANCE SENSORSSWISS PRECISION
Taile of content1 Introduction ....................................................................................................................................................... 32 Structure ............................................................................................................................................................ 3
2.1 Multi-Sensor Mode...................................................................................................................................... 32.2 Connection of the Sensor with the DIMS.....................................................................................................3
3 Laser sensor confguration .................................................................................................................................. 43.1 Reset to factory default............................................................................................................................... 4
4 Projection (S7 confguration) ............................................................................................................................... 55 S7 Example project ............................................................................................................................................. 6
5.1 Description of the blocs............................................................................................................................... 65.2 Startup........................................................................................................................................................ 65.3 Code: OB1.................................................................................................................................................. 75.4 Tables of variables of the different functions................................................................................................85.5 Table of symbols......................................................................................................................................... 9
6 Listings ............................................................................................................................................................. 107 Overview of the marker words .......................................................................................................................... 16
7.1 Sensor detection manual........................................................................................................................... 167.2 Clear / Stop............................................................................................................................................... 167.3 Distance Measurement.............................................................................................................................. 167.4 Start Tracking with buffering..................................................................................................................... 167.5 Read Distance........................................................................................................................................... 16
D-Series S7 Profbus connection example Page 2/16
LASER DISTANCE SENSORSSWISS PRECISION
1 Introduction
1 IntrodbctionTo connect a laser sensor with a Siemens S7 PLC over the Profbus, the DIMS Profbus Interface (Par No. 500214)must be used. This Application Note describes how the laser sensor and the S7 PLC must be confgured, and howthe S7 example project is launched. The S7 example project is available for download on www.dimetix.com.
It is essential, that you have some experience in programming of a Siemens S7 PLC and knowledge of the Profbus.
2 StrbctbreThe following diagram 1 demonstrates the connection of the laser sensor, DIMS Profbus Interface and S7:
Fig. 1: Diagram overview
2.1 Mblti-Sensor ModeThe DIMS is operated in Multi Sensor Mode. Additional information about this operation mode can be found in the DIMS User Manual.
2.2 Connection of the Sensor with the DIMSThe following diagram 2 shows the connection of a laser sensor with the DIMS Profbus Interface by RS422interface.
D-Series S7 Profbus connection example Page 3/16
LASER DISTANCE SENSORS
S7 Profibs DP Master
Profibs
RS232/422
Laser sensor
Profibs DP
DIMS Profibs InterfacePart No. 500214
S7_PLC
Fig. 2: Connection of a laser sensor with DIMS Profius
Profibus5
6
4
7
X1
3
2
1
X2 32 41
Rx422-
Tx422+
Rx422+
Tx 422-
AP-GND
Tx232
Rx232
Tx
Debug
0V
Rx
Debug
UB
DIMSProfibus Interface
24V
0V
Screw term
inal (12 pin)
1
2
9
10
11
12
T+R-R+
T-
GNDV+
Laser sensorID 019200 Baud7 BitParity even1 Stop Bit
3 Laser sensor confguration
3 Laser sensor confibrationUse the D-Series laser sensor with factory settings to use it in Multi-Sensor mode. In case you have to set the D-Series laser sensor back to factory settings, reset the device as described below.
3.1 Reset to factory defabltTo reset the device to factory settings do the following:
• Switch off the power supply used for the device• Press the reset push button and keep it pressed• Switch on the power supply used for the device• Keep the reset push button pressed until all status LEDs (POWER,
ERROR, DO1, DO2) fash for a short time (about 0.5 seconds)• Release the reset push button• Switch off the power supply and wait 5 seconds• Switch on the power supply and wait until the green status LED
(POWER) is on• Reset procedure executed successfully
D-Series S7 Profbus connection example Page 4/16
LASER DISTANCE SENSORS
Fig. 3: Reset of a D-Series device
ID switch
Reset switch
4 Projection (S7 confguration)
4 Projection (S7 confibration)To project the DIMS Profbus Interface as DP-slave, the installation of the GSD – data fle is necessary. The GDS data fle is available for download on our web www.dimetix.com/en/service/download.
After the projection of the DIMS Profbus Interface, upload the appropriate module.
D-Series S7 Profbus connection example Page 5/16
LASER DISTANCE SENSORS
Slave address
5 S7 Example project
5 S7 Example projectThe project includes all the necessary blocs for the operation of a Dimetix laser sensor.
5.1 Description of the ilocsThe VAT-blocs are each the variable charts to their corresponding function.
OB1 "Main Program Sweep (Cycle)"
FC1 Function Clear/Stop VAT_Clear/Stop
FC2 Function Initialization VAT_Initailization
FC3 Function Read_Distance VAT_Read_Distance
FC4 Function Single_Measurement VAT_SingleMeasurement
FC5 Function Start_Tracking VAT_Start-Tracking
SFC14 System function „DPRD-DAT“
SFC15 System function „DPWR-DAT“
5.2 Startbp
1. Connect the S7 PLC, the DIMS Profbus Interface and the laser sensor to the communication cables and the appropriate electric power supply.
2. Set the address of the Profbus at the front side of the DIMS Profbus Interface. It has to correspond to the S7-project.
3. Load all the blocs onto the control.
4. The inputs E0.1, E0.2, E0.3, E0.4 and E0.5 enable you now to preselect the function you wish. Important! Preselect only one fbnction at a time!
A pulse at the input E0.0 activates the function. (see code OB1)
5. In the appropriate table of variables, all the data is visualized.
D-Series S7 Profbus connection example Page 6/16
LASER DISTANCE SENSORS
5 S7 Example project
5.3 Code: OB1
D-Series S7 Profbus connection example Page 7/16
LASER DISTANCE SENSORS
5 S7 Example project
5.4 Tailes of variailes of the different fbnctions
5.4.1 Taile of variailes of the fbnction „Initialization“
5.4.2 Taile of variailes of the fbnction „Clear/Stop“ Modify marker byte 136 according to your sensors ID (sensor number).
5.4.3 Taile of variailes of the fbnction „Sinile Measbrement“Enter the ID you wish (number of sensor) as the value of control into the marker byte 156.
5.4.4 Taile of variailes of the fbnction „Start Trackini“Enter the ID you wish (number of sensor) as the value of control into the marker byte 176.
Enter the tracking time in msec (milliseconds) as the value of control into the marker double word.
D-Series S7 Profbus connection example Page 8/16
LASER DISTANCE SENSORS
5 S7 Example project
5.4.5 Taile of variailes of the fbnction „Read Distance“Enter the ID you wish (number of sensor) as the value of control into the marker byte 196. This function can only be started, if „Start Tracking“ is active.
5.5 Taile of symiols
D-Series S7 Profbus connection example Page 9/16
LASER DISTANCE SENSORS
6 Listings
6 Listinis
D-Series S7 Profbus connection example Page 10/16
LASER DISTANCE SENSORS
6 Listings
D-Series S7 Profbus connection example Page 11/16
LASER DISTANCE SENSORS
6 Listings
D-Series S7 Profbus connection example Page 12/16
LASER DISTANCE SENSORS
6 Listings
D-Series S7 Profbus connection example Page 13/16
LASER DISTANCE SENSORS
6 Listings
D-Series S7 Profbus connection example Page 14/16
LASER DISTANCE SENSORS
6 Listings
D-Series S7 Profbus connection example Page 15/16
LASER DISTANCE SENSORS
7 Overview of the marker words
7 Overview of the marker wordsThe following is a list of the used marker words. The DIMS functions are described in the DIMS Manual, which can be found on www.dimetix.com.
7.1 Sensor detection manbalMaster -> DIMS
Toggle 'i' reserve
110 'c'DIMS -> Master
Toggle 'i' status info (int 32 bit) error number
'c'
7.2 Clear / StopMaster -> DIMS
Toggle 'c' ID reserve
'c'DIMS -> Master
Toggle 'c' status info (int 32 bit) error number
'c'
7.3 Distance MeasbrementMaster -> DIMS
Toggle 'g' ID reserve
'c'DIMS -> Master
Toggle 'g' distance (foat 32 bit) error number
'
7.4 Start Trackini with ibfferiniMaster -> DIMS
Toggle 'f' time in ms (int 32 bit) ID reserve
'c'DIMS -> Master
Toggle 'f' error number
'
7.5 Read DistanceMaster -> DIMS
Toggle 'q' ID reserve
'c'DIMS -> Master
Toggle '0' distance (foat 32 bit) error number
'
D-Series S7 Profbus connection example Page 16/16
LASER DISTANCE SENSORS
110 111 112 113 114 115 116 117
100 101 102 103 107
130 131 132 133 134 135 136 137
104 105 106
150 151 152 153 154 155
140 141 142 143 144 145 146
170 171 172 173 174 175 176 177
166165164163162161160
190 191 192 193 194 195 196 197
186185184183182181180
120 121 122 123 124 125 126
156 157
127
147
167
187