User Manual BDS4621

1.2. Send Command

1.1.2. Introduction

Command packets consist of "Header" and "Payload". The Packet Header is consistent for all packets. The Packet Payload type and content varies based on the type of packet sent. The entire packet size is variable, being the sum of the fixed-size Packet Header and variable-sized Packet Payload.

Packet Header (fixed size)

Packet Payload (variable size)

Table 4

Packet Header Format

Introduction

All Packets use the same Packet Header format illustrated in Table 5.

Byte 0

1

2

3

 

 

4

 

5

 

6

 

 

Magic Number

 

Type

Packet Payload Size

 

 

CRC

 

 

0xBE

0xEF

type

size_lo

 

size_hi

 

crc_lo

 

crc_hi

 

 

 

 

Table 5

 

 

 

 

 

 

 

 

 

 

 

 

The Packet Header size is fixed at seven bytes

 

 

 

(Intel byte ordering is used). The following code

 

 

 

fragments are taken from these source files

 

 

 

The Packet Header definition is shown below:

 

 

 

typedef

struct

 

 

 

 

 

 

 

 

{

 

 

 

 

 

 

 

 

 

 

 

 

 

BYTE

ePacketType;//type

of

the

 

 

 

 

payload

 

 

 

 

 

 

 

 

 

WORD

nPacketSize;//size

of

the

 

 

 

 

payload

 

 

 

 

 

 

 

 

 

WORD

nCRCPacket;//CRC for

the

 

 

 

 

entire packet

 

 

 

 

 

 

 

} PACKET_HEADER;

 

 

 

 

Magic Number

The Magic Number is a fixed value that is used to insure packet alignment if there are partial packets received or bytes lost.

The Magic Number is a WORD in length (2 bytes). The Magic Number value is 0xEFBE. Because Intel byte ordering is used, the ls-byte of the word is sent first (byte0 = 0xBE), then the ms-byte (byte1 = 0xEF).

50

Page 50
Image 50
Philips BDS4621 user manual Send Command Introduction, Byte