Application Note: Crc Examples; Crc Generation - JDS Uniphase SKB Series User Manual

Fiberoptic switch module
Hide thumbs Also See for SKB Series:
Table of Contents

Advertisement

84
Application Notes
SWITCH 1 1 2
Translated into a command packet, the above command is represented as:
OPCODE
LENGTH
0x20
0x03
To transmit via RS-485 to device address 1, the following RS-485 link-layer packet is created. Note
above command packet bytes in payload portion.
SOH
DEST SRC
0x81
0x01
0x00
The master would expect the following acknowledge (ACK) packet to be sent back from device
address 1. Note that the actual number of bytes returned is 4, other bytes (shown as n/a) are for
illustrative purposes.
SOH
DEST SRC
0x81
0x00
0x01

APPLICATION NOTE: CRC Examples

The intent of this application note is to provide detailed information regarding generation of CRC-16
for use with the RS-485 Serial and Enhanced Parallel interfaces.

CRC Generation

In the above example (App Note: RS485 Packet Example), the CRC-16 value 0xF02A is appended
to the end of the link-layer packet prior to actually being transmitted by the master. Because the
CRC is a 16-bit value, bytes are swapped (high byte-low byte) as per the standard command packet
byte-order protocol described "Byte Order" on page 25.
Using the above example, the CRC-value was calculated using the assembled link-layer packet from
the SOH byte (0x81) up-to and including the final PAYLOAD byte (0x02).
The following C-Code fragment illustrates an example of how the CRC is generated.
SWITCH
INPUT
0x01
0x01
TYPE
LEN
0x00
0x05
0x00
TYPE
LEN
0x01
n/a
n/a
n/a
OUTPUT
0x02
PAYLOAD
0x20
0x03
0x01
0x01
PAYLOAD
n/a
n/a
n/a
CRC
0x02
0x2a
0xf0
CRC
n/a
n/a
n/a

Advertisement

Table of Contents
loading

Table of Contents