beautypg.com

Wavetronix protocol support, Z1 protocol support – Wavetronix Click 500 (programmable controller) (CLK-500) - Developer Guide User Manual

Page 91

background image

90

CHAPTER 8 • SERIAL MESSAGE SUPPORT

Wavetronix Protocol Support

The Library\Protocols directory contains some library modules to support protocols used

by SmartSensor and Click devices. The code in the Protocols directory is open source so

that you can modify it for your own purposes. This code serves as a good example of how

you can use the ClickMsg library to support multiple serial protocols. Currently, this direc-

tory only supports the Z1 protocol, used with SmartSensor HD.

The following list shows the different Wavetronix protocols. In the future, more support for

the other protocols will be made. Z2 protocol support is required for interaction with Click

Supervisor and is found in the Click500supervisor.lib library module (currently this code

is not open source.)

Protocol Preamble

Description of Usage

Z0

SmartSensor V, SmartSensor Advance, and
Click 100/172/174

Z1

SmartSensor HD

Z2

Click 100–500 series

Z3

SmartSensor Matrix

Z4

Click 110/112/114

Table 8.4 – Wavetronix Protocol List

Z1 Protocol Support

The main Z1 support module is found in the file named click500Z1.lib. The other files in

this directory are for specific commands or contain specific support functions like CRC

calculation.

The Z1 support library can be used for applications that interface with the SmartSensor HD.

If you are polling a SmartSensor HD unit, you can interact with it in the following ways:

˽

Poll the sensor and block for response message

˽

Poll the sensor without blocking

˽

Listen for pushed data

The following code example shows how to poll the sensor for its time and then block for two

seconds in order to receive the time.

If you would like to multi-task while waiting for the receive message, you do not need to

block. In this case, enter zero instead of 2000 for the timeout. Then do whatever else you

need to and come back and check to see if the data on the desired virtual port is ready for

processing by calling ClickZ1ErrorCheck. If ClickZ1ErrorCheck returns a -1, then the re-

sponse message has not yet arrived. If the ClickZ1ErrorCheck returns a 0, then the response

message has arrived with no errors. If there is another type of error, ClickZ1ErrorCheck will

return a value specified in the Z1 protocol documentation.