beautypg.com

Wavetronix Click 500 (programmable controller) (CLK-500) - Developer Guide User Manual

Page 82

background image

CHAPTER 8 • SERIAL MESSAGE SUPPORT 81

%4CSUM[0]

A four-byte checksum field associated with the checksum calculation
algorithm in location 0 of the checksum table. The default implemen-
tation supports up to ten unique checksum algorithms.

Table 8.2 – Message Format

The identifier in brackets (e.g. [...]) is the variable label used to identify the variable data

to be communicated in a message. In the example code above, the %2B[index] creates a

variable called index, which stores the two bytes from the fourth and fifth byte positions of

Message3. If this message is received, these bytes are parsed from the received message and

stored into the variable labeled index. If this message is transmitted, the first two bytes of

the variable called index are loaded into the message for transmission.

Any variable may be used in one or more messages. The variable is defined, with its type

and size specified, in the first instance of the first message in which it appears. Make sure

that every instance of a given variable uses the same format type and size. Variable memory

is allocated when the variable is defined. There is a default limit to the number of variables

allowed.

The following table lists the default maximums for the Click message library. Many of these

can be changed by editing the Click500defaults.lib file as necessary (see Table 8.3).

Message Library Parameter

Default Maximum

Message byte length

256

Number of messages

32

Number of receive callback functions

8

Number of single-value variables

100

Decimal or hexadecimal variable value

2^32 = 4,294,967,296 decimal

Number of fixed-length array variables

20

Length of fixed-length array variables

32 bytes or characters

Number of variable-length array variables

10

Length of variable-length array variables

200 bytes or characters

Variable label length

15 characters

Number of checksums

10

Length of checksum field

8 bytes

Table 8.3 – Default Maximums for the Click Message Library

By customizing the number of messages and variables to those used by your application,

you may be able to free up some memory space. For example, if you are only using one

variable-length array variables, then you can reduce this number to one. If this variable-

length variable is limited to only 120 bytes, then you can free up a little more memory by

changing the associated pre-compiler directive (#define).