西门子串行接口模块使用入门 - 范文中心

西门子串行接口模块使用入门

08/29

s

SIMATIC

Serial Interface Module ET 200S 1SI

Sample program for the USS protocol

Edition 08/2005

A5E00508747-01

Safety Guidelines

This manual contains notices you have to observe in order to ensure your personal safety, as well as to prevent damage to property. The notices referring to your personal safety are highlighted in the manual by a safety alert symbol, notices referring to property damage only have no safety alert symbol. The notices shown below are graded according to the degree of danger.

Danger

indicates that death or severe personal injury will result if proper precautions are not taken.

indicates that death or severe personal injury may result if proper precautions are not taken.

Warning Caution

with a safety alert symbol indicates that minor personal injury can result if proper precautions are not taken.

Caution

without a safety alert symbol indicates that property damage can result if proper precautions are not taken.

Attention

indicates that an unintended result or situation can occur if the corresponding notice is not taken into account.

If more than one degree of danger is present, the warning notice representing the highest degree of danger will be used. A notice warning of injury to persons with a safety alert symbol may also include a warning relating to property damage.

Qualified Personnel

The device/system may only be set up and used in conjunction with this documentation. Commissioning and operation of a device/system may only be performed by qualified personnel. Within the context of the safety notices in this documentation qualified persons are defined as persons who are authorized to commission, ground and label devices, systems and circuits in accordance with established safety practices and standards.

Prescribed Usage

Note the following:

Warning

This device and its components may only be used for the applications described in the catalog or the technical description, and only in connection with devices or components from other manufacturers which have been approved or recommended by Siemens.

Correct, reliable operation of the product requires proper transport, storage, positioning and assembly as well as careful operation and maintenance.

Trademarks

All names identified by are registered trademarks of the Siemens AG.

The remaining trademarks in this publication may be trademarks whose use by third parties for their own purposes could violate the rights of the owner.

Disclaimer of Liability

We have reviewed the contents of this publication to ensure consistency with the hardware and software described. Since variance cannot be precluded entirely, we cannot guarantee full consistency. However, the information in this publication is reviewed regularly and any necessary corrections are included in subsequent editions.

Siemens AG

Automation and Drives Postfach 4848

90437 NÜRNBERG GERMANY

Copyright Siemens AG 2005 A5E00508747-01

Siemens AG 2005

Technical data subject to change.

Contents

1 2

Description ..................................................................................................................... 1-1 Prerequisites .................................................................................................................. 2-1 2.1 2.1.1 2.1.2 2.1.3 3 4 5

Installation of the ET 200S 1SI USS sample program..................................... 2-2 Installation of the sample program...................................................................2-2 Integration of the sample program....................................................................2-2 Adjusting the sample program to suit your HW configuration..........................2-3

Description of the program...........................................................................................3-1 Broadcast........................................................................................................................ 4-1 Control of the ET 200S FCs via Variable Tables.........................................................5-1 5.1 5.1.1 5.2 5.2.1 5.3 5.3.1 5.4 5.5 5.6

Variable table - "USS_Control".........................................................................5-1 Content of the "USS_Control" variable table....................................................5-3 Variable table - "NetData".................................................................................5-3 Content of the "NetData" variable table............................................................5-5 Variable table - "Communication_Crtl".............................................................5-6 Content of the "Communication_Ctrl" variable table........................................5-7 Variable table - "Control"..................................................................................5-8 Variable table - "Parameter".............................................................................5-9 Variable table - "DB10".....................................................................................5-9

Serial Interface Module ET 200S 1SI - sample program for the USS protocol A5E00508747-01

iii

Contents

iv

Serial Interface Module ET 200S 1SI - sample program for the USS protocol

A5E00508747-01

1 Description

This manual uses a sample program to explain the control of an ET 200S 1SI

module via the FC17, FC18 and FC19 function blocks of the ET 200S 1SI module. Further information regarding the USS protocol can be found in the manual: SIMATIC, Serial Interface Module ET 200S 1SI, A5E00124881-04.

Serial Interface Module ET 200S 1SI - sample program for the USS protocol A5E00508747-01

1-1

1-2

Description

Serial Interface Module ET 200S 1SI - sample program for the USS protocol

A5E00508747-01

2 Prerequisites

The following hardware components are required for the operation of the ET 200S 1SI module in the example:

• SIMATIC S7-300 or SIMATIC S7-400 with integrated Profibus DP interface. Alternatively, you can also use an ET 200S IM151-7 CPU. • ET 200S system with the IM151 interface module (unnecessary if an ET 200S IM151-7 CPU is used) with a PM-E DC24V power module and a 6ES7 193-4CC20-0AA0 terminal module. • ET 200S 1SI module 6ES7 138-4DF11-0AB0 USS Master and

6ES7 193-4CB20-0AA0 terminal module as well as the 6ES7 193-4JA00-0AA0 bus termination (part of the IM151). • Siemens Micromaster 420 drive control with motor (or MM3, MM4,

SINAMICS G110 USS or a suitable purchased part that supports the USS Slave protocol)

The following software prerequisites must be satisfied:

• STEP 7 Version 5.2 or higher, Service Pack 1 or higher plus the Hardware Support Package (HSP_58). The download is made from the HW Config in STEP 7 directly. The correct link is preset there. • The sample program for the ET 200S 1SI module and the function blocks are available at the following Internet address:

The ET 200S 1SI module must already be set up for operation in order to run the sample program. The parameter assignment of the ET 200S 1SI module is discussed in connection with the sample program below.

Serial Interface Module ET 200S 1SI - sample program for the USS protocol A5E00508747-01

2-1

2.1

2.1.1

Installation of the ET 200S 1SI USS sample program

Installation of the sample program

• The sample program is installed on your PC during the setup of the ET 200S 1SI module.

2.1.2 Integration of the sample program

• In the SIMATIC Manager select File > Open Project > Sample projects to open the sample project "zXX21_12_1SI_USS" and then copy all of the blocks in the "Blocks" folder to the corresponding "Blocks" folder of your project. • Change the hardware configuration to suit the hardware that you are using or

have available.

2-2

Serial Interface Module ET 200S 1SI - sample program for the USS protocol

A5E00508747-01

2.1.3 Adjusting the sample program to suit your HW configuration

• Open the HW Config for your program and double-click on the ET 200S 1SI

module. In the dialog box click on the "Parameter" tab.

• Set the interface parameters (interface type, Baud rate, stop bits and parity) to suit those of your USS Slave device. Click on "OK" and close the "Properties – 1SI USS Master" dialog box. • Save and compile your HW Config project (click on the icon in the toolbar)

Serial Interface Module ET 200S 1SI - sample program for the USS protocol A5E00508747-01

2-3

• Open the HW Config for your program and read the starting address of the ET 200S 1SI module. In this sample it is 256.

• Enter this address in your program in the first line in OB100.

2-4

Serial Interface Module ET 200S 1SI - sample program for the USS protocol

A5E00508747-01

Prerequisites

• Save the OB100 and download all of the blocks to the CPU.

Serial Interface Module ET 200S 1SI - sample program for the USS protocol

A5E00508747-01 2-5

2-6 Prerequisites Serial Interface Module ET 200S 1SI - sample program for the USS protocol

A5E00508747-01

3 Description of the program

Further information can be found in the manual: SIMATIC, Serial Interface Module

ET 200S 1SI, A5E00124881-04.

OB100:

• In OB100, the FC19 (S_USSI) is called. This FC creates and initializes all of the

data blocks (network data DB (DB100), parameter assignment DB (DB50) and

communications processor DB (DB10)) that are required for the operation of the

ET 200S 1SI USS Master module. These DBs are not included with the sample

program. They are generated by the CPU directly.

• Furthermore, this FC performs all of the other initializations necessary for the

operation of the USS.

OB1:

• The OB1 cyclically calls the USS_Processing (FC20).

FC20:

• Processes the USS send and receive data.

- Send: The FC17 (S_USST) handles the transmission of the network data

(PZD and any PKW data) to the slaves in accordance with the network

data structure used. The FC17 handles all of the actions required by the

USS Master send protocol. The transmission of the network data to the

slave is initiated with FB3 (S_SEND).

Receive: The FC18 (S_USSR) handles the receipt of the network data

(PZD and any PKW data) from the slaves in accordance with the network

data structure used. The FC18 handles all of the actions required by the

USS Master receive protocol. The transfer of the network data from the

slave is initiated with FB2 (S_RCV). -

Notes regarding the DBs 10, 50 and 100

The DBs DB10 (communications processor DB), DB50 (parameter DB) and DB100

(network data DB) are created by the CPU directly during start-up (STOP/RUN

transition of the CPU) by a call made by FC19 in OB100. They are therefore not

normally a part of the sample project. These DBs were copied into the sample

project from the CPU (ONLINE) afterwards.

Serial Interface Module ET 200S 1SI - sample program for the USS protocol

A5E00508747-01 3-1

3-2 Description of the program Serial Interface Module ET 200S 1SI - sample program for the USS protocol

A5E00508747-01

4 Broadcast

In broadcast mode, the USS Master sends a frame to all of the slaves on the bus.

In this case the "Broadcast Bit" in the address byte is set to a logical "1" (Bit5 in the

address byte of the US frame) in the request frame.

The use of the broadcast frame requires additional definitions on the application

level (joint frame length and allocation of user data to user numbers etc.).

Once these prerequisites are satisfied and before calling FB S_SEND, overwrite

the slave address with

// ------------------------

// SEND with Instance-DB

// ------------------------

L B#16#20 // set bit5 -> broadcast-addr

T DB10.DBB 13 // Transfer to send addr in // the communication DB

CALL "S_SEND", "IDB_S_SEND"

until the request has been completed or the S_SEND has returned a DONE.

Note

For USS slaves, the broadcast mechanism is NOT MANDATORY. Check the

manual for the particular USS slave that you are using to determine whether it

supports broadcast mode. While doing so, pay particular attention to the joint

frame length and the assignment of user data etc.

Serial Interface Module ET 200S 1SI - sample program for the USS protocol

A5E00508747-01 4-1

4-2 Broadcast Serial Interface Module ET 200S 1SI - sample program for the USS protocol

A5E00508747-01

5 Control of the ET 200S FCs via Variable

Tables

When you copied the blocks of the sample program, you also copied six variable

tables. A summary of all of the data relevant for the sample can be found in the

variable table "USS_Control". With the aid of this variable table, you can learn

about the control of the ET 200S 1SI module via the FCs 17, 18 and 19 as well as

FB 2 and FB 3. After gaining experience with these, you should be able to integrate

these FCs and FBs into your user program and to use them to control the

ET 200S 1SI module.

5.1 Variable table - "USS_Control"

In this variable table, the control signals of the ET 200S 1SI are supplied by FC17

via the network data DB, DB100, and the status signals of the ET 200S 1SI are

displayed by FC18. The communications DB, DB10, supplies information regarding

the state of the communications.

Serial Interface Module ET 200S 1SI - sample program for the USS protocol

A5E00508747-01 5-1

The variable table "USS_Control" has the following structure:

5-2 Serial Interface Module ET 200S 1SI - sample program for the USS protocol

A5E00508747-01

5.1.1 Content of the "USS_Control" variable table

Motor control:

• MW22 is used to start and stop the motor. If it is set to the hexadecimal value

W#16#047F, the motor will be started. If it is set to the hexadecimal value

W#16#047E, the motor will be stopped.

• MW24 is used to specify the nominal frequency. If it set to the hexadecimal

value W#16#4000, the motor will turn at 100 % of the reference frequency. If it

set to the hexadecimal value W#16#2000, the motor will turn at 50 % of the

reference frequency.

PKW request:

• Using the flag words 30, 32, 34 and 36, you can define a PKW request. The

user program enters the values into the current PKW request area in the

network data DB (DB100). FB S_USST transfers the PKW data to the

associated PKW send area in DB100 and initiates the transfer in the

communication processor DB (DB10). The thus prepared transmit data is sent

to the slave by FB S_SEND via the ET 200S 1SI module

-

-

-

- PKE: The type of request and parameter-ID (e.g. 0x1438 to query the minimum frequency (P1080) ) from the slave (Micromaster) IND: Index PWE1: Parameter value 1 PWE2: Parameter value 2

Communication state:

• The flags DB10.DBX0.0 – DB10.DBX1.0 provide information regarding the

current communication state. These flags show send and receive requests and

any communication errors. DB10.DBW 6 shows the duration of the last cycle

and DB20.DBW 8 shows the length of the send telegram/frame.

Send/Rcv state:

• Display possible error messages

-

-

- MB50 – FC 19: S_USSI MW52 – FB3: S_SEND state and MW56 – FB2: S_RCV state

5.2 Variable table - "NetData"

The transmission of data as well as reactions or answers from the USS_Slave can

be examined in the variable table "NetData ". Here you find the current PKW

requests as well as the send and receive buffers for the PKW/PZD data:

Serial Interface Module ET 200S 1SI - sample program for the USS protocol

A5E00508747-01 5-3

5-4

Serial Interface Module ET 200S 1SI - sample program for the USS protocol

A5E00508747-01

5.2.1 Content of the "NetData" variable table

Current PKW request:

• The user program enters a PKW request with the corresponding request

identification (parameter read/write) as well as the parameter-ID (e.g. P1080)

and parameter values (PWE1/PWE2).

Transmit buffer:

• PKW area: an outstanding PKW request is copied from the "current PKW

request" to this area by S_USST and then sent with the next send telegram.

• PZD area: In this area, you find the process data to be sent

Receive buffer:

• PKW area: The FB S_USSR transfers the data sent back by the slave - in

response to a PKW request - into this area.

• PZD area: FB S_USSR puts the data sent back by the slave - in response to a

PZD request - in this area.

Further information regarding the structure of the network data DB, slave-related

communication data, buffers for the current PKW request as well as the structure

of the send and receive buffers can be found in the manual: SIMATIC, Serial

Interface Module ET 200S 1SI, A5E00124881-04, Chapter 3.8.7.

Serial Interface Module ET 200S 1SI - sample program for the USS protocol

A5E00508747-01 5-5

5.3 Variable table - "Communication_Crtl"

This variable table can be considered a continuation of the previous variable table

"USS_Control". The difference between this and the former is that this table

presents a more detailed view of the state of the communication together with the

most important control signals. For information regarding the additional control

signals, please see the ET 200S 1SI manual, Chapter 3.8.9 Communications

Processor DB.

5-6 Serial Interface Module ET 200S 1SI - sample program for the USS protocol

A5E00508747-01

5.3.1 Content of the "Communication_Ctrl" variable table

Send receive states:

• The flags DB10.DBX0.0 – DB10.DBX1.0 provide information regarding the

current communication state. These flags show send and receive starts and any

communication errors. DB10.DBW 6 shows the duration of the last cycle and

DB20.DBW 8 shows the length of the send telegram.

Request state:

• In this section, you will find information regarding the state of the request such

as e.g. the maximum number of cycles while waiting to receive.

Further information regarding the communications processor DB and the meaning

or use of the communication state DBW0 can be found in the manual: SIMATIC,

Serial Interface Module ET 200S 1SI, A5E00124881-04, Chapter 3.8.9.

Serial Interface Module ET 200S 1SI - sample program for the USS protocol

A5E00508747-01 5-7

5.4 Variable table - "Control"

This variable table contains communication control flags, the communication

control word and the communication status word from the network data DB

(DB100). These flags signal the current status of the USS transmission and are

stored in the network data DB (DB100).

Status words can be used to precisely monitor the communication, while the

control word allows you to precisely control the beginning of a parameter

assignment request.

Further information regarding the network data DB and the meaning and use of the

status and control words can be found in the manual: SIMATIC, Serial Interface

Module ET 200S 1SI, A5E00124881-04, Chapter 3.8.7.

5-8 Serial Interface Module ET 200S 1SI - sample program for the USS protocol

A5E00508747-01

5.5 Variable table - "Parameter"

The parameter DB DB50 is generated by FC19 at every new start-up (STOP/RUN

transition of the CPU) and is stored in the CPU - overwriting the prior values. In this

DB, the system parameters as well as the communication parameter are set for

each USS slave that is connected.

Further information regarding the structure of the parameter DB, the system

parameters and the parameter assignment of the slaves can be found in the

manual: SIMATIC, Serial Interface Module ET 200S 1SI, A5E00124881-04,

Chapter 3.8.8.

5.6 Variable table - "DB10"

The variable table "DB10" is used to monitor the data traffic between the CPU and

the serial interface module ET 200S Modbus/USS. Further information can be

found in the variable table or the manual: SIMATIC, Serial Interface Module

ET 200S 1SI, A5E00124881-04.

Serial Interface Module ET 200S 1SI - sample program for the USS protocol

A5E00508747-01 5-9

5-10 Control of the ET 200S FCs via Variable Tables Serial Interface Module ET 200S 1SI - sample program for the USS protocol

A5E00508747-01


相关内容

  • 单片机实用技术
    单片机实用技术 作者:shenxq301 1 首先介绍经济使用的单片机AVR 使用学习板快速入门,尤其实用于在校学生和刚刚工作的工程技术人员. AVR mega16学习板 单价:240 元 该学习板可以从正规途径买到正版,当然也可从旧货市场 ...
  • 蓝宙电子智能创新实验室
    智能创新实验室建设方案 芜湖蓝宙电子科技有限公司 -飞思卡尔大学计划官方合作伙伴 版 本:Version 2.0 所 有 者:蓝宙电子 日 期:2014.03.12 目录 一. 二. 实验室介绍 . .................... ...
  • 蔬菜大棚温湿度控制系统设计
    **************************************************** 本科毕业设计 题 目 蔬菜大棚温湿度 姓 名 ******* 专 业 电子科学与技术 学 号 ******** 指导教师 ****** ...
  • 常见英语缩写
    [转] 常见英文缩写 常用英文缩写 VIP = very important person重要人物 IMP (import)进口 EXP (export)出口 MAX (maximum)最大的.的最大限度的 MIN (minimum)最小的 ...
  • 汽车总线系统通信协议分析与比较
    河南机电高等专科学校 <汽车单片机与局域网技术> 大作业 专业班级: 姓 名: 学 号: 成 绩: 指导老师: 2013年4月16日 汽车总线系统通信协议分析与比较 摘要:本文主要针对汽车总线系统通讯协议,探讨汽车总线通讯协议的 ...
  • 自动化专业英语翻译
    B 计算机与网络基础 计算机系统的组成 在说明了什么是计算机之后,让我们在来看一下计算机的定义:计算机是一种能接收.存储和处理数据,并能产生输出结果的快速.精确的符号加工系统,这一系统是在存储指令程序控制下工作的.本文说明为什么计算机是一个 ...
  • 交流电量同步采集
    河南机电高等专科学校 毕业设计(论文) 交流电量同步采集 系 部: 自动控制系 专 业: 电气自动化 班 级: xxxxx xx 姓 名: xxxx xxx xx 学 号: xxx xxx xx x 指导老师: xxx 二零一二年五月 第一 ...
  • 微机原理考试整理
    1.8086从功能上分成了EU 和BIU 两部分.这样设计的优点是什么? 答:传统计算机在执行程序时,CPU 总是相继地完成取指令和执行指令的动作, 即,指令的提取和执行是串行进行的.而8086CPU 在功能上分成了EU 和BIU 两 部分 ...
  • 遥控窗帘电路的设计-毕业设计
    遥控窗帘电路的设计 学生:XX 指导教师:XX 内容摘要:本文主要介绍了遥控窗帘的电路设计.电机工作的时候是否有鸣响提示,以及光控状态下环境亮度的控制参数的调整等等都可以通过遥控器随着电子技术和自动化技术的发展,人们对生活质量的要求越来越高 ...