Core Serial Library in C
1.0
|
The Zaber Core Serial Library is intended to provide a simple set of commands for interacting with Zaber devices over a serial port. It is recommended that before using this library, you first read the protocol manual corresponding to the protocol of your device.
The ASCII Protocol Manual is a complete reference for communicating with Zaber devices in ASCII. Note that many A-Series devices default to the binary protocol, and may need to be switched to ASCII before use. Appendix C of the ASCII Protocol Manual is a short guide to doing this switch.
The Binary Protocol Manual is a complete reference for communicating with Zaber devices in binary. Note that devices using the binary protocol will only reply once a command has completed, so more work must be done to properly receive responses. See the "Move Absolute" command reference and zb_set_timeout() for more info on this.
The officially published versions of the library can selected and downloaded here (select the version you want then click the button), or you can fork the source code and extend it yourself from the public repo.
The API is divided into two major parts:
There is also a third header, z_common.h. It defines a few things that both of the other headers have in common. It should not be explicitly included in your source files: it is already included by za_serial.h and zb_serial.h.
Regardless of which protocol you are using, z_common.h defines a "z_port"
type, which is used to represent a connected port. A variable of this type should be populated using za_connect() or zb_connect(). These functions will not only set your z_port
to a valid file descriptor/handle, but will also configure it to the proper settings for a Zaber device using your protocol of choice.
After opening your z_port
, it will be the first parameter to nearly every other function exposed by this API, except for functions which do not interact directly with your device (eg. zb_decode()). Note that with the exception of za_connect() and zb_connect(), a z_port
is passed by value, not by reference.