Sie sind auf Seite 1von 10

Serielles Kommunikations- Serial Communication

Protokoll Protocol
für motrona-Geräte for motrona Units

SERPRO2b_de.doc / März 19 / 10 Seiten


Inhaltsverzeichnis: Seite Table of contents: Page

1. Allgemeine Angaben 3 1. General Information 3

2. Geräte- Adressen 3 2. Device Addresses 3

3. Serielle Zugriffs-Codes 3 3. Serial Access Codes 3

4. Anforderung von Daten 4 4. Request for Data 4

5. Schreiben von Daten 5 5. Writing to Registers 5

6. Übertragung von 7 6. Transmission of Control 7


Steuerbefehlen Commands

7. Praktisches Beispiel zur 7 7. Practical example for 7


seriellen Kommunikation communication with
mit motrona-Geräten motrona motion
controllers
7.1 Daten-String 8 7.1 Data string 8
7.2 Bestätigung abwarten 9 7.2 Wait for acknowledgement 9
7.3 Weitere Parameter senden 9 7.3 Transmit more parameters 9
7.4 Daten aktivieren 9 7.4 Activate data 9
7.5 Daten im EEProm speicheren 9 7.5 Save data to EEProm 9

8. Historie 10 8. History 10

2
1. Allgemeine Angaben 1. General Information
Das verwendete Protokoll entspricht dem The units use the LECOM protocol (DIN ISO
LECOM- Standard (DIN ISO 1754), der 1745) which is a common standard with
häufig in der Antriebstechnik verwendet wird. drive applications. Setting of the desired
Die Einstellung der gewünschten Baudrate, Baud rate and the data format as well as the
des Datenformats sowie die pinout of the data connector are clearly
Anschlußbelegung des Datensteckers sind described in the general operating
in der jeweiligen Bedienungsanleitung des instructions of the unit in use.
verwendeten Gerätes beschrieben.

2. Die Geräte - Adressen 2. The Device Addresses


Es sind die Geräteadressen 11 bis 99 vorge- The protocol supports unit addresses
sehen, die dem Gerät entweder über eine between 11 and 99 which can be set either
eingebaute Tastatur oder einen DIL-Schalter by a keypad or a DIL switch or by serial
oder seriell vorgegeben und im EEProm setup. The unit address will be stored in the
abgespeichert werden. EEProm of the unit.
Adressen, die eine "0" enthalten, dürfen Adresses containing a "0" must not be used,
nicht verwendet werden, da diese als because they will be interpreted as a
Gruppen- oder Sammeladresse interpretiert collective address for several units.
werden. Die Generaladresse "00" adressiert The general address "00" will talk to all units
sämtliche angeschlossenen Geräte gleich- connected at this time. Addresses like "10"
zeitig, wäh-rend die Gruppenadresse "10" or "20" will talk to all units from 11 to 19
alle Geräte mit den Nummern 11 bis 19 respectively from 21 to 29 etc.
gleichzeitig anspricht und die Gruppen-
adresse "20" die Geräte Nr. 21 bis 29
adressiert usw.
Wenn die serielle Adresse eines Gerätes Where the serial address of a unit should be
unbekannt ist, kann diese mit der SCAN- unknown, the SCAN function of the
Funktion der zugehörigen motrona- correspondink motrona operator software
Bediener- software ermittelt werden. will help you to find out. Ex factory, all
Werksseitig sind alle motrona-Geräte auf die motrona units are set to default address No.
Adresse "11" eingestellt. "11"

Es ist zu beachten, daß seitens des Gerätes Please note that any response of a unit will
jegliche Antwort oder Rückmeldung unter- be suppressed after access by the general
bleibt, sobald dieses über eine Sammel- address "00" or a collective address like
adresse angesprochen wird. "20".

3. Serielle Zugriffs-Codes 3. Serial Access Codes


(Register Codes) (Register Codes)
Für das Ansprechen der Codestellen in den For serial access to the registers within one
einzelnen Geräten wird entweder die unit the protocol uses either “Standard
„Standard-Adressierung“ oder die Addressing” or “Extended Addressing”,
„Erweiterte Adressierung“ verwendet, je depending on the total number of registers to
nachdem, ob das Gerät nur über wenige be accessed.
oder sehr viele Codestellen verfügt. Die Please see the operating instructions of the
Bedienungsanleitung des entsprechenden corresponding unit to find out the code
Gerätes gibt Auskunft über die Codes und assignments and the mode of register
die Art der Adressierung addressing

Die Erweiterte Register-Adressierung For reasons of clear differentiation,


beginnt zur klaren Unterscheidung grund- Extended register codes are always leaded
sätzlich mit einem Ausrufezeichen. Die by an exclamation mark.
Subcodes S1 und S2 haben grundsätzlich Sub codes S1 and S2 must always be “0”,
den Wert „0“, sofern in der Bedienungs- except other values are explicitly specified in
anleitung des Gerätes nicht ausdrücklich the manual of the unit.
anders angegeben.

3
4. Anforderung von Daten 4. Request for Data
Zum Auslesen von Daten aus dem To read out data from the operational
Arbeitsspeicher ( RAM ) des Gerätes gilt das registers ( RAM ), the subsequent request
folgende Anforderungs-Protokoll: string must be used:

Standard register code

EOT ..... AD1 AD2 C1 C2 ENQ


EOT = Control character Ctrl D ( Hex 04 )
AD1 = Unit address, high byte
AD2 = Unit address, low byte
C1 = Register code, high byte
C2 = Register code, low byte
ENQ = Control character Ctrl E ( Hex 05 )

Extended register code

EOT ..... AD1 AD2 ! C1 C2 C3 C4 S1 S2 ENQ


EOT = Control character Ctrl D ( Hex 04 )
AD1 = Unit address, high byte AD2 = Unit address, low byte
! = Exclamation mark ( Hex 21 )
C1 = Register code, high byte C4 = Register code, low byte
S1 = Sub code, high byte S2 = Sub code, low byte
ENQ = Control character Ctrl E ( Hex 05 )

Die zu verwendenden Register-Codes C1 For the valid register codes C1 and C2,
und C2 sind aus der Parameter- Liste des please refer to the parameter list of the unit
jeweiligen Gerätes zu entnehmen. in use.

Beispiel 1 (Standard-Adressierung): Example 1 (Standard addressing):


Auslesen der Integralgeschwindigkeit "Int- Read the integration speed register "Int-
Time" (Code 03) bei einem BY 150 Time" (register code 03) from a BY 150
Gleichlaufregler mit der Geräteadresse "31" : synchro controller with device address "31"

EOT 3 1 0 3 ENQ
...
hex: 04 33 31 30 33 05

Beispiel 2 (Erweiterte Adressierung): Example 2 (Extended addressing):


Auslesen der aktuellen Bahngeschwindigkeit Read the actual line speed (Code ! 081A)
(Code ! 081A) bei einem MC700-Regler mit from a MC700 motion controller with Winding
Wickler-Firmware WR701 und der Geräte- Firmware WR701 and the unit address “11”
Adresse "11":

EOT 1 1 ! 0 8 1 A 0 0 ENQ
...
hex: 04 31 31 21 30 38 31 41 30 30 05

4
Bitte beachten Sie, dass neben den Ziffern Please note that figures 0-9 and characters
0–9 auch die Zeichen A-F zur Adressierung A-F may be used for register addressing,
verwendet werden können, die mit den where A-F are expressed by hexa-
Hexadezimal-Codes 4.1 bis 4.6 ausgedrückt decimalcodes 4.1 to 4.6.
werden. With a correct unit address and a valid
Bei richtiger Geräteadresse und gültigem register code, the unit responds with one of
Register-Code antwortet das Gerät je nach the subsequent strings (depending on mode
Adressierungs-Art mit einem der folgenden of addressing):
beiden Strings:

BCC BCC

STX C1 C2 XXX ETX BCC STX ! C1 C2 C3 C4 S1 S2 XXX ETX BCC

STX = Control character CTRL B ( Hex 02 ) ETX = Control character CTRL C ( Hex 03 )
XXX = Register data BCC = Block check character

Die Stellenzahl der gesendeten Datenwerte The total number of data characters "XXX"
"XXX" hängt vom jeweiligen Wert des depends on the actual numeric value of the
angewählten Registers ab und kann bei selected data register and may also be
negativen Werten auch ein Minuszeichen leaded by a minus sign with negative values.
enthalten. Vornullen werden grundsätzlich Leading zeros are always supressed and will
unterdrückt und erscheinen nicht im Antwort- not appear in the telegram.
Telegramm. The block check character "BCC" is
Der Block-Check-Character "BCC" ist das generated by an Exclusive-OR over all
Exclusiv-Oder aller gesendeten Zeichen von characters between “C1” resp. “!” and “ETX”
„C1“ bzw. „!“ bis „ETX“ (jeweils ein- (both included)
schließlich).
Wenn in der Anforderung ein ungültiger bzw. If the request string contains an invalid or
unbekannter Datencode (C1-C4 oder S1-S2) unknown register code (C1 – C4 or S1-S2),
gesendet wurde, antwortet das Gerät nur : the response of the unit will just be :

STX C1 C2 EOT STX ! C1 C2 C3 C4 S1 S2 EOT

Wenn sonstige Fehler im Anfrage-Protokoll In case of other errors in the request string,
festgestellt werden, antwortet das Gerät nur the unit just responds by "NAK" (Hex 15)
mit "NAK" ( Hex 15 )

5. Das Schreiben von Daten 5. Writing to Registers


Zur Veränderung von Parametern und For modification of operational or other
Registerdaten durch einen Rechner wird, je register data by a computer, one of the
nach Adressierungsart, eines der nach- subsequent strings must be used, depending
folgenden Sendeprotokolle verwendet: on addressing mode:

BCC
EOT AD1 AD2 STX C1 C2 XXX ETX BCC
...

BCC
EOT AD1 AD2 STX ! C1 C2 C3 C4 S1 S2 XXX ETX BCC
...

EOT = Control character Ctrl D ( Hex 04 )


AD1, AD2 = Unit address, High Byte first
! = Exclamation mark ( Hex 21 )
STX = Control character Ctrl B ( Hex 02 )
C1, C2, C3, C4 = Register code, High byte first
S1, S2 = Subcode, High byte first
XXX = New register data ( ASCII Code )
ETX = Control character Ctrl C ( Hex 03 )
BCC = Block check character

5
Die Länge des Datenstrings "XXX" ist hierbei The data string "XXX" can have any number
beliebig und kann wahlweise auch Vornullen of characters and may also contain leading
und ein negatives Vorzeichen enthalten. zeros or a negative sign.
Der Block-Check-Character "BCC" ist The block check character "BCC" represents
wiederum das Exclusiv- Oder aller again the Exclusive-OR function of all
gesendeten Zeichen zwischen "C1" bzw. „!“ characters between "C1" resp. “!” and "ETX".
und "ETX".
Bei korrekter Übertragung des Protokolls Upon a correct transmission of above
antwortet das Gerät mit "ACK", in allen protocol, the unit will respond by "ACK" and
anderen Fällen mit "NAK". in all other cases by "NAK" .

Die neu übertragenen Daten werden bei With motrona units, all data from a serial
motrona-Geräten zuerst in einem Puffer- transmission will first be latched in a
speicher hinterlegt, greifen also noch buffer register and will not affect the
nicht in die Funktion des Gerätes ein ! current operation, until the command
Erst nach Übertragung des Befehls "Activate Data" has been transmitted.
"Activate Data" werden die neuen Werte This procedure enables the user to
aktiv. Dadurch ist es möglich, bei prepare a complete new set of
laufender Maschine beliebig viele parameters in the background of the unit,
Parameter zu verändern, und dann mit with no effect to the production in
einem einzigen Befehl alle neuen progress, and to activate all at the same
Vorgaben gemeinsam zu aktivieren. time by one single command.

Hinweise zur Speicher-Organisation : Remarks to the Register Organisation


Beim Auslesen von Parametern sendet das Any readout of parameters will read the
Gerät immer nur die aktuellen Daten aus current operational data from the RAM.
dem Arbeitsspeicher ( RAM ). Parameter- Parameters, that have been written to the
werte, die zwar gesendet, aber noch nicht buffer memory only, but have not been
aktiviert wurden, können folglich nicht zu- activated yet, are not readable by serial
rückgelesen werden request.

Nach Netzabschaltung wird automatisch der Upon power up, the unit automatically
Parameter-Satz aus dem EEProm in das transfers the EEProm data to the RAM
RAM geladen. Seriell übertragene Daten register. Previous serial register
sind verloren, wenn sie nicht vor Netzab- modifications will be lost, unless these data
schaltung aktiviert und anschließend im have been activated first and then stored to
EEProm gespeichert wurden. the EEProm.

Serial transmit
Parallel comm. BUFFER Register
Serial receive

"Activate data"

RAM Register
( operational data )

"Store to EEProm"
Power up

EEProm Register
( non-volatile data )

6
6. Übertragung von Steuerbefehlen 6. Transmission of Control Commands

Alle Steuerbefehle benutzen dasselbe Über- All control commands are using the same
tragungsformat wie in Abschnitt 4 gezeigt. transmission protocol like shown in section
Der Datenstring "XXXXX" besteht hier aller- 4. However, the data string "XXXXX" uses
dings nur aus der Ziffer "1" zum Einschalten only one character which is "1" to switch the
und der Ziffer "0" zum Ausschalten von function on and which is "0" to switch the
Steuerkommandos. Einige der Befehle set- function off again. Some of the serial
zen sich unmittelbar nach Aktivierung auto- commands will automatically reset to zero
matisch auf "0" zurück ( z.B. "Activate data" upon execution of the corresponding
oder "Store to EEProm". Andere Befehle commands ( i.e. "Activate data" or "Restore
bleiben statisch erhalten, bis sie über ein er- to EEProm" ). Others will need to be set and
neutes serielles Kommando wieder zurück- also to be reset by serial command ( i.e.
gesetzt werden ( z.B. Reset, Start/Stop, Reset, Start/Stop, Trim etc.)
Trimm usw. )
Bezüglich der seriell aktivierbaren Befehle For applicable command codes, please see
finden Sie alle Angaben in der Bedie- the operating instructions of the unit you use.
nungsanleitung des entsprechenden
Gerätes.
Die serielle Aktivierung eines Steuerbefehls All serial transmission of a control command
hat dieselbe Auswirkung, als wenn der will have the same result as when you set
entsprechende Hardware- Eingang auf the appropriate hardware input to "High".
"High" gelegt wird.

Anmerkung: Important remark:


Hardware- Steuerbefehle und Software- There is a logical "OR" condition
Steuerbefehle arbeiten in einer logischen between all hardware control inputs and
"ODER"-Verknüpfung. Es müssen daher their corresponding serial command
sowohl der Hardware- Eingang als auch flags. For this reason, it is essential to
der zugehörige serielle Befehl have the hardware input and the serial
gleichzeitig auf "0" gesetzt sein, damit command set to OFF at the same time in
der entsprechende Befehl deaktiviert ist. order to switch a command OFF !

Wenn z.B. seriell der Reset-Befehl auf "1" If, i.e. by serial communication, the Reset flag
gesetzt wurde, ist das Gerät im Reset- has been set to "1", the unit will be in it's
Zustand, unabhängig davon ob der Reset state, independant of what the logical
entsprechende Hardware- Eingang High oder level at the hardware reset input is. Only with
Low ist. Erst wenn seriell das Reset- the serial reset flag at "0" and the reset input
Kommando auf "0" zurückgesetzt wurde, ist at "Low", the unit will be in it's normal
der Hardware- Reset wieder voll operative state !
funktionsfähig ! Upon power up, all serial command flags will
Bei Netzzuschaltung werden alle seriellen automatically be reset to "0" .
Befehle automatisch auf "0" gesetzt.

7. Praktisches Beispiel zur seriellen 7. Paractical example for communi-


Kommunikation mit motrona-Geräten cation with motrona motion
controllers

Das nachfolgende Beispiel zeigt, wie der The following example describes how to
Parameter „Factor1“ bei einem BY125- transmit a new “Factor1” setting to a BY125
Gleichlaufregler verändert wird. synchro controller.
BY125 benutzt die Standard-Adressierung BY125 uses standard addressing for register
für die seriellen Codestellen. Bei Geräten mit access. Where you use a unit with extended
erweiterter Adressierung gilt das unten- addressing, the subsequent example is fully
stehende Beispiel ebenso, bis auf die valid,too, except of the extended version of
erweiterte Darstellung der Codestellen mit address codes and sub codes.
den Subcodes.

7
Im Beispiel benutzen wir ein BY125-Gerät The example uses a BY125 controller with
mit der Geräteadresse „11“. Dem Para- serial unit address “11”. According to the
meter „Factor1“ ist laut Gerätebeschreibung manual, register “Factor1” uses the serial
die serielle Codestelle „00“ zugeordnet. Wir access code “00”. The example shows how
wollen Factor1 auf den Wert „0.9873“ to set the register to a value of “0.9873”
setzen.

7.1 Zuerst senden wir den Daten-String 7.1 First, we transmit the data string
bestehend aus insgesamt 13 ASCII-Zeichen: consisting of totally 13 ASCII characters:

No. Expression ASCII Hex Binary code Comment


Hi-------- --------Lo
01 EOT EOT 04 0000 0100 Control character Initialisation
02 AD1 1 31 0011 0001 Address, high byte
03 AD2 1 31 0011 0001 Address, low byte
04 STX STX 02 0000 0010 Control character
05 C1 0 30 0011 0000 Register code high byte
06 C2 0 30 0011 0000 Register code low byte
07 X (Data) 0 30 0011 0000 Factor, highest digit
08 X (Data) 9 39 0011 1001
09 X (Data) 8 38 0011 1000
10 X (Data) 7 37 0011 0111
11 X (Data) 3 33 0011 0011 Factor, lowest digit
12 ETX ETX 03 0000 0011 Control character
13 BCC 6 36 0011 0110 Block check character

Die Zeichen mit grauem Hintergrund werden Characters with gray background are used
mittels Exclusiv-Oder zur Bildung des to form the block check character by an
Block-Check-Characters benutzt. Betrachten exclusive- OR function. Consider each of
Sie bitte hierzu im Feld „Binary Code“ die 8 the 8 columns in the binary code field
Spalten (nur den grau unterlegten Bereich). (only gray rows).In the high bit column we
In der höchstwertigen Spalte ganz links find all zeros, therefore the exclusive OR is 0
finden wir ausschliesslich Nullen. Das and the high bit of the block check character
Exclusiv-Oder und damit das entsprechende must be zero at this position.
Bit des BCC ist daher ebenfalls 0.

In der kleinstwertigen Spalte ganz rechts In the low bit column we find 0-0-0-1-0-1-1-1
finden wir die Bitfolge 0-0-0-1-0-1-1-1 (von (from up to down) and the exclusive OR is
oben nach unten). Das Exclusiv-Oder und also „0“. Therefore the low bit of the block
damit das entsprechende Bit des BCC ist check character must be „0“ again at this
daher ebenfalls 0. In der Spalte links neben position. In the column left of the lowest bit,
dem kleinsten Bit ergibt die EX-OR-Funktion the X-OR function results in a „1“ etc.
den Wert 1

Allgemein gilt: Bei einer geradzahligen In general we can say: when in one column
Anzahl von „1“ in einer Spalte ist das BCC- we find an even number of „1“, the block
Bit an dieser Stelle „0“. Bei einer check bit must be „0“ at this position. When
ungeradzahligen Anzahl von „1“ in einer we find an odd number of „1“, the block
Spalte ist das BCC-Bit an dieser Stelle „1“ check bit must be „1“ at this position

Wenn wir nun die resultierenden Bits des So we find with our example, that the 8 Bits
BCC in einer Reihe lesen, ergibt sich damit of the block check character, read as a row,
die Binärzahl are
0-0-1-1-0-1-1-0 0-0-1-1-0-1-1-0

as dem Hexadezimal-Code „36“ oder dem which equals to the Hexadecimal code “36”
ASCII-Zeichen „6“ entspricht. or to the ASCII character of „6“.

8
7.2 Bestätigung abwarten 7.2 Wait for acknowledgement
Bei korrekter Übertragung wird das Gerät After correct transmission, the unit will
mit dem Bestätigungs-Zeichen “ACK” acknowledge by responding “ACK” (Hex
antworten (Hex „06“, binär 0000 0110). Falls “06” or binary 0000 0110).
das Gerät stattdessen mit „NAK“ antwortet Where the unit instead should respond
(Hex „15“), wurde die Sendung wegen eines “NAK” (Hex “15”), the transmission was
Fehlers nicht akzeptiert (z.B. falscher BCC rejected due to a fault like wrong BCC or
oder nicht korrekte Folge der Zeichen) incorrect sequence of characters etc.

Falls das Gerät überhaupt nicht antwortet, Where the unit does not respond at all, this
war entweder der gesendete String indicates an uncomplete transmission string
unvollständig, oder serielle Grundein- or wrong basic serial settings like Baud rate,
stellungen wie Baudrate, Datenformat usw. Data format etc.
sind nicht korrekt.

7.3 Weitere Parameter senden 7.3 Transmit more parameters


Wir können nun bei Bedarf eine beliebige We are free now to transmit any number of
Anzahl weiterer Parameter übertragen, ohne more parameters if necessary, without any
damit den Maschinenablauf zu beeinflussen. effect to the function of the machine.

7.4 Daten aktivieren 7.4 Activate data


Wenn alle Parameter übertragen sind, After successful transmission of all
können wir die neuen Werte aktivieren, parameters we must activate the new
womit diese sofort im Maschinenablauf settings, to make them effective to the
wirksam werden. Bei BY125 heisst dies, operation of the machine. With BY125 units,
dass wir auf die Codestelle „67“ (C1 = 6 und we need to write a “1” into the register with
C2 = 7) den Wert „1“ schreiben müssen. code “67” (C1 = 6 and C2 = 7

No. Expression ASCII Hex Binary code Comment


Hi--------------------Lo
01 EOT EOT 04 0000 0100 Control character Initialisation
02 AD1 1 31 0011 0001 Address, high byte
03 AD2 1 31 0011 0001 Address, low byte
04 STX STX 02 0000 0010 Control character
05 C1 6 36 0011 0110 Register code high byte
06 C2 7 37 0011 0111 Register code low byte
07 X (Data) 1 31 0011 0001 Activate command „ON“
08 ETX ETX 03 0000 0011 Control character
09 BCC 3 33 0011 0011 Block check character

7.5 Daten im EEProm speichern 7.5 Save data to EEProm


(nur bei Bedarf) (option only)
Ohne Übertragung eines “Store”-Befehls Without sending this command, the
wird das Gerät die zuletzt gesendeten und controller will use all data which have been
aktivierten Daten bis zur nächsten transmitted and activated, until the unit will
Unterbrechung der Stromversorgung nutzen. be powered down.
Nach erneuter Zuschaltung der Strom- At next power up, the unit however will
versorgung werden jedoch wieder die Daten restart with data loaded from it’s EEprom.
aus dem EEProm hochgeladen. The serial register code for the „Store“
Der serielle Code für den Speicherbefehl ist command is “68” (C1 = 6, C2 = 8), and again
„68“ (C1 = 6, C2 = 8), und wiederum muss the data string XXX must just be one digit
diese Codestelle mit dem Wert „1“ with the value of “1”.
beschrieben werden.

9
Hinweis: Hint:
Die Lebensdauer bei EEProms ist auf ca. The life time of EEProm memory chips is
100 000 Speicherzyklen beschränkt, limited to a total number of about
danach ist eine sichere Speicherung 100 000 storage cycles. After this, stored
nicht mehr gewährleistet!. data may get lost.

8. Historie 8. History of Modifications

Version Name: Date: Modifications:


Serpro01a hk -- Original Version
Serpro02a hk 07.04.2004 Extended register code addressing

10

Das könnte Ihnen auch gefallen