Error Codes:
Constant | Value | Description |
---|---|---|
SER_SUCCESS | 0 | No error occurred |
SER_GENERAL_ERROR | -1 | Miscellaneous error |
SER_SERIAL_ERROR | -10 | Unable to open, read, or write to the serial port |
SER_THREAD_ERROR | -11 | General error ocurred in the threads library used by this API |
SER_NOT_SUPPORTED | -12 | API function is not supported by a device |
SER_PIPE_ERROR | -13 | Error creating a pipe (in linux) |
SER_READTHREAD_ERROR | -14 | Internal API error creating the reading thread or inside the reading thread |
SER_EVENTTHREAD_ERROR | -15 | Internal API error creating the event thread of inside the event thread |
SER_MALLOC_ERROR | -16 | Problem involving allocating memory |
SER_WINDOWS_ERROR | -17 | Error specific to windows, such as creating a window, or window class |
SER_INVALID_HANDLE | -101 | No device is currently open with that handle |
SER_INVALID_MODEL | -102 | Model was invalid (doesn't exist) |
SER_INVALID_PORT | -104 | Port specified is invalid for the device model |
SER_INVALID_PORTMODE | -105 | There is no such mode for that port, or that mode is currently unavailable |
SER_INVALID_PORTVALUE | -106 | Value passed to output function is out of valid range |
SER_INVALID_EVENTID | -107 | Cannot assign that id value to an event |
SER_INVALID_EVENTTYPE | -108 | Not one of the supported event types |
SER_INVALID_BIT | -109 | Value passed identifying bit is out of range |
SER_INVALID_PROPERTY | -110 | Not a valid property for the port specified |
SER_INVALID_CHANNEL | -111 | Invalid analog channel number specified |
SER_SERIALPORT_CONFLICT | -114 | Serial port specified is already in use |
SER_DEVICE_NOTFOUND | -115 | Device is not present on the specified serial port, or is not powered up |
SER_WRONG_PORTMODE | -150 | Device is not in the correct mode. |
SER_EVENT_CONFLICT | -151 | This error likely occurs if a bit event is registered on a port whose port event is enabled |
SER_TIMEOUT | -201 | Timeout ocurred. Most likely communication has been lost w/ device |
Constant | Value | Description |
---|---|---|
SER_9600 | 13 | Connect to board at 9600 baud |
SER_19200 | 14 | Connect to board at 19200 baud |
There are a number of constants defined for use in configuring the I/O ports. These will be used when calling the ser_sr24_set_portmode() function. Note that this function is used for configuring several different properties of an I/O port. You must therefore pass a parameter indicating which property you want to change, as well as the value you want to assign to the property. For example, if you want to make Port 2 an output port, pass a constant which indicates you want to set the direction of the port; also pass a constant indicating that the port should be set to 'output'.
The constants are listed below. Note that they are arranged logically -- all the possible values are listed below each port property. Also, a typical function call is shown for each property.
Port Property: Tri-State Buffer |
SR24_BUFFER_ENABLED = 0: Enable the port buffer SR24_BUFFER_DISABLED = 1: Disable the port buffer (put in high-impedance state)
|
Port Property: Direction |
SR24_DIRECTION_INPUT = 0: Set the port direction to 'input' SR24_DIRECTION_OUTPUT = 1: Set the port direction to 'output'
|
Port Property: Analog/Digital |
SR24_TYPE_DIGITAL = 0: Set the port to be in digital mode SR24_TYPE_ANALOG = 1: Set the port to be in analog mode Example: Here is a function call to configure Port 1 as analog inputs:
|
Back to Contents | Winford Engineering (2000) |