Interface, Interface data, Protocol – Baumer N 150 User Manual
Page 5: Checksum (cyclic redundancy check)
N 150
www.baumer.com
5
3. Interface
3.1. Interface data
Type: RS485
Baudrate: 19200
Parity: No
Data bits:
8
Stop bits:
1
Handshake: No
Checksum: 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 N 150 reply.
The operator should see that due to the minimum timeout reply of 1 ms the
bus switching time after having transmitted the last bit must not exceed 1
ms.
Timeout reply*:
1...16 ms
BUS switching time**:
<0,1 ms
** The BUS switching time is the time the SPA requires to be ready again
for transmission receipt after having replied to 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 01h
2
XXh
Adr = address/identifier
00 ... 31dez + 20h Offset (identifier 00 = 20h)
3
XXh
Cmd = command code
Defined commands
4-n
[XXh..XXh]
[Data] = data
20h-7Fh
n+1
04h
EOT = end of transmission Permanent 04h
n+2
XXh
CRC = checksum
00h ... FFh
3.3. Checksum (Cyclic Redundancy Check)
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