beautypg.com

Interface, Interface data, Protocol – Baumer N 142 User Manual

Page 6: Redundancy check (crc byte)

background image

N 142

www.baumer.com

6

3. Interface

3.1. Interface data

Type: RS485
Baudrate: 19200
Parity: no
Data bits:

8

Stop bits:

1

Handshake: no
Redundancy check:

yes (CRC)

* To avoid bus collisions a minimum timeout reply of 1 ms (default parameter)

is to be kept, i.e. the time elapsed between transmitting the last bit of the
query until start transmitting the 1st bit of the SPA response.
The operator should see that due to the minimized timeout reply of 1 ms
the bus switching time after having transmitted the last bit must not exceed
1 ms.
The default parameter of 1 ms can optionally be altered by serial interface
in steps of 0,1 ms within the range of 0,1 ... 60 ms. Refer to command „x“
(78h).

Timeout reply*:

0,1...60 ms

BUS switching time**:

<0,1 ms

** The BUS switching time is the time the SPA requires to be ready again for

reception after having replied to the host

3.2. Protocol

The spindle position display operates with ASCII protocol (clear text protocol). Depending on the command, the
protocol data package varies between 5 and 17 bytes.

Byte

Hex-Code

Significance

Parameters

1

01H

SOH = start of heading

permanent on 01h

2

XXh

Adr = address

00...31dez + 20h Offset (address 00 = 20h)

3

XXh

Cmd = command

specific commands

4-n

[XXh..XXh]

[Data] = data

20h-7Fh

n+1

04h

EOT = end of transmission

permanent 04h

n+2

XXh

CRC = cyclic redundancy check

00h...FFh

3.3. Redundancy check (CRC byte)

For optimized error-free data transmission the CRC byte is added after the footer token (EOT, end of
transmission) to the string to be transferred. Upon receiving a command the CRC byte transmitted is
crosschecked with the auto-calculated CRC byte.

Algorithm:
1) Reset CRC byte.
2) Rotate CRC byte by 1 bit to the left.
3) Link result to first data byte XOR.
4) Rotate result by 1 bit to the left.
5) Link result to the second data byte XOR.
:
x) Rotate result by 1 bit to the left.
y) Link result to the last data byte (ever 04H) XOR.
z) Add result as CRC after the footer token (04H) to the transmitted string.

Note:

1101 0000

RL 1010 0001

Important: Bit 7 is shifted in bit 0 during rotation



Example:
String less CRC

= 01h 20h 43h 04h

CRC-Byte

= 0Ah

0000 0000

RL

0000 0000 XOR 0000 0001 (01h)

=

0000 0001

0000 0001

RL

0000 0010 XOR 0010 0000 (20h)

=

0010 0010

0010 0010

RL

0100 0100 XOR 0100 0011 (43h)

=

0000 0111

0000 0111

RL

0000 1110 XOR 0000 0100 (04h)

=

0000 1010

= CRC

Legend: RL = rotate left; XOR = antivalence link