Protocol Specification
Book 2 of 2
Impact Part Number 42-0104-00 Rev A:
Prepared By: Ed Chapman
Date: 28 October, 1990
Revised: 2 November, 1992
Project: #67817
PVCS y:ed/siemens
build siemens
This specification was written from the work done with Siemens and some translation from the "Siemens Anschaltbaugruppe 6 DS 1318 8XB (-8AB)" specification. Its intention is to give some reliable information for trouble shooting and additions to the Siemens protocol.
This specification describes the protocol to be used between Impact actuators and the Siemens Teleperm M(AS 230) System.
The Siemens system, although flexible at the application level, cannot be modified at the lower communication levels. Therefore, Impact utilizes the complete usage of Siemens communication module for full implementation.
Because the AS 230 uses a polling method, to communicate with their communication module, a special technique has been adopted to insure integrity at the network layer.
Speed Of The Communication Link
The speed of the communication link can be 4800 or 9600 Baud. The Siemens specification calls out lower Baud rates, but these should not be attempted due to the involved handshaking at the network level.
The link between Siemens and Impact will be based on a 20ma current loop.
Maximum Distance
The maximum distance between the communication systems are given below:
4800 Baud = 500 meters
9600 Baud = 300 meters
The Siemens side will source current at their transmitter side. Impact will source current at their transmitter side.
The cable used to connect the Siemens with Impact will be supplied as a 4 wire cable of standard S5-type.
Full duplex
With no transmission, current is present on the cable (corresponds to a logical 1). Each character being transmitted begins with a start bit and ends with one stop bit. The number of information bits is 8. Each character is secured with a parity bit (even parity).
As referenced, the following word organization is determined:
When transmission takes place, the order of the bytes will be as follows:
1. Most significant Byte
2. Least significant Byte
Within the MSB bit 8 and within the LSB bit 0 will appear first on the cable.
Reception: When Siemens is receiving data, it expects data in the same order as described under transmission.
Where the physical link consists of the cable and associated hardware. Protocol consists of a predetermined set of programming rules for the interpreting signals transmitted.
The Siemens to Impact network operates in the following manner.
Point to point link
Master/slave communication through a full-duplex, polled protocol.
Data Transparency
In the full duplex mode, data transparency resemble ANSI X3.28-1976 specification.
Full duplex protocol is a byte oriented protocol that uses the following ASCII control character set. See ANSI X3.4, CCITT V.3 or ISO 646 for the standard definitions.
STX (start of text) 02 ETX (end of text) 03 DLE (data link 10 escape) NAK (negative 15 acknowledge)
STX -- poll the line to become the master
DLE -- signals that the receiver has relinquished control of the line to the sender of the STX
DLE DLE -- encodes the value 10 hex in the network packet. This is necessary to distinguish a text code of 10 hex from a DLE control code of 10 hex.
DLE ETX BCC -- terminates a message packet.
NAK -- signals the receiver did not successfully receive the last message sent.
DLE -- signals that the receiver has successfully received the last message sent.
The protocol 3964R is a standard Siemens data communication protocol; it is a subordinate transport-mechanism with response messages. 3964R is a half duplex protocol utilizing a full duplex line; the protocol is symmetrical.
A connection consists of three phases:
Connection establishment
Data transfer
Termination (release)
When the line is considered up for bid, the side wishing to send a message will transmit the byte STX. The intended receiver will then respond within 550 msec with a DLE byte. The sender switches to the transmitter mode; the intended receiver switches to the receiver mode. The message is then sent across the network. Else if the receiver answers with:
NAK
Any other character except a DLE
A distorted character
Or if a time-out occurs(no response within 550 msec), the attempt to establish connection is aborted and no message is sent.
If the attempt to establish the connection succeeds, the message packet is transferred. The receiver expects to see characters within 220 msec; otherwise, it will send a NAK. After the packet arrives, the receiver will either send a DLE, if the message was without errors, or a NAK, if transmission errors occurred.
If the receiver sends a DLE within 550 msec, the transmitter assumes the message has been sent without errors and will delete it from its output que. If a NAK is received, the transmitter will re-establish the connection and re-send the message.
After 5 unsuccessful attempts to transmit a message packet, the transmitter will drop the current message and alarm its application layer for appropriate action.
If the computer link driver is inactive, the transmitter is disabled and the receiver waits for a connection to be established.
If the driver is ready for reception and the STX character is received, DLE is transmitted and the driver is switched to the receiver mode. Any characters to follow are then stored in the input buffer - except that 2 DLE(s) are stored as 1 DLE if they are concurrent DLEs.
The end of the packet is marked with a DLE/ETX. Once the packet end is detected by the receiver, 1 byte will follow: BCC. If the BCC results in a DLE as a nature check sum, the BCC still remains 1 byte; the BCC is never padded with a DLE as a transparent character.
Once the receiver detects a complete packet, it will respond with either a DLE, meaning no errors, or a NAK, meaning transmission error were received.
If the intended receiver is not ready to receive a packet when a STX arrives or if the transmitter sent a falsified STX, the driver transmits a NAK.
If while receiving a line break should occur, or if the character delay time (220 msec) is exceeded, or the input buffer overflows. The receiver driver aborts; sends a NAK.
If a transmission error occurs while receiving, for example parity, the reception is not aborted. After the DLE/ETX/BCC, the block is negatively acknowledged by a NAK.
When Siemens is receiving, the following transmission errors will be detected:
Uart Parity Error
Uart Overrun Error
Uart Framing Error
If the Siemens' system and Impact simultaneously attempt to initiate transmission of packet with STX connection establishments, Impact will back off. Impact will renounce its bid for line control and give control to Siemens by means of an DLE. Impact will then back off for a random number of msec after Siemens has carried out its packet transfer and tries to re-establish the control of the line.
The priority is, in this example, set for the Siemens side to be the master of the network.
The BCC will be a XOR of all the bytes, excluding the STX used to establish the line control. It will be inclusive of all the characters sent after the sender has been placed in the transmit mode and continues to the ETX. All double DLE(s) are included into the BCC. The BCC is always 1 byte, regardless of what it is, and it will always follow the DLE/ETX.
The link level between the Siemens and Impact is implemented with the 3964R[1] protocol. This is subordinated protocol with response messages (transport level). The transport level gives the following possibilities:
Siemens sending data to Impact
Siemens requesting data from Impact
It should be noted at this time, Impact can never send information not requested by Siemens as a independent message packet. A way to resolve this problem will be mentioned later, and it will be programmed at the application level of Siemens.
Message Header + Data -------> Impact
Siemens <------- Response MSG
Message Header --------> Impact
Siemens <------ Response Message + Data
In the case of error, only the response message is returned from the Impact system. The T[r] is set to 5 seconds(standard).
When the Siemens system sends any message to Impact, it will contain the following 10 byte header.
This is the message id. This id can be any number from 0 through FFFF. The meaning of this 16 bit word is this: Siemens sent out any message with a given id; when Impact returns the message response, it must fix this id in the appropriate place in the response message. In this way, Siemens can keep track of all the message updates and queries it has outstanding when they return back from Impact.
This byte if 'A' indicates the information being sent is analog data. In this case, Siemens is sending data to the Impact system.
If this byte equals 'E', then Siemens is either requesting network status or engineering units(or status).
This byte is used to describe if Siemens is requesting network data or engineering unit data. If this byte is 'D', Siemens is requesting engineering unit data. If this byte is a 'S', Siemens is requesting network data.
Note:
Network data refers to the status of the Siemens network and should not be confused with Impact's CD Net.
This is the address buffer where the data exchange is to take place. This variable can be a binary number from 0 through 255.
This is a 0 index, it is used to describe where the information is to be stored into that buffer. This index is a word indexed, not byte indexed. In the case of a Floating point exchange, this number will be multiplied by 2.
This is the count of information being exchanged. In the case of floating point, this number is multiplied by 2.
This is the an unused byte, it can be anything and has no purpose.
This is the coordination flag; it was meant to describe the type of data being exchanged, but it does not work and should be ignored.
These bytes are reserved for data when Siemens is updating information. All or any part of this area can be filled when data is being transferred.
These bytes are the DLE/ETX/BCC; they come directly after the message body in an update and directly after the 10th byte in a request.
As mentioned above, the MSG ID is the first 2 bytes of the telegram packet. They must be recorded and assigned to the first 2 bytes of the reply message. An accurate account of the id(s) must be maintained and returned so Siemens can digest the response message.
If communication with Impact is lost or activity across the network halts, a test message is sent by Siemens. This message looks as follows.
ID of message
Meaning is unknown to me
Meaning is unknown to me
Meaning is unknown to me
Meaning is unknown to me
Meaning is unknown to me
Meaning is unknown to me
Meaning is unknown to me
Meaning is unknown to me
No further communication from Siemens will take place until the correct response for this message is transmitted to Siemens.
All telegram packets sent to Impact require a response message reply.
All response message replies will contain for the first 2 bytes the ID number received.
For example: The test message send an ID of 00 00, then the first 2 bytes of the response of the test message needs to be 00 00.
The next 2 bytes are a little strange. They are the error code. If anything was wrong with the message sent to Impact invoking the response message, these 2 bytes need to be filled out appropriately. If every thing was OK, then make these 2 bytes a 0. Now what do you put in these 2 bytes if a non OK condition occurs; I do not know, just make them a non 0.
Response To Test Message
The ID of the test message sent to Impact.
The error code, make it a 00 00 and Siemens will not complain.
Make them anything you would like. I used the letters 'F' 'O'.
DLE/ETX/BCC
The ID of the update message sent to Impact.
The error code, make it 00 00 and Siemens will not complain.
DLE/ETX/BCC
The ID of the request message sent to Impact.
The error code, make it 00 00 and Siemens will not complain.
Data can be 128 bytes long without the padded DLE(s) if necessary.
DLE/ETX/BCC
Because of the physical size of the data portion on the message, only 128 bytes, 64 words, or 32 floats, can be transferred in 1 message packet.
Blocking will occur at the Siemens end if more than 128 physical byte limitation is exceeded. If a profile of 128 floating point elements are to be updated, Siemens will split them up into 32 element arrays. In addition, if Siemens requests information, they will ask for it in the maximum of 32 element arrays, if necessary(if float are used), or 64 if integer is used.
Siemens expects to see types of data in specific data buffers. If Siemens writes set points in floats, it expects to see them, if requested, as floats. Therefore, the following data buffers have been assigned to certain variables. See byte 5 of message header for buffer meaning.
Part or the structure for setting up this link requires the AS230 to down load all the setup data pertaining to it's buffer on a known buffer. The following describes how to setup the setup data buffer.
First the AS230 user must pick an unused Siemens buffer number; this will be typed as the setup data buffer. Once the setup data buffer number is known, it must be entered via Impact setup data either through Impact setup data for this CD NET II node.
Example: setup buffer number will be set to 1.
Within the AS230's buffer 1, the contents, or road map to where everything within Impact's CD Net will be kept. The AS230 user is responsible for keeping and maintaining an accurate list for Impact.
The example used for this installation will be moisture, with Siemens in control. The Impact actuator will have direct control over 2 IR profilers: one at the size press and one at the reel. Each profiler will have 24 zones, and the AS230 will be controlling both profilers.
Buffer #1 or the setup buffer should be setup as follows:
Note: Selection of the setup buffer number is up to the Siemens: must be between 0 through 255. All maps, indices, and classes for other buffers are contained within this designated buffer.
Buffer is a integer 16 bit word array
Element Data Description
Profiler 1 power
0 00 Impact network id auto IR zone power
1 40 Siemens buffer for profiler 1
2 00 Data path or CD Net II PATH
3 00 Index into Impact mega array
4 24 24 zones in profile 1
5 12 Type and class(TYPE_DATA) Profiler 2 power
Profiler 2 power
6 00 Impact network id auto IR zone power
7 50 Siemens buffer for profiler 2
8 00 Data path or CD Net II PATH
9 24 Index into Impact mega array
10 24 24 zones in profile 2
11 12 Type and class(TYPE_DATA) Buffer 40
Profile 1 zone status
12 01 Network id for zone status
13 43 Siemens buffer for zone status profile 1
14 00 Data path or CD Net II PATH
15 00 Index into Impact mega Array
16 24 24 zones in profile 1
17 14 Duplicate 16 bit structure
Profile 2 zone status
12 01 Network id for zone status
13 53 Siemens buffer for zone status profile 2
14 00 Data path or CD Net II PATH
15 24 Index into Impact mega Array
16 24 24 zones in profile 2
17 14 Duplicate 16 bit structure
18 -1 or 0xffff MINUS 1 to terminate setup buffer
The setup data structure for buffer designated:
typedef Structure {
int net_id; /* impact network id See Network
Documentation, Author Mark Greening */
int siemens_buffer; /* siemens buffer id, where Siemens
data is stored, picked by the
Siemens operator */
int data_path; /* impact data path, Impact Data path
number, selected by Impact
operator, usually default at 0
*/
int mega_index; /* index into the mega selected by
Impact operator, See Network
documentation,
Author: Mark Greening */
int mega_count; /* max count assigned to mega array
selected by
Impact operator, See Network
documentation,
Author: Mark Greening */
int type_data; /* 14 structure, duplicate
04 structure, original
12 float, duplicate
02 float, original
11 integer, duplicate
01 integer, original
10 char, duplicate
00 char, original
See Network documentation
on ORIGINAL, DUPLICATE
meaning */
} SETUP_BUFFER;
The setup buffer selected should look:
Buffer[number of items selected] =
{ SETUP_BUFFER, SETUP_BUFFER,..., 0xff }
This setup buffer or buffer 1 can be send on a time interval or just 1 time, or any time anything has changed. The effect of sending this buffer to Impact will install Id(s of information for availability within the Siemens CD Net II link interface. This must be sent before any communication transfers can take place on any of the information buffer exchanges. Impact link will detect a change within the setup buffer each time it is sent to verify changes; the AS230 operator must not multiplex different setup items each time the setup buffer is sent to expand the length. Each time the setup buffer changes, this causes the Impact system to remove and re-install new network definition tables and a multiplexer scheme could prove disastrous. The buffer is 256 words elements long and this provides for 42 exchange buffers with a terminator, or (256 / 6); that should be plenty for a 9600 Baud link.
The DATA_TYPE or 16 bit representation of what exchange buffer will be casted as.
0 = chars or BYTES
1 = 16 bit integers
2 = floats or Siemens REAL values
3 = is unused if it could it would be doubles
4 = is structure, which must be assigned to zone status
Adding a 10 to each type defines weather to assign golden copies to the Siemens Link interface PCB.
Example: float data, with MAC board having Golden copies 12.
int data, with MAC board having Golden copies 11.
int data, with Siemens Link having the Golden copies 1.
Structure Data or zone status, with MAC having the golden copies 14.
The power set points do not need to be floating point data since our actuator has resolution only to the nearest percent. The Siemens user should be advised to set the TYPE_DATA to 11 or integer MAC with golden copies for zone power. No mixed modes per any given Impact Network ID is allowed. Example: If power profile ID was declared as a FLOAT it must not be declared as an INT anywhere else in the setup data structure.
Moisture 1 power, 0 through 255 floating point array.
Not assigned
Moisture 1 status array, 0 through 255 integer array. 16 bit array for 0 to n Where
0000000000000001 failed Impact Zone
0000000000000010 zone disabled in hardware
0000000000000100 failed sub-component
0000000000001000 open circuit
0000000000010000 short circuit
0000000000100000 hardware manual
0000000001000000 no line sync to zuc
0000000010000000 receiver zuc failed
0000000100000000 configure status
0000001000000000 set point invalid
16 Bit unsigned or signed Integers
All 16 bit values, including values in the header, need to be byte swapped from Intel. Siemens send MSB then LSB for 16 bit values. They also need to be swapped when transmitted back to Siemens.
All floats contain the following 2 (16 bit) words. Each 16 bit word needs to be swapped and also byte swap as they are considered 2 (16 bit) unsigned ints. Then the following represents the conversion to and from IEEE. It should be noted; before entering siemens_to_ieee, the entire array must be byte swapped, and after leaving ieee_to_siemens, the entire array needs to be byte swapped.
MSB, LSB , of MSW
MSB, LSB, of LSW
{
register unsigned temp_0, temp_1;
unsigned remainder, exponent, sign;
temp_0 = t[0];
temp_1 = t[1];
/* protect against 0 */
if (
(temp_0 == 0x8000 && temp_1 == 0) ||
(temp_0 == 0x0000 && temp_1 == 0x0000)
)
{
t[0] = 0;
}
/* else do conversion */
else
{
exponent = (((temp_0 >> 8) - 0x82) & 0xff) << 7;
if ((temp_0 & 0x0080) == 0x0080 )
{
sign = 0x8000;
temp_1 ^= 0xffff;
temp_0 ^= 0x007f;
}
else
{
sign = 0x000;
}
remainder = (temp_1 & 0x8000) == 0x8000 ? 1 : 0;
t[0] = temp_1 << 1;
t[1] = (
(((temp_0 << 1) & 0x007f) | remainder)
exponent) | sign;
}
}
{
register unsigned temp_0, temp_1;
unsigned exponent, sign;
temp_0 = t[0];
temp_1 = t[1];
/* protect against 0 */
if (temp_0 == 0 && temp_1 == 0)
{
;
}
/* else do conversion */
else
{
sign = (temp_1 & 0x8000) == 0x8000 ? 0x80 : 0;
temp_1 &= 0x7fff;
exponent = (((temp_1 >> 7) + 0x82) & 0xff) << 8;
temp_0 =
(temp_0 >>= 1) | (((temp_1 & 0x0001) == 0x0001) ?
0x8000 : 0x0000);
temp_1=
((((temp_1 >> 1) & 0x003f) | 0x0040) | exponent)
| sign;
if (sign == 0x80 )
{
temp_0 ^= 0xffff;
temp_1 ^= 0x007f;
}
}
t[0] = temp_1;
t[1] = temp_0;
}
Example
.25153 Real = Siemens 0xff40 MSW
0x6445 LSW
.01878 Real = Siemens 0xfb4c MSW
0xec42 LSW
When cases of host sending:
Caliper Profiles
Moisture Profiles
Basis Weight Profiles
Pay strict attention to sending M_SLICES for moisture, C_SLICES for caliper, or B_SLICES prior to sending the engineering profile.
For examples Caliper with the number of databoxes 128:
C_SLICES of 1 to 128
then M_PROFILE array
This is necessary because the actual profile takes 4 individual transmission to complete the entire profile. By sending C_SLICES prior to sending the profile, the controller will await the entire 1 through 128 data boxes before attempting control action.
Note: This is only necessary when sending engineering unit profiles such as Basis Weight array, Moisture array, or Caliper array.
Name ID
C_MAX_ZONES 144 /* maximum zones for caliper
control */
C_MAX_SLICES 512 /* maximum slices for caliper
control */
C_MAX_PROFILERS 8 /* maximum profilers for caliper
control */
W_MAX_ZONES 108 /* maximum zones for weight
control */
W_MAX_SLICES 512 /* maximim slices for weight
control */
W_MAX_PROFILERS 8 /* maximum profilers for weight
control */
M_MAX_ZONES 480 /* maximum zones for moisture
control */
M_MAX_SLICES 512 /* maximim slices for moisture
control */
M_MAX_PROFILERS 8 /* maximum profilers for moisture
control */
MAX_GRADE_ID 40 /* maximum grade id string length
plus null*/
MAX_CABINETS 16 /* maximum cabinets */
MAX_PROFILERS 8 /* maximum possible profilers */
MAX_ZONES 480 /* maximum zones */
MAX_CONTROL_GRPS 8 /* maximum control groups */
MAX_SCANNERS 8 /* maximum scanners */
MAX_DATA_BOX 512 /* maximum data boxes */
m_SETPOINTS 0 /* moisture computer generated
setpoints */
m_ZONE_STATUS 1 /* moisture zone status */
m_OP_SETPOINTS 3 /* moisture operator generated
setpoints */
m_ACTUATOR_STATUS 4 /* moisture actuator status */
m_MANUAL_STATUS 5 /* moisture auto/manual status */
m_CURRENT_POWER 6 /* moisture current power */
m_RESTORE_PROFILERS 10 /* moisture restore profilers */
m_LOCAL_STATUS 102 /* moisture local/remote status */
m_CG_LOCAL_STATUS 202 /* moisture local/remote status */
m_SLICES 10000 /* moisture expected start & end
slices */
m_PROFILE 10001 /* moisture profile */
m_PROFILE_BY_ZONE 10003 /* moisture profile by zone */
m_TARGET_PROFILE 10008 /* mositure target profile (bias)
*/
m_CONTROL_MODE 10020 /* moisture control mode */
m_BASE_POWER 10021 /* moisture base power (minimum
load) */
m_TARGET 10022 /* moisture target */
m_AVG_LOAD 10023 /* moisture average load */
m_LAST_SCAN_AVG 10024 /* moisture last scan average */
c_ACTUATOR_STATUS 1003 /* caliper actuator status */
c_ZONE_STATUS 1004 /* caliper zone status */
c_MANUAL_STATUS 1005 /* caliper auto/manual status */
c_LOCAL_STATUS 1006 /* caliper local/remote status */
c_SETPOINTS 1007 /* caliper computer generated
setpoints */
c_OP_SETPOINTS 1008 /* caliper operator generated
setpoints */
c_SLICES 11000 /* caliper expected start & end
slices */
c_PROFILE 11001 /* caliper profile */
c_PROFILE_BY_ZONE 11003 /* caliper profile by zone */
c_CURRENT_CONST 11005 /* caliper current constants */
c_TARGET_PROFILE 11008 /* caliper target profile (bias) */
c_2SIGMA_DEVIATION 11011 /* caliper profile 2 sigma
deviation */
c_PROFILE_AVERAGE 11016 /* caliper profile average */
c_PROFILE_HIGH_VAL 11017 /* caliper profile high value */
c_PROFILE_LOW_VALUE 11018 /* caliper profile low value */
c_TARGET 11022 /* caliper md_target */
w_ACTUATOR_STATUS 2002 /* weight actuator status */
w_ZONE_STATUS 2003 /* weight status */
w_MANUAL_STATUS 2004 /* weight auto/manual status */
w_LOCAL_STATUS 2005 /* weight local/remote status */
w_SETPOINTS 2006 /* weight computer generated
setpoints */
w_OP_SETPOINTS 2007 /* weight operator generated
setpoints */
REEL_SPEED 2008 /* reel speed */
w_DEADBAND 2017 /* dead band */
w_AB_SETPOINTS 2018 /* absolute setpoints */
w_SLICES 12000 /* weight expected start & end
slices */
w_PROFILE 12001 /* weight profile */
w_PROFILE_BY_ZONE 12003 /* dry weight profile at slice rod
*/
w_TARGET_PROFILE 12008 /* weight target profile */
GRADE_ID 12023 /* grade id */
w_TARGET 12024 /* weight md_target */
WIRE_SPEED 12025 /* wire speed */
TIME_OF_DAY 30111 /* time of day as per type 1 link*/