Anybus-CompactCom-2022-Anybus CompactCom Implementation Guide

Anybus-CompactCom-2022-Anybus CompactCom Implementation Guide
Tutorial
Anybus CompactCom Implementation
®
Doc.Id. HMSI-168-106
Rev. 1.01
Connecting DevicesTM
+$/067$'‡&+,&$*2‡.$5/658+(‡72.<2‡%(,-,1*‡0,/$12‡08/+286(‡&29(175<‡381(‡&23(1+$*(1
HMS Industrial Networks
Mailing address: Box 4126, 300 04 Halmstad, Sweden
Visiting address: Stationsgatan 37, Halmstad, Sweden
E-mail: [email protected]
Web: www.anybus.com
Important User Information
This document is intended to promote a good understanding of how to develop an application using Anybus CompactCom. The document describes functions and actions that are common to all products in the Anybus CompactCom family. For information regarding the specific Anybus CompactCom modules, consult the Anybus
CompactCom Network Interface Appendices.
Please note that the reader of this document is expected to be familiar with high level software design, and communication systems in general. The document describes a simple application using an Anybus CompactCom
module. For more advanced applications, please consult the Anybus CompactCom Software Design Guide and
the respective network interface appendices.
Liability
Every care has been taken in the preparation of this document. Please inform HMS Industrial Networks AB of any
inaccuracies or omissions. The data and illustrations found in this document are not binding. We, HMS Industrial
Networks AB, reserve the right to modify our products in line with our policy of continuous product development.
The information in this document is subject to change without notice and should not be considered as a commitment by HMS Industrial Networks AB. HMS Industrial Networks AB assumes no responsibility for any errors that
may appear in this document.
There are many applications of this product. Those responsible for the use of this device must ensure that all the
necessary steps have been taken to verify that the applications meet all performance and safety requirements including any applicable laws, regulations, codes, and standards.
HMS Industrial Networks AB will under no circumstances assume liability or responsibility for any problems that
may arise as a result from the use of undocumented features, timing, or functional side effects found outside the
documented scope of this product. The effects caused by any direct or indirect use of such aspects of the product
are undefined, and may include e.g. compatibility issues and stability issues.
The examples and illustrations in this document are included solely for illustrative purposes. Because of the many
variables and requirements associated with any particular implementation, HMS Industrial Networks AB cannot
assume responsibility for actual use based on these examples and illustrations.
Intellectual Property Rights
HMS Industrial Networks AB has intellectual property rights relating to technology embodied in the product described in this document. These intellectual property rights may include patents and pending patent applications
in the US and other countries.
Trademark Acknowledgements
Anybus ® is a registered trademark of HMS Industrial Networks AB. All other trademarks are the property of their
respective holders.
Warning:
This is a class A product. In a domestic environment this product may cause radio interference in
which case the user may be required to take adequate measures.
ESD Note: This product contains ESD (Electrostatic Discharge) sensitive parts that may be damaged if ESD
control procedures are not followed. Static control precautions are required when handling the product. Failure to observe this may cause damage to the product.
Anybus CompactCom Tutorial
Rev 1.01
Copyright© HMS Industrial Networks AB
Mar 2013 Doc Id HMSI-168-106
Table of Contents
Table of Contents
Preface
About This Document ..............................................................................1
Related Documents.................................................................................................................................. 1
Document History ................................................................................................................................... 1
Conventions & Terminology.................................................................................................................. 2
Definitions ....................................................................................................................................... 2
Sales and Support ..................................................................................................................................... 3
Chapter 1
How to use this Document ...................................................................... 4
Chapter 2
Introduction to the Anybus CompactCom .............................................. 5
Chapter 3
Tutorial..................................................................................................... 6
Introduction .............................................................................................................................................. 6
Connect the Anybus CompactCom Module........................................................................................ 7
Host Interface Signals ...................................................................................................................... 7
Set Operating Mode................................................................................................................................. 9
Telegrams ................................................................................................................................................ 10
Parallel Interface Mode ......................................................................................................................... 11
Initial Handshake ......................................................................................................................... 11
DPRAM ...................................................................................................................................... 12
Sending Telegrams - Parallel Communication ................................................................................. 14
Serial Interface Mode............................................................................................................................. 19
Initial Handshake ......................................................................................................................... 19
Serial Telegram Frame................................................................................................................... 20
Sending Telegrams - Serial Communication .................................................................................... 22
Setup continued...................................................................................................................................... 29
Anybus CompactCom State Machine............................................................................................. 29
Accessing the Anybus CompactCom............................................................................................... 30
Mapping ADIs ............................................................................................................................ 31
Setup Complete .............................................................................................................................. 33
Network Initialization............................................................................................................................ 34
Further Configuration and Certification............................................................................................. 35
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Chapter 4
Resources ................................................................................................36
Categorization of Functionality............................................................................................................ 36
Basic.............................................................................................................................................. 36
Extended....................................................................................................................................... 36
Advanced....................................................................................................................................... 36
Design Guides ........................................................................................................................................ 37
Anybus CompactCom Software Design Guide................................................................................ 37
Anybus CompactCom Hardware Design Guide............................................................................. 37
Network Interface Appendices ............................................................................................................ 37
Drivers ..................................................................................................................................................... 37
Starter Kit ................................................................................................................................................ 37
Drive Profiles.......................................................................................................................................... 38
Appendix A
Trace, DeviceNet ....................................................................................39
Appendix B
Trace, Profibus DP-V1 ............................................................................45
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Preface
P. About This Document
For more information, documentation etc., please visit the HMS website, www.anybus.com.
P.1 Related Documents
In the tutorial you will find references to these documents in the margins, showing the abbreviation of
the document name within a frame in the right margin. All documents are available at www.anybus.com.
Document
Anybus CompactCom Software Design Guide
Anybus CompactCom Hardware Design Guide
Anybus CompactCom Standard Driver Implementation Guide
Anybus CompactCom Lite Driver Implementation Guide
Anybus CompactCom Network Interface Appendices
Abbr.
SWDG
HWDG
SDRV
LDRV
“network” APP.
Doc. Id.
HMSI-168-97
HMSI-168-31
SCM-1200-043
SCM-1200-042
See www.anybus.com
Author
HMS
HMS
HMS
HMS
HMS
P.2 Document History
Summary of Recent Changes ( 1.00 ... 1.01)
Change
Corrected example
Updated support information
Added information on reference documents
Corrected information in table on how to connect unused pins
Page(s)
25
3
4
8
Revision List
Revision
1.00
1.01
Date
Author(s)
2010-04-19 KeL
2013-03-04 KeL
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Chapter(s) Description
First official release
P, 1, 3
Minor updates
Doc.Id. HMSI-168-106
About This Document 2
P.3 Conventions & Terminology
The following conventions are used throughout this manual:
•
Numbered lists provide sequential steps
•
Bulleted lists provide information, not procedural steps
•
The terms ‘Anybus’ or ‘module’ refers to the Anybus CompactCom module.
•
The terms ‘host’ or ‘host application’ refers to the device that hosts the Anybus module.
•
Hexadecimal values are normally written in the format NNNNh, where NNNN is the hexadecimal value. When a hexadecimal value is present in code or in pseudo code in an example, the
value is written in the format 0xnnnn, where nnnn is the hexadecimal value.
P.3.1 Definitions
Word
Process data
Acyclic data
ADI
ABCC
object model
object
instance
attribute
telegram
message
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Explanation
Fast cyclic network I/O data
Data that is updated on demand, e.g. application parameters
Application Data Instance. An ADI is an application variable that is accessible for the updating
of acyclic data or for the mapping of process data, exactly what is defined by the application.
Anybus CompactCom
See “Accessing the Anybus CompactCom” on page 30
See “Telegrams” on page 10
Doc.Id. HMSI-168-106
About This Document 3
P.4 Sales and Support
Sales
Support
HMS Sweden (Head Office)
E-mail:
[email protected]
E-mail:
[email protected]
Phone:
+46 (0) 35 - 17 29 56
Phone:
+46 (0) 35 - 17 29 20
Fax:
+46 (0) 35 - 17 29 09
Fax:
+46 (0) 35 - 17 29 09
Online:
www.anybus.com
Online:
www.anybus.com
E-mail:
[email protected]
E-mail:
[email protected]
Phone:
+1-312 - 829 - 0601
Phone:
+1-312-829-0601
Toll Free:
+1-888-8-Anybus
Toll Free:
+1-888-8-Anybus
Fax:
+1-312-629-2869
Fax:
+1-312-629-2869
Online:
www.anybus.com
Online:
www.anybus.com
E-mail:
[email protected]
E-mail:
[email protected]
Phone:
+49 (0) 721-989777-000
Phone:
+49 (0) 721-989777-300
Fax:
+49 (0) 721-989777-010
Fax:
+49 (0) 721-989777-010
Online:
www.anybus.de
Online:
www.anybus.de
E-mail:
[email protected]
E-mail:
[email protected]
Phone:
+81 (0) 45-478-5340
Phone:
+81 (0) 45-478-5340
Fax:
+81 (0) 45-476-0315
Fax:
+81 (0) 45-476-0315
Online:
www.anybus.jp
Online:
www.anybus.jp
E-mail:
[email protected]
E-mail:
[email protected]
Phone:
+86 (0) 10-8532-3183
Phone:
+86 (0) 10-8532-3023
Fax:
+86 (0) 10-8532-3209
Fax:
+86 (0) 10-8532-3209
Online:
www.anybus.cn
Online:
www.anybus.cn
E-mail:
[email protected]
E-mail:
[email protected]
Phone:
+39 039 59662 27
Phone:
+39 039 59662 27
Fax:
+39 039 59662 31
Fax:
+39 039 59662 31
Online:
www.anybus.it
Online:
www.anybus.it
E-mail:
[email protected]
E-mail:
[email protected]
Phone:
+33 (0) 3 68 368 034
Phone:
+33 (0) 3 68 368 033
Fax:
+33 (0) 3 68 368 031
Fax:
+33 (0) 3 68 368 031
Online:
www.anybus.fr
Online:
www.anybus.fr
E-mail:
[email protected]
E-mail:
[email protected]
Phone:
+44 (0) 1926 405599
Phone:
+46 (0) 35 - 17 29 20
Fax:
+44 (0) 1926 405522
Fax:
+46 (0) 35 - 17 29 09
Online:
www.anybus.co.uk
Online:
www.anybus.com
E-mail:
[email protected]
E-mail:
[email protected]
Phone:
+45 (0) 35 38 29 00
Phone:
+46 (0) 35 - 17 29 20
Fax:
+46 (0) 35 17 29 09
Fax:
+46 (0) 35 - 17 29 09
Online:
www.anybus.com
Online:
www.anybus.com
E-mail:
[email protected]
E-mail:
[email protected]
Phone:
+91 (0) 20 40111201
Phone:
+91 (0) 20 40111201
Fax:
+91 (0) 20 40111105
Fax:
+91 (0) 20 40111105
Online:
www.anybus.com
Online:
www.anybus.com
HMS North America
HMS Germany
HMS Japan
HMS China
HMS Italy
HMS France
HMS UK & Eire
HMS Denmark
HMS India
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Chapter 1
1. How to use this Document
The purpose of this tutorial is to help the user to a better understanding of the Anybus CompactCom
concept and how to configure the module, by discussing a simple example application.
When to Read and Use the Document
Whether you already have decided to develop an application with the Anybus CompactCom or not, you
can read this tutorial as a first introduction on how to communicate with the module. It will walk you
through examples to show you how to connect the module and how to set up the communication. It is
recommended to perform this “in real life” to get a deeper understanding of how the module is functioning.
This tutorial does not cover any network specific issues. Each network interface appendix includes a
short tutorial, that will help you prepare an application with the necessary elements for the certification
of your product.
The Anybus CompactCom concept is further described in the Anybus CompactCom Software Design
Guide (SWDG) and the Anybus CompactCom Hardware Design Guide (HWDG).
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Chapter 2
2. Introduction to the Anybus CompactCom
Background
Today there is no single standard for industrial communication. Several different industrial networks exist, using different protocols for exchanging information with devices connected to the network. The
growing use and fragmentation of industrial Ethernet and fieldbus communication makes it even more
difficult to decide which networks to support when you release a new product. To exchange one network or one device for another may be expensive and time consuming, not the least in development
efforts and in extra equipment.
Anybus CompactCom
With Anybus CompactCom you have full flexibility. The different modules in the Anybus CompactCom
family are designed to make it possible for a user to easily connect a device to any industrial network.
The developing efforts when changing network is minimal i.e. an application developed for one network, is easy to move to another network.
Each module in the Anybus CompactCom family is dedicated to a specific industrial network. The module includes network specific firmware, that makes any data exchanged on the network available to the
host application. The host application will thereby act as a device on the network through the module.
Regardless of network, the software interface that meets the host application and the developer is the
same. The interface is structured in an object oriented manner. Each object is centred around a group
of related information and services. This provides an efficient way of categorizing and addressing information.
The firmware in the Anybus CompactCom module typically controls the behavior of the module and its
actions on the network. The host application is accessed from the Anybus CompactCom module, and
the host application must be designed to handle these requests appropriately. This handling, though, is
to a great extent independent of which industrial network the module is dedicated to. Ideally you should
be able to exchange any module for any other in the Anybus CompactCom family, and the application
should still be able to run without any changes to the host application firmware.
By using Anybus CompactCom you can save on your development costs, up to 70%. You will achieve
maximum flexibility by getting access to all common fieldbuses and Ethernet networks. This gives you
fast access to the market with very competitive network connectivity solutions.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Chapter 3
3. Tutorial
3.1 Introduction
To implement an application, follow these steps:
1. Connect the Anybus CompactCom module, see
“Connect the Anybus CompactCom Module” on
page 7
2. Set operating mode (parallel or serial, baud rate),
see “Set Operating Mode” on page 9
3. Verify initial handshaking functionality, see “Initial Handshake” on page 11 (parallel mode) or page 19
(serial mode).
4. Verify sending/receiving telegrams, see “Sending
Telegrams - Parallel Communication” on page 14 or
“Sending Telegrams - Serial Communication” on page
22
5. Finalize setup, see “Setup continued” on page 29.
6. Set necessary network specific parameters, see respective network interface appendix.
Step 1 - 5 are described below. The text presents examples
and descriptions of functionality and characteristics of the
Anybus CompactCom concept and modules.
Step 6 is described in the respective Network Interface
Appendices.
To illustrate the procedure, two example traces of communication have been included, see appendices “Trace,
DeviceNet” on page 39 and “Trace, Profibus DP-V1” on
page 45.
Start
1. Connect
module
2. Set
operating
mode
3. Initial
handshake
4. Send and
receive
telegrams
5. Continue
and finalize
setup
6. Set network
parameters
Module
ready
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Tutorial 7
3.2 Connect the Anybus CompactCom Module
If you use the Anybus CompactCom Starter Kit,
you can go straight to “Serial Interface Mode” on
page 19. Please note that the starter kit does not allow use of the parallel mode.
Start
1. Connect
module
2. Set
operating
3.2.1 Host Interface Signals
The Anybus CompactCom host interface uses a 50 pin CompactFlash™ style
connector.
MD1
A1
A3
A5
A7
A9
A11
A13
D6
D4
D2
D0
VDD
VSS
OM1
CE
IRQ
RESET
GOP0
GIP0
LED2B
LED1B
Tx
MI1
VSS
HWDG
1
26
VSS
A0
A2
A4
A6
A8
A10
A12
D7
D5
D3
D1
VDD
VSS
OM0
OM2
R/W
OE
GOP1
GIP1
LED2A
LED1A
Rx
MI0
MD0
25
50
Note 1: The host interface is not pin compatible with the CompactFlash™ standard.
Note 2: The interface is not hot-swap capable. The power must be turned off before the module is attached or detached. Failure to observe this may damage the host product and/or the Anybus CompactCom module.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Tutorial 8
Each signal presented in the table below is described in detail in the Anybus CompactCom Hardware
Design Guide.
Position
Signal
Type
36, 11, 35
OM[0...2]
I
27, 2
8
MI[0...1]
RESET
O
I
26, 25
14, 39, 15, 40, 16, 41, 17, 42
49, 24, 48, 23, 47, 22, 46, 21,
45, 20, 44
19, 43, 18
10
33
34
9
28
3
MD[0...1]
D[0...7]
A[0...10]
O
BI
I
A[11...13]
CE
OE
R/W
IRQ
Rx
Tx
I
I
I
I
O
I
O
30
29
5
4
6, 31
7, 32
13, 38
1, 12, 37, 50
LED2A
LED1A
LED2B
LED1B
GIP[0...1]
GOP[0...1]
VDD
VSS
O
O
O
O
I
O
PWR
PWR
I
O
BI
P
How to connect for the tutorial
example
Operation Mode
See “Set Operating Mode” on
page 9
Module Identification
Leave unconnected
Reset Input, active low
Connect to a host application controllable output
Module Detection
Leave unconnected
Parallel Interface, active if Tie to VSS when unused
set by the Operation Mode Tie to VSS when unused
pins
Function
Tie to VDD when unused
Tie to VDD when unused
Tie to VDD when unused
Tie to VDD when unused
Leave unconnected if unused
Serial Interface, active if Tie to VDD when unused
set by the Operation Mode Leave unconnected if unused
pins
Network Status LED Out- Leave unconnected
puts
General Purpose I/O
Power Supply
Ground
Tie to VSS
Leave unconnected
3.3 V
Ground
= Input, CMOS (3.3V)
= Output, CMOS (3.3V)
= Bidirectional, Tristate
= Power supply inputs
Note 1: For mechanical properties, measurements etc. see Appendix B “Mechanical Specification” in
Hardware Design Guide.
Note 2: Connect either the parallel interface OR the serial interface to the host application. The interface
not used must be connected as indicated in the table.
Note 3: None of the host interface signals are 5V tolerant.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Tutorial 9
3.3 Set Operating Mode
Following the flowchart on page 6, choose either parallel
mode or serial mode as shown in the table below.
The inputs OM2, OM1, and OM0 select which interface
that should be used to exchange data (parallel or serial)
and, if the serial interface option is used, the operating
baud rate. The state of these signals is sampled once during startup, i.e. any change requires a reset in order to have
effect.
module
SWDG
2. Set
operating
mode
h
Parallel interface State
Enabled
(disabled)
Operating Mode
Serial interface State
(disabled)
Enabled, baud rate: 19.2 kbps
Enabled, baud rate: 57.6 kbps
Enabled, baud rate: 115.2 kbps
Enabled, baud rate: 625 kbps
3. Initial
d h k
OM2
LOW
LOW
LOW
LOW
HIGH
Setting
OM1
LOW
LOW
HIGH
HIGH
LOW
OM0
LOW
HIGH
LOW
HIGH
LOW
LOW = VIL
HIGH = VIH
Note 1: VDD, VSS and the state of the operation mode inputs must be stable prior to releasing the RESET signal. Failure to observe this may result in faulty or unexpected behavior.
Note 2: If you use the Anybus CompactCom Starter Kit, which includes the Anybus CompactCom serial adapter, the parallel mode is not available.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Tutorial 10
3.4 Telegrams
The hardware setup of the module is finished and the rest of the tutorial will describe the setup of the
communication between the host application and the Anybus CompactCom module and the configuration of the module.
Communication with the Anybus CompactCom module is handled through telegrams.These telegrams
have a well defined format, where each telegram always include at least control or status information.
They are sent in a ping-pong protocol, i.e. the application sends a telegram, including at least control
information, to the module and waits for a telegram in return before it sends the next telegram.The return telegram always includes at least status information.
The control and status information is structured in registers, and dedicated bits, CTRL_T in the control
register and STAT_T in the status register, are used to indicate need of retransmission and to make polling applications feasible.1
Host Application
Anybus Module
Telegram (CTR
L_T=0)
_T=0)
Telegram (STAT
Expected CTRL_T=0
OK, send next
Telegram (CTR
L_T=1)
_T=1)
Telegram (STAT
Expected CTRL_T=1
OK, send next
Telegram (CTR
L_T=0)
_T=0)
Telegram (STAT
Expected CTRL_T=0
OK, send next
All telegrams, whether in parallel or serial mode, have dedicated sections for control/status information
and message data. Once the module is up and running, there is also a section for process data. Telegrams,
registers and messages will be described further later in this chapter.
The user can define a maximum time for an expected response, yielding a time out exception if the response time is too long. For more information see “Anybus CompactCom Software Design Guide”,
chapter three, sections “Anybus Watchdog” and “Application Watchdog”.
1.
See descriptions of these bits and registers on page 13 for parallel mode and on page 20 for serial mode.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
SWDG
Tutorial 11
3.5 Parallel Interface Mode
For serial interface mode, please proceed to section 3.6 on page 19.
3.5.1 Initial Handshake
The purpose of the initial handshake is to make sure that
the Anybus CompactCom module is ready to communicate. When done, the module will enter the SETUP-state.
operating
mode
The internal status register, see page 13, is cleared at startup, which is essential for a correct setup. The host application must wait at least 1.5 s after reset or power up, to
be sure that a correct reading of the status register can be
done. Any interrupts detected during this period must be
ignored. After this initial handshaking the module has entered SETUP state and can be configured. The host application can either react on interrupts or poll the internal
Status Register for an indication that information is available.
3. Initial
handshake
Release
Reset
Min. 1.5s
Read
Status Register
Wait & Ignore Interrupts
Anybus CompactCom Tutorial
Doc.Rev. 1.01
4. Send and
receive
If applicable, act on / enable Interrupts
(Anybus enters ‘SETUP’-state)
Doc.Id. HMSI-168-106
Tutorial 12
3.5.2 DPRAM
SWDG
After the initial handshake has been performed, the host application can start to communicate with the
Anybus CompactCom module with telegrams. This section gives a short introduction to the means of
communication used.
The communication between the application and Anybus CompactCom module in parallel mode is performed in the internal DPRAM (dual port memory). The host application can access and address this
memory just as any memory in an embedded system. When a telegram is sent from the host application,
the contents are written by the host application to specific areas in the DPRAM. When the host application receives a telegram, specific areas of the memory hold the contents of the telegram for the host
application to read.
The DPRAM memory includes areas for the Control and Status Registers (used to control the communication between the host application and the module), read and write areas for Messages, and read and
write areas for Process Data. The addresses for the different areas are fixed. A telegram sent by the host
application to the Anybus CompactCom always contain data to be written to the Control Register in the
DPRAM. A telegram sent the other way, from the Anybus CompactCom to the host application, always
replicates the Status Register in the DPRAM. Depending on the contents of these registers, the telegram
may contain Messages and/or Process Data. The Process Data Read and Write Areas are not used during setup and configuration.
Memory Map
The address offset specified below is relative to the base address of the module, i.e. from the beginning
of the area in the host application memory space where the parallel interface has been implemented.
Address Offset:
0000h... 37FFh
Area:
(reserved)
Access:
Notes:
-
(reserved for future use)
Not used during setup and configuration.
See “Process Data Subfield” in SWDG
Not used during setup and configuration.
See “Process Data Subfield” in SWDG
3800h... 38FFh
Process Data Write Area
Write Only
3900h... 39FFh
Process Data Read Area
Read Only
3A00h... 3AFFh
(reserved)
3B00h... 3C06h
Message Write Area
3C07h... 3CFFh
(reserved)
3D00h... 3E06h
Message Read Area
Write Only
Used for messages to the module from
the host application.
See “Object Messaging” in SWDG
Read Only
Used for messages from the module to
the host application.
See “Object Messaging” in SWDG
3E07h... 3FFDh
(reserved)
3FFEh
3FFFh
Control Register
Status Register
Write Only
Read Only
See “Control Register” on page 13
See “Status Register” on page 13
IMPORTANT: C-programmers are reminded to declare the entire shared memory area as volatile.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Tutorial 13
Control Register (Read/Write)
The Control Register controls the communication with the Anybus CompactCom module. In this tutorial only bits 5 (CTRL_R), 6 (CTRL_M) and 7 (CTRL_T) are used. The other bits can be ignored for
the time being. For a complete description, see Anybus CompactCom Software Design Guide.
b7 (MSB)
CTRL_T
Bit
CTRL_T
CTRL_M
CTRL_R
CTRL_AUX
-
b6
CTRL_M
b5
CTRL_R
b4
CTRL_AUX
b3
-
b2
-
b1
-
SWDG
b0 (LSB)
-
Description
The host application shall toggle this bit when sending a new telegram. CTRL_T must be set to “1” in the
initial telegram sent by the application to the module.
Set if the telegram contains message data.
If set, the host application is ready to receive a new command.
Auxiliary bit
(reserved, set to zero)
Status Register (Read Only)
This register holds the current status of the Anybus CompactCom module. At this stage in the tutorial
we will only use bits 5 (STAT_R), bit 6 (STAT_M) and bit 7 (STAT_T). The remaining bits can be ignored for the time being. For a complete description see Anybus CompactCom Software Design Guide.
b7 (MSB)
STAT_T
Bit
STAT_T
STAT_M
STAT_R
STAT_AUX
SUP
S[0... 2]
b6
STAT_M
b5
STAT_R
b4
STAT_AUX
b3
SUP
b2
S2
b1
S1
b0 (LSB)
S0
Description
When the Anybus CompactCom module issues new telegrams, this bit will be set to the same value as
CTRL_T in the last telegram received from the host application.
Set if the telegram contains message data.
If set, the Anybus CompactCom module is ready to receive a new command.
Auxiliary bit
Value:Meaning:a
0: Anybus CompactCom module is not supervised.
1: Anybus CompactCom module is supervised by another network device
These bits indicates the current state of the Anybus CompactCom module
S2 S1 S0 Anybus CompactCom State
0 0 0 SETUP
0 0 1 NW_INIT
0 1 0 WAIT_PROCESS
0 1 1 IDLE
1 0 0 PROCESS_ACTIVE
1 0 1 ERROR
1 1 0 (reserved)
1 1 1 EXCEPTION
a. This bit is not used in all networks. Please consult the appropriate appendix for explanation
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
SWDG
Tutorial 14
3.5.3 Sending Telegrams - Parallel Communication
The examples in this section show what the host application writes to and reads from the different areas in the
DPRAM, illustrating the steps when the application sends
and receives telegrams. For example, “W Control Reg
0x80” means that the host application writes the hexadecimal value 80 to the control register area of the DPRAM.
Bit 7 of the register is set to 1, the rest of the register is all
zeroes.
3. Initial
handshake
4. Send and
receive
telegrams
5. Continue
d fi li
Sending Telegrams (Parallel)
Once the initial handshaking is done, see page 11,
the host application can start to send telegrams to
the module. That is, the host applications starts
writing to the control register area in the
DPRAM.
The example shows the underlying telegram pingpong protocol. Each telegram to the module
from the host application generates a response
telegram from the module to the host application.
Send Telegram
Toggle CTRL_T
Example:
W Control Reg
R Status Reg
W Control Reg
R Status Reg
W Control Reg
R Status Reg
W Control Reg
R Status Reg
etc.
0x80
0x80
0x00
0x00
0x80
0x80
0x00
0x00
During parallel communication, the host application sends a telegram by toggling CTRL_T in the
Control Register in the DPRAM. When this register is written an interrupt is generated in the Anybus CompactCom module, and the module
checks the CTRL_T bit to see if a new telegram is
available
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Tutorial 15
The Anybus CompactCom module checks its status, and when it is satisfied that it has performed
all actions possible at the time being, it toggles the
STAT_T bit in Status register to equal CTRL_T.
A valid response telegram is available for the host
application.
The host application keeps checking the STAT_T
bit. When this bit equals CTRL_T at two consecutive readings, it has received a response telegram. Two consecutive readings are performed to
be sure that the value of the STAT_T bit is stable.
Telegrams are sent and received like this, in a
ping-pong protocol, as long as the Anybus CompactCom module is communicating normally.
Receive Telegram
STAT_T =
CTRL_T
No
Yes
STAT_T =
CTRL_T
No
Yes
Telegram received
The continuous exchange of telegrams is established. The host application waits for a signal to send a message to the module.
Send Command
Example:
W
R
W
R
W
R
Control Reg
Status Reg
Control Reg
Status Reg
Control Reg
Status Reg
0x80
0x80
0x00
0x00
0x80
0xa0
In the last line of the example above, the status register has
not only had its STAT_T bit toggled to equal CTRL_T, but
also the STAT_R bit set to 1. This indicates that the module
is ready to accept a command from the application. In the
next telegram the application sends, it can add message data
to the telegram. It is not necessary or mandatory to send a
message at this stage, but if you do, it has to be a command.
STAT_R = 1?
No
Yes
Send Message
Please note that the number of telegrams exchanged, before
the module is ready to accept a message, can vary.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Tutorial 16
Sending a Message to the Anybus CompactCom Module (Parallel)
To check that the communication is working, a message including a command can be sent to the module. For example,
a message is sent to the module to return its module type, as
in this case.
Send message
Example:
W
R
W
W
R
R
Control Reg 0x80
Status Reg 0xa0
Message Write Area 0x01, 0x01, 0x01,
0x00, 0x41,0x00, 0x01, 0x00
Control Reg 0x40
Status Reg 0x60
Message Read Area
0x01, 0x01, 0x01,
0x00, 0x01,0x02, 0x01, 0x00, 0x01, 0x04
Note: Please refer to the table on page 17 for an explanation
of the format and the contents of the message write and read
areas in the DPRAM.
Write message data
Send telegram with
CTRL_M = 1
The application writes a message to the message write area in
the DPRAM, see the memory map on page 12. Once this is
done, it writes to the control register, toggling the CTRL_T
bit AND setting the CTRL_M bit simultaneously. Each time
anything is written to this register, an interrupt is generated in
the Anybus module, so it is important that all bits in the register are written at the same time. It is equally important that
the application has finished writing the message write area
prior to writing to the Control Register.
Receiving a Message from the Anybus CompactCom Module (Parallel)
The module reads the telegram the host application has sent,
and returns the module type.
Receive message
Example (repeated):
W Message Write Area
0x00, 0x41,0x00, 0x01,
W Control Reg 0x40
R Status Reg 0x60
R Message Read Area
0x00, 0x01,0x02, 0x01,
0x01, 0x01, 0x01,
0x00
Receive telegram
0x01, 0x01, 0x01,
0x00, 0x01, 0x04
When the application has finished sending its telegram by
writing to the control register, an interrupt is generated and
the module detects the arrival of the telegram including the
message. It reads the message write area in the DPRAM and
processes the command. (For a description of the contents of
the message write and read areas, see the table on page 17).
The module processes the data and then writes its response
to the message read area. This done, it writes to the status register, toggling the STAT_T bit to equal CTRL_T bit and setting STAT_M to one to indicate that a message is available in
the message read area.
STAT_M =1?
No
Yes
Read message data
The application detects that STAT_T has changed and that
STAT_M is set to 1. It will then have to fetch the message in
the DPRAM message read area, before the next telegram is
sent.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Tutorial 17
Please note that after writing to the control register, the application is not allowed to read the contents
of the DPRAM, except for the status register, until the Anybus CompactCom module has finished updating the status register. This can be detected by the application either by polling the status register until
STAT_T1 equals CTRL_T or by using an interrupt signal (IRQ) from the Anybus CompactCom module.
The contents of the messages in the telegrams are explained in the tables below. For a complete description of the message layout, please refer to the Software Design Guide, chapter 5
Command:.
Area offset
0
1
2
3
4
5
6
7
Contentsa of request in Write
Message Area
00h
01h
01h (lsb)
00h (msb)
41h
00h
01h
00h
Description (request)b
Source ID
The Anybus object in the Anybus CompactCom module.
Instance 1
Message type: command (request to return module type)
Size of Message Data (0 bytes)
Attribute 1 (Module type)
(not used)
a. All data is little endian.
b. Object messaging is used when addressing the objects in the Anybus CompactCom module and in the host application. See “Accessing the Anybus CompactCom” on page 30 for more information.
Response:
0
Contentsa of response in
Read Message Area
00h
1
2
3
4
5
6
7
8-9
01h
01h (lsb)
00h (msb)
01h
02h
01h
00h
01h, 04h
Area offset
Description (response)
Source IDb
The Anybus object in the Anybus CompactCom module.
Instance 1
Message type: response (the command is copied, with the C bit set to 0)
Size of Message Data (2 bytes)
Attribute 1 (Module type)
(not used)
Message data: module type (0401h = Anybus CompactCom)
a. All data is little endian.
b. To keep track of which response belongs to which request, each message is tagged with a Source ID. When issuing commands, the host application may choose Source ID arbitrarily, and the response from the module will have
the same Source ID. When sending a response to a command from the module, the host application should
always copy the Source ID, the object number and the instance number of the message with the original command. The command is also copied, but the C bit is set to 0.
Note: As stated above, telegram transmission is triggered via the Control Register, and the reception of
a new telegram is indicated in the Status Register. This means that the Process Data and Message subfields must be written prior to accessing the Control Register. Do not use bit handling or other read-modify-write instructions directly on this register, since the module may interpret this as multiple accesses.
All bit handling etc. must instead be performed in a temporary register, and after manipulation be written
back. Also, while waiting for reception of a telegram, any access to the parallel interface other than polling of the Status Register must be avoided.
1.
To ensure valid results when polling the Status Register, it is required to use a read-until-two-consecutive-readings-agree procedure,
i.e. the same value is read at two consecutive readings.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
SWDG
Tutorial 18
Parallel Telegram Handling, Summary
On the parallel interface, transmission and reception is managed through the Handshake Registers, i.e.
the Status Register and the Control Register.
To transmit a telegram, perform the following steps:
1. If applicable, write the Write Process Data to the Process Data Write Area (3800h...38FFh)
2. If applicable, write the message to the Message Write Area (3B00h...3C06h)
3. Update the Control Register to trigger the transmission.
Telegram reception is signalled by the STAT_T-bit in the Status Register. The host application can either
poll the Status Register cyclically to detect new telegrams, or rely on interrupt operation.
IMPORTANT:
•
To ensure valid results when polling the Status Register, it is required to use a read-until-twoconsecutive-readings-agree procedure, i.e. the same value is read at two consecutive readings.
•
The host application must ensure continuous ping-pong communication, so that the ABCC
module will be able to send commands as well.
•
One command always results in one and only one response.
•
Message responses can always be sent, regardless of the state of the CTRL_R-bit or the
STAT_R-bit.
•
Several telegrams can occur before a response is sent.
•
Several commands can be waiting for a response, in both directions. As long as the CTRL_R-bit
or the STAT_R-bit is set, new commands are allowed in the respective direction.
•
If several commands have been sent without waiting for responses, the order of responses may
be different than the order of commands.
Please continue to “Setup continued” on page 29.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Tutorial 19
3.6 Serial Interface Mode
In this section, the same steps are described as in section 3.5, but for the serial interface mode.
3.6.1 Initial Handshake
The purpose of the initial handshake is to make sure that
the Anybus CompactCom module is ready to communicate. When done, the module will enter the SETUP-state.
The internal status register, see page 21, is cleared at startup, which is essential for a correct setup. The host application must thus wait at least 1.5 s after reset or power up
before it sends the first telegram to be sure that the module is ready to receive serial data.
Release
Reset
Min. 1.5s
Wait...
Anybus CompactCom Tutorial
Doc.Rev. 1.01
operating
mode
3. Initial
handshake
4. Send and
receive
Send
1st Telegram
(Anybus enters ‘SETUP’-state)
Doc.Id. HMSI-168-106
Tutorial 20
3.6.2 Serial Telegram Frame
The telegrams sent in serial mode all use the frame shown below. During SETUP, the Process Data Subfield is not present in the telegrams, leaving 19 bytes to be sent in each telegram.
1 byte
16 bytes
Handshake
Message
Register Field
Subfield
(1st byte) Please consult the Software
Design Guide for a thorough
description of this field.
•
Up to 256 bytes
Process Data Subfield,
not existing during SETUP
2 bytes
CRC16
(last byte)
Handshake Register Field
This field contains the Control Register, see page 20, in telegrams sent to the Anybus CompactCom module, and the Status Register, see page 21, in telegrams received from the Anybus CompactCom module.
•
Message Subfield
This field holds the message (or message fragment) that is to be sent. To maintain throughput
for the Process Data, the message subfield is limited to 16 bytes when using the serial interface.
Longer messages are exchanged as several smaller fragments (see “ Fragmentation” in the Software Design Guide).
•
SWDG
Process Data Subfield
This field contains the Write Process Data in telegrams sent to the Anybus CompactCom module, and the Read Process Data in telegrams received from the Anybus CompactCom module.
Please note that this field does not exist when the Anybus CompactCom module is operating in
the ‘SETUP’-state.
•
CRC16
This field holds a 16 bit Cyclic Redundancy Check, see “CRC Calculation” in the Software Design Guide. The CRC covers the entire telegram except for the CRC itself.
SWDG
Control Register (Sent)
The Control Register controls the communication with the Anybus CompactCom module. In this tutorial we will only use bits 5 (CTRL_R), 6 (CTRL_M) and 7 (CTRL_T). The other bits can be ignored for
the time being. For a complete description, see Anybus CompactCom Software Design Guide.
b7 (MSB)
CTRL_T
Bit
CTRL_T
CTRL_M
CTRL_R
CTRL_AUX
-
b6
CTRL_M
b5
CTRL_R
b4
CTRL_AUX
b3
-
b2
-
b1
-
b0 (LSB)
-
Description
The host application shall toggle this bit when sending a new telegram. CTRL_T must be set to “1” in the
initial telegram sent by the application to the module.
Set if the telegram contains message data.
If set, the host application is ready to receive a new command.
Auxiliary bit
(reserved, set to zero)
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
SWDG
Tutorial 21
Status Register (Received)
This register holds the current status of the Anybus CompactCom module. At this stage in the tutorial
we will only use bits 5 (STAT_R), bit 6 (STAT_M) and bit 7 (STAT_T). The remaining bits can be ignored for the time being. For a complete description see Anybus CompactCom Software Design Guide.
b7 (MSB)
STAT_T
Bit
STAT_T
STAT_M
STAT_R
STAT_AUX
SUP
S[0... 2]
b6
STAT_M
b5
STAT_R
b4
STAT_AUX
b3
SUP
b2
S2
b1
S1
b0 (LSB)
S0
Description
When the Anybus CompactCom module issues new telegrams, this bit will be set to the same value as
CTRL_T in the last telegram received from the host application.
Set if the telegram contains message data.
If set, the Anybus CompactCom module is ready to receive a new command.
Auxiliary bit
Value:Meaning:a
0: Anybus CompactCom module is not supervised.
1: Anybus CompactCom module is supervised by another network device
These bits indicates the current state of the Anybus CompactCom module
S2 S1 S0 Anybus CompactCom State
0 0 0 SETUP
0 0 1 NW_INIT
0 1 0 WAIT_PROCESS
0 1 1 IDLE
1 0 0 PROCESS_ACTIVE
1 0 1 ERROR
1 1 0 (reserved)
1 1 1 EXCEPTION
a. This bit is not used in all networks. Please consult the appropriate appendix for explanation
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
SWDG
Tutorial 22
3.6.3 Sending Telegrams - Serial Communication
The examples in this section show what is sent from the
host application to the Anybus CompactCom module and
what is received by the application from the module, illustrating the steps when using serial communication.
All telegrams sent in serial mode contains 19 bytes, even
when not all fields are needed. The fields not used, are
filled with zeroes. The examples thus show the total content of each telegram.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
3. Initial
handshake
4. Send and
receive
telegrams
5. Continue
d fi li
Doc.Id. HMSI-168-106
Tutorial 23
Sending Telegrams (Serial)
Once the initial handshaking is done, see page 19,
the host application can start to send telegrams to
the module.
Example:
Send: {0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, bCrccHi, bCrccLo}
Receive: {0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, bCrccHi, bCrccLo}
Send: {0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, bCrccHi, bCrccLo}
Send Telegram
Toggle CTRL_T
Receive: {0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, bCrccHi, bCrccLo}
Send: {0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, bCrccHi, bCrccLo}
Receive: {0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, bCrccHi, bCrccLo}
etc.
The application sends a telegram with the
CTRL_T bit in the Control Register set to 1. The
module sends a telegram in return, toggling the
STAT_T bit to equal CTRL_T. No data has been
sent yet, the rest of the telegram frames are empty, apart from the CRC (bCrccHi, bCrccLo)
which ends each frame.
Receive Telegram
Even though there is no information in most of
the telegram frame, a complete frame has to be
sent each time. The parts not used are filled with
zeroes.
STAT_T =
CTRL_T
Telegrams are sent and received like this, in a
ping-pong protocol, as long as the Anybus CompactCom module is communicating normally.
Yes
No
Telegram received
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Tutorial 24
The continuous exchange of telegrams is established. The
host application waits for a signal to send a message to the
module.
Example:
Send: {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, bCrccHi, bCrccLo}
Receive: {0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, bCrccHi,
bCrccLo}
Send: {0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, bCrccHi, bCrccLo}
Send Command
STAT_R = 1?
No
Yes
Send Message
Receive: {0xa0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, bCrccHi,
bCrccLo}
In the last telegram in the example above, the status register
has not only had its STAT_T bit toggled to equal CTRL_T,
but also the STAT_R bit set to 1. This indicates that the
module is ready to accept a command from the application.
In the next telegram the application sends, it can add message data to the telegram. It is not necessary or mandatory
to send a message at this stage, but if you do, it has to be a
command.
Please note that the number of telegrams exchanged, before
the module is ready to accept a message, can vary.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Tutorial 25
Sending a Message to the Anybus CompactCom Module (Serial)
To check that the communication is working, a telegram
with a message including a command can be sent from the
host application to the module. For example, a message can
be sent to the module to return its module type, as in this
case.
Send message
Example:
Send: {0x40, 0x00, 0x01, 0x01, 0x00, 0x41,
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, bCrccHi, bCrccLo}
Receive: {0x20, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, bCrccHi,
bCrccLo}
Write message data
Send telegram with
CTRL_M = 1
The application sends the command in the message data
subfield in the telegram frame, see the table below. The
module acknowledges the telegram, but doesn’t take any action yet, as it doesn’t know if all data in the message has arrived.
Description of the contents of the first telegram sent:.
Byte no
1
2
3
4
5
6
7
8
9
10-17
18-19
From application to modulea
40h
00h
01h
01h (lsb)
00h (msb)
41h
00h
01h
00h
00h, 00h, 00h, 00h, 00h, 00h, 00h,
00h
bCrccHi, bCrccLo
Description (to module)b
Control Register, CTRL_M = 1
Source ID
The Anybus object in the Anybus CompactCom module
Instance 1
Message type: command (request to return module type)
Size of Message Data (0 bytes)
Attribute 1 (Module type)
(not used)
(no message data)
CRC
a. All data is little endian.
b. Object messaging is used when addressing the objects in the Anybus CompactCom module and in the host
application. See “Accessing the Anybus CompactCom” on page 30 for more information.
The layout of the message subfield, bytes 2 - 17, is described in detail in SWDG, chapter 5.
The telegram the application receives from the module in this example is empty, apart from the status
register in the first byte (20h), and the CRC in the two last bytes. The STAT_T bit is toggled to the same
value as CTRL_T. STAT_R is set, to indicate that a new command can be accepted. As a telegram frame
always has 19 bytes, the empty message subfield is filled with zeroes.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
SWDG
Tutorial 26
Receiving a Message (Serial)
The host application has sent all message data needed to
the Anybus CompactCom module, but it has to tell the
module that so is the case. This done, the module sends
a telegram that includes the response to the command
sent by the host application.
Example:
Receive message
Receive telegram
Send: {0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
bCrccHi, bCrccLo}
Receive: {0xE0, 0x00, 0x01, 0x01, 0x00,
0x01, 0x02, 0x01, 0x00, 0x01, 0x04,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
bCrccHi, bCrccLo}
STAT_M =1?
No
Yes
The telegram, sent by the application, contains no message data. This tells the module that all message data has
arrived, and it can start to process the previously arrived
command. In this example, the response from the module is included in the next telegram, that the application
receives from the module, see table below. This may not
necessarily be the case. Several telegrams can be exchanged before the module has finished processing the
command and sends the response.
Read message data
fragment to internal buffer
Description of the contents of the second telegram received by the application:
1
2
From module to applicationa
E0h
00h
3
4
5
6
7
8
9
10-11
12-17
18-19
01h
01h (lsb)
00h (msb)
01h
02h
01h
00h
01h, 04h
00h, 00h, 00h, 00h, 00h, 00h
bCrccHi, bCrccLo
Byte no
Description (to module/from module)
Status Register
Source IDb
The Anybus object in the Anybus CompactCom module/
Instance 1
Message type: response (the command is copied, with the C bit set to 0)
Size of Message Data (0/2 bytes)
attribute 1 (Module type)
(not used)
Message data: module type (0401h = Anybus CompactCom)
(not used)
CRC
a. All data is little endian.
b. To keep track of which response belongs to which request, each message is tagged with a Source ID. When issuing commands, the host application may choose Source ID arbitrarily, and the response from the module will have
the same Source ID. When sending a response to a command from the module, the host application should
always copy the Source ID, the object number and the instance number of the message with the original command. The command is also copied, but the C bit is set to 0.
The layout of a message is described in detail in SWDG, chapter 5.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
SWDG
Doc.Id. HMSI-168-106
Tutorial 27
Number of Telegrams in Serial Communication
In serial communication, a telegram with CTRL_M = 0 (from the application) or STAT_M = 0 (from
the Anybus CompactCom module) signals that all data belonging to the message has been sent. This
implies that any message needs at least two telegrams to be delivered to the module, as well as the other
way around.
The figure below show an example of a sequence of telegrams between the host application and the Anybus CompactCom module. The application sends a telegram to check that the module is ready to accept
a command. The module returns a telegram where STAT_R is set to 1, indicating that it is ready to accept a command. Then the application can send a telegram with a message including a command. The
Anybus CompactCom module receives this telegram but does not process the message until it has received a telegram with an empty message field to ensure that all of the message has been sent. The Anybus CompactCom processes the message and sends a response back, also finished by a telegram
including an empty message.
Host Application
Anybus CompactCom Module
Telegram (CTR
L_T=1)
=1)
_T=1, STAT_R
Telegram (STAT
Expected CTRL_T=1
OK, send next.
Ready to accept command
OK to send command
Telegram (CTR
L_T=0, CTRL_M
=1)
_T=0)
Telegram (STAT
OK, send next with
empty message,
CTRL_M=0, to indicate
that complete message
has been sent
Telegram (CTR
Expected CTRL_T=0
OK
Read message data
as CTRL_M=1
Send next
L_T=1, CTRL_M
=0)
_T=1)
Telegram (STAT
OK, send next
Expected CTRL_T=1
OK
Process message as
CTRL_M = 0
Send next
Telegram (CTR
L_T=0)
Telegram
OK,
read message data
as STAT_M=1,
send next
AT_M=1)
(STAT_T=0, ST
Telegram (CTR
L_T=1)
=0)
_T=1, STAT_M
Telegram (STAT
Expected CTRL_T=0
OK,
send message (STAT_M=1)
Expected CTRL_T=1
OK, send next with
empty message,
STAT_M=0, to indicate
that complete message
has been sent
OK,
Process message as
STAT_M=0
Send next
Each arrow in this example of ping-pong communication, indicates a telegram sent either from the application to the Anybus CompactCom module, or the other way around.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Tutorial 28
Serial Message Handling, Summary
On the serial interface, transmission and reception of messages are managed through the Handshake
Registers, which contents always are available in the first byte of the telegram.
To transmit a message, perform the following steps:
1. Send a telegram to the Anybus CompactCom module with a message in the message subfield of
the telegram frame and set CTRL_M = 1.
2. Wait for a telegram from the module where STAT_T equals CTRL_T
3. If the message is larger than the defined fields in the telegram frame, the message will have to be
fragmented, see “Fragmentation” in SWDG. Continue sending telegrams with message data and
CTRL_M set until all message data has been sent.
4. Send a telegram with CTRL_M = 0 to the Anybus CompactCom module to indicate that the
transmission of the message is finished.
IMPORTANT:
•
The host application must ensure continuous ping-pong communication, so that the ABCC
module will be able to send commands as well.
•
One command always results in one and only one response.
•
Message responses can always be sent, regardless of the state of the CTRL_R-bit or the
STAT_R-bit.
•
Several telegrams can occur before a response is sent.
•
Several commands can be waiting for a response, in both directions. As long as the CTRL_R-bit
or the STAT_R-bit is set, new commands are allowed in the respective direction.
•
If several commands have been sent without waiting for responses, the order of responses may
be different than the order of commands.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
SWDG
Tutorial 29
3.7 Setup continued
In the examples in the rest of this tutorial, only the contents of the Control and Status Registers, and the Message
Read and Write Areas will be presented. If serial or parallel communication is used is not relevant at this level of
communication as the telegrams only act as means of
transport for messages and data according to the protocols presented in the previous sections.
telegrams
5. Continue
and finalize
setup
6. Set network
3.7.1 Anybus CompactCom State Machine
After the initial handshake the Anybus
CompactCom enters the SETUP state.
The host application can send telegrams to
the module, and read/receive the responses. All communication to and from the
module is defined in telegrams that act as
means of transport for messages and data.1
In this section the continued setup of the
Anybus CompactCom will be described, to
show how to make the module ready for
transmitting and receiving process data.
(Power up)
SETUP
(00h)
EXCEPTION
(07h)
NW_INIT
(01h)
After setup has been finished the module
will enter the NW_INIT state, where it performs network related initalization tasks.
These tasks differs depending on the network interface used. When this is done, the
module enters the WAIT_PROCESS state,
and is ready to take part in the communication of the selected network interface. The
state of the CompactCom module can always be decided by reading bits 0-2 in the
status register, see “Status Register (Read
Only)” on page 13, but the transitions between the states may be so fast, that you will
not be able to detect all of them.
(From all states)
WAIT_PROCESS
(02h)
SWDG
PROCESS_ACTIVE
(04h)
ERROR
(05h)
1.
IDLE
(03h)
No process data can be sent during the SETUP state, only message data.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Tutorial 30
3.7.2 Accessing the Anybus CompactCom
The first part of a message sent to the module, contains information to identify where the command/
request is to be sent within the module firmware.
Information and services in the module are grouped into objects, each holding information and services
that belong to or are related to each other. This provides an easy and efficient way of accessing the module for configuration, Object Messaging. Each message is tagged with an object number and an instance
number, specifying the location of the data or setting associated with the message.
Requests from the module are of the same format, expecting the application to be designed in the same
manner, implementing objects that are similar in structure to the objects in the Anybus CompactCom
Firmware.
The host application must be able to handle all requests arriving from the module, even when the object
the request is asking for does not exist. If the module sends a message, that addresses an object that is
not implemented in the application, the application should respond with an error message. For further
information see “The Object Model” in the Anybus CompactCom Software Design Guide
There is only one object that is mandatory for the application to implement, the Application Data object,
that is used to exchange data through so called ADIs (Application Data Instances, see below). In most
applications it is recommended to implement more objects, as they may be needed for certification.
Please refer to the Network Interface Appendices.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
SWDG
Tutorial 31
3.7.3 Mapping ADIs
Data is exchanged on the network through ADIs (Application Data Instances) in the Application Data Object, residing in the host application. Each ADI represents a
block of network data. An ADI is normally associated
with acyclic parameters on the network side. It may also
be mapped as Process Data. Process data is exchanged
through a dedicated data channel in the Anybus CompactCom host protocol, and is normally associated with fast
cyclical network I/O.
Each ADI can be tagged with a name, data type, range and
default value, which makes it easily accessible from the
network.
telegrams
5. Continue
and finalize
setup
6. Set network
t
The exact representation of ADIs is highly network specific, so in this example we only show a simple, comparatively general ADI mapping. First two bytes (data type UINT16), and then one byte (data type UINT8)
are mapped to the Process Read Area. Please note, that this is only the setup of the area. The area itself
will not be accessible until setup is finished. Only the content of the message will be shown in the example
Example:
First message to module:
{0x02, 0x03, 0x01, 0x00, 0x51, 0x04, 0x01, 0x00, 0x05, 0x01, 0x01, 0x00}
The module responds with:
{0x02, 0x03, 0x01, 0x00, 0x11, 0x01, 0x01, 0x00, 0x00}
Second message to module:
{0x03, 0x03, 0x01, 0x00, 0x51, 0x04, 0x02, 0x00, 0x04, 0x01, 0x02, 0x00}
The module responds with:
{0x03, 0x03, 0x01, 0x00, 0x11, 0x01, 0x02, 0x00, 0x02}
For explanation of the example, please see tables below and on next page
.First command:
Area offset
0
1
2-3
4
5
6-7
8
9
10 - 11
Contents of request
02h
03h
01h 00h
51h
04h
01h 00h
05h
01h
01h 00h
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Description (request)
Source ID
The Network Object in the Anybus CompactCom module.
Instance 1
Message type: command (Map_ADI_Read_Area)
Size of Message Data (4)
ADI instance number (1)
Data type UINT16
Number of elements in ADI (1)
Order number of the ADI (1)
Doc.Id. HMSI-168-106
Tutorial 32
First response:
Area offset
0
1
2-3
4
5
6-7
8
Contents of response
02h
03h
01h 00h
11h
01h
01h 00h
00h
Description (response)
Source ID
The Network Object in the Anybus CompactCom module.
Instance 1
Message type: response
Size of Message Data (1 byte)
ADI instance number (1)
Successful response, giving offset of mapped ADI
Second command:
Area offset
0
1
2-3
4
5
6-7
8
9
10 - 11
Contents of request
03h
03h
01h 00h
51h
04h
02h 00h
04h
01h
02h 00h
Description (request)
Source ID
The Network Object in the Anybus CompactCom module.
Instance 1
Message type: command (Map_ADI_Read_Area)
Size of Message Data (4)
ADI instance number (2)
Data type UINT8
Number of elements in ADI (1)
Order number of the ADI (2)
Second response:
Area offset
0
1
2-3
4
5
6-7
8
Contents of response
03h
03h
01h 00h
11h
01h
02h 00h
02h
Description (response)
Source ID
The Network Object in the Anybus CompactCom module.
Instance 1
Message type: response
Size of Message Data (1 byte)
ADI instance number (2)
Successful response, giving offset of mapped ADI
Note:
•
The offset of the mapped ADI is 2 in has second response, as the first ADI that was mapped has
the data type UINT8.
For details, see “Network Object” and “Message Layout” in the Anybus CompactCom Software Design
Guide.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
SWDG
Tutorial 33
3.7.4 Setup Complete
To finish setup the application sends this message to the
module:
telegrams
Example:
The following message is sent to the module:
{0x04, 0x01, 0x01, 0x00, 0x42, 0x01, 0x05,
0x00, 0x01}
The module responds with:
{0x04, 0x01, 0x01, 0x00, 0x02, 0x00, 0x05,
0x00}
5. Continue
and finalize
setup
6. Set network
t
Command:.
Area offset
0
1
2
3
4
5
6
7
8
Contents of request
04h
01h
01h (lsb)
00h (msb)
42h
01h
05h
00h
01h
Description (request)
Source ID
The Anybus object in the Anybus CompactCom module.
Instance 1
Contents of response
04h
01h
01h (lsb)
00h (msb)
02h
00h
05h
00h
Description (response)
Source ID
The Anybus object in the Anybus CompactCom module.
Instance 1
Message type: command (Set_attribute)
Size of Message Data (1 byte)
Attribute 5 (Setup complete)
(not used)
Setup complete attribute set to 1
Response:
Area offset
0
1
2
3
4
5
6
7
Message type: response (the command is copied, with the C bit set to 0)
Size of Message Data (0 bytes)
Attribute 5 (Setup Complete)
(not used)
Once setup is finished, signalled by the Setup Complete attribute set to 1, the Anybus CompactCom will
have changed states from SETUP to NW_INIT. The state of the module is always presented on bits b2,
b1 and b0 in the Status Register, see page 13.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Tutorial 34
3.8 Network Initialization
and finalize
The Anybus CompactCom has now entered the
setup
NW_INIT state. The module will start to send commands
to the application, to initialize the network communication. Exactly what commands are sent, depend on choice
6. Set network
of industrial network, see appendices for examples (Deparameters
viceNet on page 39 and PROFIBUS DP-V1 on page 45).
For each command received, the application must give a
valid response to the module, even if the requested objects is not implemented in the application. In this case a
Module
request to return the Vendor ID, that is a parameter in the
d
DeviceNet Object, is sent from the module. This object is not implemented in the application, so the
application returns an error message that says “unsupported object”.
Example:
The following message is sent from the module to the application:
{0x06, 0xfc, 0x01, 0x00, 0x41, 0x00, 0x01, 0x00}
The application responds with:
{0x06, 0xfc, 0x01, 0x00, 0x81, 0x01, 0x01, 0x00, 0x03}
Command (from the module to the host application):.
Area offset
0
1
2
3
4
5
6
7
Contents of request
06h
FCh
01h (lsb)
00h (msb)
41h
00h
01h
00h
Description (request)
Source ID
The DeviceNet object in the host application.
Instance 1
Message type: command (Get_attribute)
Size of Message Data ( 0 bytes)
Attribute 1 (Vendor ID)
(not used)
Response (from the host application to the module):
Area offset
0
1
2
3
4
5
6
7
8
Contents of response
06h
FCh
01h (lsb)
00h (msb)
81h
01h
01h
00h
03h
Description (response)
Source ID
The DeviceNet object in the host application.
Instance 1
Message type: error response
Size of Message Data (1 byte)
Attribute 1 (Vendor ID)
(not used)
Error message: Unsupported object
As mentioned above, the commands will differ between the industrial networks supported by Anybus
CompactCom. Also the number of commands will differ. There are default values for all attributes that
are requested by the module, so as long as a valid response is given (as shown in the example), the module will continue the network initialization. Once finished it will enter the WAIT_PROCESS state, see
“Anybus CompactCom State Machine” on page 29.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Tutorial 35
3.9 Further Configuration and Certification
The examples given above show a very simple implementation. The host application can contain several
more objects of different kinds, and in some cases it is recommended to implement some of them, e.g.
when the end product will be certified with the fieldbus organization in question.
Please consult the respective appendices where any further necessary settings and initializations are described.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Chapter 4
4. Resources
The previous chapter gives a relatively simple example of how to implement an application with an Anybus CompactCom module. The modules are very versatile, and include a lot more functionality than is
used in this tutorial. This chapter lists other documentation and material, that can be used when making
your own application.
4.1 Categorization of Functionality
The objects, including attributes and services, of the Anybus CompactCom and the application are divided into three categories: basic, advanced and extended.
4.1.1 Basic
This category includes objects, attributes and services that are mandatory to implement or to use. They
will be enough for starting up the Anybus CompactCom and sending/receiving data with the chosen
network protocol. The basic functions of the industrial network are used.
These objects are presented in this tutorial (and the appropriate industrial network appendix). Additional
objects etc, that will make it possible to certify the product also belong to this category.
4.1.2 Extended
Use of the objects in this category extends the functionality of the application. Access is given to the
more specific characteristics of the industrial network, not only the basic moving of data to and from
the network. Extra value is given to the application.
4.1.3 Advanced
The objects, attributes and services that belong to this group offer specialized and/or seldom used functionality. Most of the available network functionality is enabled and accessible. Access to the specification of the industrial network is normally required.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Resources 37
4.2 Design Guides
4.2.1 Anybus CompactCom Software Design Guide
This document is the complete manual for the software interface. It provides information, that covers
all parts of the software interface that are common to all Anybus CompactCom communication modules.
4.2.2 Anybus CompactCom Hardware Design Guide
This document is intended to provide a good understanding of the mechanical and electric properties
of the Anybus CompactCom platform.
4.3 Network Interface Appendices
Each module is accompanied by an appendix describing the network interface specific issues, such as
what is necessary to implement in an application, so that it can be certified.
The Standard Driver is designed to exploit the versatility of the Anybus-CompactCom concept while still keeping a high level of abstraction and flexibility. This means that it needs a certain degree
of memory and processing power by itself, which may prove impractical in smaller applications. To bridge this gap, HMS supplies
an alternative driver, known as the ‘Lite Driver’, which provides a
bare-bones solution suitable for applications with tight memory
and/or performance demands.
The Standard Driver is completely self-contained, i.e. it does not
require an operating system to function, and can be run either as an
interrupt driven service or polled cyclically by the host firmware.
Host Interface
Standard Driver
Host Application
HMS supplies two free source level (C language) software drivers,
the Standard Driver and the Lite Driver. These drivers are designed
to speed up the development process, by acting as “glue” between
the Anybus module and the host application. They separate low
level communication tasks from the host software environment.
Anybus Module
4.4 Drivers
Main Application
Software
The drivers, including documentation are available for download at
www.anybus.com.
4.5 Starter Kit
A starter kit is available for the Anybus CompactCom platform. It includes an evaluation board which
can be used to develop networking applications via the serial host interface channel.
The starter kit also includes a Software Development Kit (SDK). The aim of this is to show how a software application can be implemented using the Anybus CompactCom driver for communication with
the Anybus CompactCom.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Resources 38
The SDK is designed to run as a console application on win32 PC, communicating with the Anybus
CompactCom using a serial port.
Please visit www.anybus.com for more information.
4.6 Drive Profiles
The Anybus-CompactCom Drive Profile range of products extends the Anybus-CompactCom concept
with additional Drive Profile functionality. This extended software functionality makes it easier for manufacturers to make products which comply to the latest communication standards for drives. This tutorial does not cover drive profiles, but the issues covered are of course valid for those products as well.
On www.anybus.com documentation is available both for drive profiles in general and for those modules that incorporate drive profiles.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
Appendix A
A. Trace, DeviceNet
This appendix holds a transcription of an example communication in parallel mode between a host application and an Anybus CompactCom DeviceNet module. The Data column contains what is either
written to or read from the specified DPRAM area by the host application. See also the Anybus CompactCom Software Design Guide and the Network Interface Appendix for DeviceNet.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
R/W DPRAM area
Data
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Instance
Command/
Response
Information
Initial Handshake
Anybus (0x01)
Network (0x03)
Anybus (0x01)
1
1
1
Get_Attribute
Attr = MODULE_TYPE (0x01)
ACK
ModuleType = ABCC (0x0401)
Map_ADI_Read_Area ADI = 0x0001, DataType = UINT8 (0x04), 
NumElements = 0x01, OrderNum = 0x0001
ACK
AreaOffset = 0x00
Set_Attribute
Attr = SETUP_COMPLETE (0x05), Value = TRUE (≠0x00)
ACK
(Anybus State = NW_INIT)
Trace, DeviceNet 40
Doc.Id. HMSI-168-106
W
Control Register
0x80
R
Status Register
0x80
W
Control Register
0x00
R
Status Register
0x00
W
Control Register
0x80
R
Status Register
0xa0
Ask for module type
W
Message Write
0x01, 0x01, 0x01, 0x00, 0x41, 0x00, 0x01, 0x00
Area
W
Control Register
0xc0
R
Status Register
0xa0
R
Message Read
0x01, 0x01, 0x01, 0x00, 0x01, 0x02, 0x01, 0x00,
Area
0x01, 0x04
Map one byte to Read Process Data
W
Message Write
0x02, 0x03, 0x01, 0x00, 0x51, 0x04, 0x01, 0x00,
Area
0x04, 0x01, 0x01, 0x00
W
Control Register
0xc0
R
Status Register
0xa0
W
Control Register
0x00
R
Status Register
0x60
R
Message Read
0x02, 0x03, 0x01, 0x00, 0x11, 0x01, 0x01, 0x00,
Area
0x00
Set Setup Complete
W
Message Write
0x03, 0x01, 0x01, 0x00, 0x42, 0x01, 0x05, 0x00,
Area
0x01
W
Control Register
0xc0
R
Status Register
0xe0
R
Message Read
0x03, 0x01, 0x01, 0x00, 0x02, 0x00, 0x05, 0x00
Area
W
Control Register
0x00
R
Status Register
0x21
W
Control Register
0x80
Destination
Object
R/W DPRAM area
Data
Destination
Object
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Command/
Response
Information
1
Get_Attribute
Attr = VENDOR_ID (0x01)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = DEVICE_TYPE (0x02)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = PRODUCT_CODE (0x03)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = REVISION (0x04)
NAK
Error = UNSUP_OBJ (0x03)
1
1
1
Trace, DeviceNet 41
Doc.Id. HMSI-168-106
R
Status Register
0xa1
W
Control Register
0x00
R
Status Register
0x21
Accept commands from module and send error responses in return (CTLR_R = 1)
W
Control Register
0xa0
R
Status Register
0xe1
R
Message Read
0x06, 0xfc, 0x01, 0x00, 0x41, 0x00, 0x01, 0x00
DeviceNet (0xfc)
Area
W
Message Write
0x06, 0xfc, 0x01, 0x00, 0x81, 0x01, 0x01, 0x00,
Area
0x03
W
Control Register
0x60
R
Status Register
0x21
W
Control Register
0xa0
R
Status Register
0xe1
R
Message Read
0x06, 0xfc, 0x01, 0x00, 0x41, 0x00, 0x02, 0x00
DeviceNet (0xfc)
Area
W
Message Write
0x06, 0xfc, 0x01, 0x00, 0x81, 0x01, 0x02, 0x00,
Area
0x03
W
Control Register
0x60
R
Status Register
0x21
W
Control Register
0xa0
R
Status Register
0xe1
R
Message Read
0x06, 0xfc, 0x01, 0x00, 0x41, 0x00, 0x03, 0x00
DeviceNet (0xfc)
Area
W
Message Write
0x06, 0xfc, 0x01, 0x00, 0x81, 0x01, 0x03, 0x00,
Area
0x03
W
Control Register
0x60
R
Status Register
0x21
W
Control Register
0xa0
R
Status Register
0xe1
R
Message Read
0x06, 0xfc, 0x01, 0x00, 0x41, 0x00, 0x04, 0x00
DeviceNet (0xfc)
Area
W
Message Write
0x06, 0xfc, 0x01, 0x00, 0x81, 0x01, 0x04, 0x00,
Area
0x03
Instance
Anybus CompactCom Tutorial
Doc.Rev. 1.01
R/W DPRAM area
Data
W
R
W
R
R
0x60
0x21
0xa0
0xe1
0x06, 0xfc, 0x01, 0x00, 0x41, 0x00, 0x05, 0x00
W
W
R
W
R
R
W
W
R
W
R
R
W
Doc.Id. HMSI-168-106
W
W
R
0x06, 0xfc, 0x01, 0x00, 0x81, 0x01, 0x05, 0x00,
0x03
0x60
0x21
0xa0
0xe1
0x06, 0xfc, 0x01, 0x00, 0x41, 0x00, 0x06, 0x00
0x06, 0xfc, 0x01, 0x00, 0x81, 0x01, 0x06, 0x00,
0x03
0x60
0x21
0xa0
0xe1
0x06, 0xfc, 0x01, 0x00, 0x41, 0x00, 0x08, 0x00
0x06, 0xfc, 0x01, 0x00, 0x81, 0x01, 0x08, 0x00,
0x03
0x60
0x21
0xa0
0xe1
0x06, 0xfc, 0x01, 0x00, 0x41, 0x00, 0x07, 0x00
0x06, 0xfc, 0x01, 0x00, 0x81, 0x01, 0x07, 0x00,
0x03
0x60
0x21
Instance
Command/
Response
Information
DeviceNet (0xfc)
1
Get_Attribute
Attr = SERIAL_NUMBER (0x05)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = PRODUCT_NAME (0x06)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = CONS_INSTANCE (0x08)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = PROD_INSTANCE (0x07)
NAK
Error = UNSUP_OBJ (0x03)
DeviceNet (0xfc)
DeviceNet (0xfc)
DeviceNet (0xfc)
1
1
1
Trace, DeviceNet 42
W
R
W
R
R
Control Register
Status Register
Control Register
Status Register
Message Read
Area
Message Write
Area
Control Register
Status Register
Control Register
Status Register
Message Read
Area
Message Write
Area
Control Register
Status Register
Control Register
Status Register
Message Read
Area
Message Write
Area
Control Register
Status Register
Control Register
Status Register
Message Read
Area
Message Write
Area
Control Register
Status Register
Destination
Object
Anybus CompactCom Tutorial
Doc.Rev. 1.01
R/W DPRAM area
Data
W
R
R
0xa0
0xe1
0x06, 0xfc, 0x01, 0x00, 0x41, 0x00, 0x09, 0x00
W
W
R
W
R
R
W
W
R
W
R
R
W
W
R
W
R
R
Doc.Id. HMSI-168-106
W
R
W
R
0x06, 0xfc, 0x01, 0x00, 0x81, 0x01, 0x09, 0x00,
0x03
0x60
0x21
0xa0
0xe1
0x06, 0xfc, 0x01, 0x00, 0x41, 0x00, 0x0a, 0x00
0x06, 0xfc, 0x01, 0x00, 0x81, 0x01, 0x0a, 0x00,
0x03
0x60
0x21
0xa0
0xe1
0x06, 0xfc, 0x01, 0x00, 0x41, 0x00, 0x0b, 0x00
0x06, 0xfc, 0x01, 0x00, 0x81, 0x01, 0x0b, 0x00,
0x03
0x60
0x21
0xa0
0xe1
0x06, 0xfc, 0x01, 0x00, 0x41, 0x00, 0x0c, 0x00
0x06, 0xfc, 0x01, 0x00, 0x81, 0x01, 0x0c, 0x00,
0x03
0x60
0x21
0xa0
0xe1
Instance
Command/
Response
Information
DeviceNet (0xfc)
1
Get_Attribute
Attr = ADDRESS_FROM_NET (0x09)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = BAUD_RATE_FROM_NET (0x0a)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = ENABLE_APP_CIP_OBJECTS (0x0b)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = ENABLE_PARAM_OBJECT (0x0c)
NAK
Error = UNSUP_OBJ (0x03)
DeviceNet (0xfc)
DeviceNet (0xfc)
DeviceNet (0xfc)
1
1
1
Trace, DeviceNet 43
W
Control Register
Status Register
Message Read
Area
Message Write
Area
Control Register
Status Register
Control Register
Status Register
Message Read
Area
Message Write
Area
Control Register
Status Register
Control Register
Status Register
Message Read
Area
Message Write
Area
Control Register
Status Register
Control Register
Status Register
Message Read
Area
Message Write
Area
Control Register
Status Register
Control Register
Status Register
Destination
Object
R/W DPRAM area
Data
R
0x06, 0xfc, 0x01, 0x00, 0x41, 0x00, 0x0d, 0x00
Anybus CompactCom Tutorial
Doc.Rev. 1.01
W
W
R
W
R
R
W
W
R
W
R
W
R
Message Read
Area
Message Write
Area
Control Register
Status Register
Control Register
Status Register
Message Read
Area
Message Write
Area
Control Register
Status Register
Control Register
Status Register
Control Register
Status Register
0x06, 0xfc, 0x01, 0x00, 0x81, 0x01, 0x0d, 0x00,
0x03
0x60
0x21
0xa0
0xe1
0x06, 0xff, 0x01, 0x00, 0x41, 0x00, 0x02, 0x00
0x06, 0xff, 0x01, 0x00, 0x81, 0x01, 0x02, 0x00,
0x03
0x60
0x21
0xa0
0xa1
0x20
0x22
Destination
Object
DeviceNet (0xfc)
Application (0xff)
Instance
1
1
Command/
Response
Get_Attribute
Information
Attr = ENABLE_QUICK_CONNECT (0x0d)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = SUP_LANG (0x02)
NAK
Error = UNSUP_OBJ (0x03)
(Anybus State = WAIT_PROCESS)
Trace, DeviceNet 44
Doc.Id. HMSI-168-106
Appendix B
B. Trace, Profibus DP-V1
This appendix holds a transcription of an example communication in parallel mode between a host application and an Anybus CompactCom Profibus DP-V1 module. The Data column contains what is either written to or read from the specified DPRAM area by the host application. See also the Anybus
CompactCom Software Design Guide and the Network Interface Appendix for Profibus DP-V1.
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Doc.Id. HMSI-168-106
R/W DPRAM area
Data
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Instance
Command/
Response
Information
Initial Handshake
Anybus (0x01)
Network (0x03)
Anybus (0x01)
1
1
1
Get_Attribute
Attr = MODULE_TYPE (0x01)
ACK
ModuleType = ABCC (0x0401)
Map_ADI_Read_Area ADI = 0x0001, DataType = UINT8 (0x04), 
NumElements = 0x01, OrderNum = 0x0001
ACK
AreaOffset = 0x00
Set_Attribute
Attr = SETUP_COMPLETE (0x05), Value = TRUE (≠0x00)
ACK
(Anybus State = NW_INIT)
Trace, Profibus DP-V1 46
Doc.Id. HMSI-168-106
W
Control Register 0x80
R
Status Register
0x80
W
Control Register 0x00
R
Status Register
0x00
W
Control Register 0x80
R
Status Register
0xa0
Ask for module type
W
Message Write
0x01, 0x01, 0x01, 0x00, 0x41, 0x00, 0x01, 0x00
Area
W
Control Register 0x40
R
Status Register
0x60
R
Message Read
0x01, 0x01, 0x01, 0x00, 0x01, 0x02, 0x01, 0x00,
Area
0x01, 0x04
Map one byte to Read Process Data
W
Message Write
0x02, 0x03, 0x01, 0x00, 0x51, 0x04, 0x01, 0x00,
Area
0x04, 0x01, 0x01, 0x00
W
Control Register 0xc0
R
Status Register
0xa0
W
Control Register 0x00
R
Status Register
0x60
R
Message Read
0x02, 0x03, 0x01, 0x00, 0x11, 0x01, 0x01, 0x00,
Area
0x00
Set Setup Complete
W
Message Write
0x03, 0x01, 0x01, 0x00, 0x42, 0x01, 0x05, 0x00,
Area
0x01
W
Control Register 0xc0
R
Status Register
0xe0
R
Message Read
0x03, 0x01, 0x01, 0x00, 0x02, 0x00, 0x05, 0x00
Area
W
Control Register 0x00
R
Status Register
0x21
W
Control Register 0x80
Destination Object
R/W DPRAM area
Data
Destination Object
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Command/
Response
Information
1
Get_Attribute
Attr = IDENT_NUMBER (0x01)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = BUFFER_MODE (0x06)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = EXPECTED_CFG_DATA (0x03)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = SIZEOF_ID_REL_DIAG (0x05)
NAK
Error = UNSUP_OBJ (0x03)
1
1
1
Trace, Profibus DP-V1 47
Doc.Id. HMSI-168-106
R
Status Register
0xa1
W
Control Register 0x00
R
Status Register
0x21
Accept commands from module and send error responses in return (CTLR_R = 1)
W
Control Register 0xa0
R
Status Register
0xe1
R
Message Read
0x00, 0xfd, 0x01, 0x00, 0x41, 0x00, 0x01, 0x00
PROFIBUS DP-V1 (0xfd)
Area
W
Message Write
0x00, 0xfd, 0x01, 0x00, 0x81, 0x01, 0x01, 0x00,
Area
0x03
W
Control Register 0x60
R
Status Register
0x21
W
Control Register 0xa0
R
Status Register
0xe1
R
Message Read
0x01, 0xfd, 0x01, 0x00, 0x41, 0x00, 0x06, 0x00
PROFIBUS DP-V1 (0xfd)
Area
W
Message Write
0x01, 0xfd, 0x01, 0x00, 0x81, 0x01, 0x06, 0x00,
Area
0x03
W
Control Register 0x60
R
Status Register
0x21
W
Control Register 0xa0
R
Status Register
0xe1
R
Message Read
0x00, 0xfd, 0x01, 0x00, 0x41, 0x00, 0x03, 0x00
PROFIBUS DP-V1 (0xfd)
Area
W
Message Write
0x00, 0xfd, 0x01, 0x00, 0x81, 0x01, 0x03, 0x00,
Area
0x03
W
Control Register 0x60
R
Status Register
0x21
W
Control Register 0xa0
R
Status Register
0xe1
R
Message Read
0x01, 0xfd, 0x01, 0x00, 0x41, 0x00, 0x05, 0x00
PROFIBUS DP-V1 (0xfd)
Area
W
Message Write
0x01, 0xfd, 0x01, 0x00, 0x81, 0x01, 0x05, 0x00,
Area
0x03
Instance
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Data
Destination Object
Instance
Command/
Response
Information
W
R
W
R
R
0x60
0x21
0xa0
0xe1
0x00, 0xfd, 0x01, 0x00, 0x41, 0x00, 0x07, 0x00
PROFIBUS DP-V1 (0xfd)
1
Get_Attribute
Attr = ALARM_SETTINGS (0x07)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = MANUFACTURER_ID (0x08)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = ORDER_ID (0x09)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = SERIAL_NO (0x0a)
NAK
Error = UNSUP_OBJ (0x03)
W
W
R
W
R
R
W
W
R
W
R
R
W
W
R
W
R
R
Doc.Id. HMSI-168-106
W
W
R
Control Register
Status Register
Control Register
Status Register
Message Read
Area
Message Write
Area
Control Register
Status Register
Control Register
Status Register
Message Read
Area
Message Write
Area
Control Register
Status Register
Control Register
Status Register
Message Read
Area
Message Write
Area
Control Register
Status Register
Control Register
Status Register
Message Read
Area
Message Write
Area
Control Register
Status Register
0x00, 0xfd, 0x01, 0x00, 0x81, 0x01, 0x07, 0x00,
0x03
0x60
0x21
0xa0
0xe1
0x01, 0xfd, 0x01, 0x00, 0x41, 0x00, 0x08, 0x00
0x01, 0xfd, 0x01, 0x00, 0x81, 0x01, 0x08, 0x00,
0x03
0x60
0x21
0xa0
0xe1
0x00, 0xfd, 0x01, 0x00, 0x41, 0x00, 0x09, 0x00
0x00, 0xfd, 0x01, 0x00, 0x81, 0x01, 0x09, 0x00,
0x03
0x60
0x21
0xa0
0xe1
0x01, 0xfd, 0x01, 0x00, 0x41, 0x00, 0x0a, 0x00
0x01, 0xfd, 0x01, 0x00, 0x81, 0x01, 0x0a, 0x00,
0x03
0x60
0x21
PROFIBUS DP-V1 (0xfd)
PROFIBUS DP-V1 (0xfd)
PROFIBUS DP-V1 (0xfd)
1
1
1
Trace, Profibus DP-V1 48
R/W DPRAM area
Anybus CompactCom Tutorial
Doc.Rev. 1.01
Data
Destination Object
Instance
Command/
Response
Information
W
R
R
0xa0
0xe1
0x00, 0xfd, 0x01, 0x00, 0x41, 0x00, 0x0b, 0x00
PROFIBUS DP-V1 (0xfd)
1
Get_Attribute
Attr = HW_REV (0x0b)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = SW_REV (0x0c)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = PROFILE_ID (0x0e)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = PROFILE_SPEC_TYPE (0x0f)
NAK
Error = UNSUP_OBJ (0x03)
W
W
R
W
R
R
W
W
R
W
R
R
W
W
R
W
R
R
W
Doc.Id. HMSI-168-106
W
R
W
R
Control Register
Status Register
Message Read
Area
Message Write
Area
Control Register
Status Register
Control Register
Status Register
Message Read
Area
Message Write
Area
Control Register
Status Register
Control Register
Status Register
Message Read
Area
Message Write
Area
Control Register
Status Register
Control Register
Status Register
Message Read
Area
Message Write
Area
Control Register
Status Register
Control Register
Status Register
0x00, 0xfd, 0x01, 0x00, 0x81, 0x01, 0x0b, 0x00,
0x03
0x60
0x21
0xa0
0xe1
0x01, 0xfd, 0x01, 0x00, 0x41, 0x00, 0x0c, 0x00
0x01, 0xfd, 0x01, 0x00, 0x81, 0x01, 0x0c, 0x00,
0x03
0x60
0x21
0xa0
0xe1
0x00, 0xfd, 0x01, 0x00, 0x41, 0x00, 0x0e, 0x00
0x00, 0xfd, 0x01, 0x00, 0x81, 0x01, 0x0e, 0x00,
0x03
0x60
0x21
0xa0
0xe1
0x01, 0xfd, 0x01, 0x00, 0x41, 0x00, 0x0f, 0x00
0x01, 0xfd, 0x01, 0x00, 0x81, 0x01, 0x0f, 0x00,
0x03
0x60
0x21
0xa0
0xe1
PROFIBUS DP-V1 (0xfd)
PROFIBUS DP-V1 (0xfd)
PROFIBUS DP-V1 (0xfd)
1
1
1
Trace, Profibus DP-V1 49
R/W DPRAM area
R/W DPRAM area
Data
Destination Object
Instance
R
0x00, 0xfd, 0x01, 0x00, 0x41, 0x00, 0x10, 0x00
PROFIBUS DP-V1 (0xfd)
1
Anybus CompactCom Tutorial
Doc.Rev. 1.01
W
W
R
W
R
R
W
W
R
W
R
R
W
W
R
W
R
Message Read
Area
Message Write
Area
Control Register
Status Register
Control Register
Status Register
Message Read
Area
Message Write
Area
Control Register
Status Register
Control Register
Status Register
Message Read
Area
Message Write
Area
Control Register
Status Register
Control Register
Status Register
0x00, 0xfd, 0x01, 0x00, 0x81, 0x01, 0x10, 0x00,
0x03
0x60
0x21
0xa0
0xe1
0x01, 0xfd, 0x01, 0x00, 0x41, 0x00, 0x11, 0x00
0x01, 0xfd, 0x01, 0x00, 0x81, 0x01, 0x11, 0x00,
0x03
0x60
0x21
0xa0
0xe1
0x00, 0xfd, 0x01, 0x00, 0x41, 0x00, 0x12, 0x00
0x00, 0xfd, 0x01, 0x00, 0x81, 0x01, 0x12, 0x00,
0x03
0x60
0x21
0xa0
0xa2
PROFIBUS DP-V1 (0xfd)
PROFIBUS DP-V1 (0xfd)
1
1
Command/
Response
Get_Attribute
Information
Attr = IM_VERSION (0x10)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = IM_SUPPORTED (0x11)
NAK
Error = UNSUP_OBJ (0x03)
Get_Attribute
Attr = IM_HEADER (0x12)
NAK
Error = UNSUP_OBJ (0x03)
(Anybus State = WAIT_PROCESS)
Trace, Profibus DP-V1 50
Doc.Id. HMSI-168-106
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement