/ MATES / Modular Automatic Test Equipment System API
2.5.0.0
|
MATES system access library. More...
Data Structures | |
struct | MATES_DESC_TYPE |
Typedefs | |
typedef MATES_DESC_TYPE * | MATES_HANDLE |
Enumerations |
Functions | |
void | mates_set_verbosity (int level) |
Set the verbosity level. More... | |
UOS_STATUS | mates_monitor_version (char *buf, int max) |
Get the underlying uOS_monitor instance version. More... | |
UOS_STATUS | mates_monitor_path (char *buf, int max) |
Get the underlying uOS_monitor instance path. More... | |
UOS_STATUS | mates_dll_version (char *buf, int max) |
Get the mates.dll file version. More... | |
UOS_STATUS | mates_dll_path (char *buf, int max) |
Get the mates.dll file path. More... | |
int | mates_get_last_error (char *msg, int max) |
Get the lastly occurred error. More... | |
int | mates_get_last_error_ex (MATES_HANDLE h, char *msg, int max) |
Get the lastly occurred error for the specified MATES handle. More... | |
void | mates_print_errors (void) |
Print MATES error messages to standard output. More... | |
void | mates_print_errors_ex (MATES_HANDLE h) |
Print MATES error messages to standard output. More... | |
void | mates_clear_errors (void) |
Clear all error messages without printing. More... | |
void | mates_clear_errors_ex (MATES_HANDLE h) |
Clear all error messages without printing. More... | |
MATES_HANDLE | mates_open (char *conf_file_name, int addr) |
Open the MATES communication channel. More... | |
MATES_HANDLE | mates_open_buffer (char *conf_string, int addr) |
Open the MATES communication channel. More... | |
UOS_STATUS | mates_close (MATES_HANDLE h) |
Close the MATES communication channel. More... | |
UOS_STATUS | mates_discover_single_node (MATES_HANDLE h, int addr) |
Check if the specified node is present on the bus. More... | |
UOS_STATUS | mates_get_din_all (MATES_HANDLE h, int addr, int *value) |
Get value of all digital inputs. More... | |
UOS_STATUS | mates_get_din (MATES_HANDLE h, int addr, int channel, int *value) |
Get value of an individual digital input. More... | |
UOS_STATUS | mates_set_dout_all (MATES_HANDLE h, int addr, int value) |
Set value of all digital outputs. More... | |
UOS_STATUS | mates_set_dout_all_ex (MATES_HANDLE h, int addr, int value, MATES_DIO_OUT_MODE_TYPE mode) |
Set value of all digital outputs using the specified mode. More... | |
UOS_STATUS | mates_set_dout (MATES_HANDLE h, int addr, int channel, int value) |
Set value of an individual digital output. More... | |
UOS_STATUS | mates_get_dout_all (MATES_HANDLE h, int addr, int *value) |
Get value of all digital outputs. More... | |
UOS_STATUS | mates_get_dout (MATES_HANDLE h, int addr, int channel, int *value) |
Get value of an individual digital output. More... | |
UOS_STATUS | mates_toggle_dout (MATES_HANDLE h, int addr, int channel) |
Toggle state of an individual digital output. More... | |
UOS_STATUS | mates_set_dac_raw (MATES_HANDLE h, int addr, int channel, int value) |
Set raw value of the DAC. More... | |
UOS_STATUS | mates_get_dac_raw (MATES_HANDLE h, int addr, int channel, int *value) |
Get the raw value of the DAC. More... | |
UOS_STATUS | mates_set_dac (MATES_HANDLE h, int addr, int channel, double value) |
Set the value of the DAC (Volts). More... | |
UOS_STATUS | mates_get_dac (MATES_HANDLE h, int addr, int channel, double *value) |
Get the value of the DAC (Volts). More... | |
UOS_STATUS | mates_get_adc (MATES_HANDLE h, int addr, int channel, double *value) |
Get the value of the ADC (Volts). More... | |
UOS_STATUS | mates_get_adc_raw (MATES_HANDLE h, int addr, int channel, int *value) |
Get the raw value of the ADC. More... | |
UOS_STATUS | mates_save_default (MATES_HANDLE h, int addr, int channel) |
Save the current value of an output channel as a default value. More... | |
UOS_STATUS | mates_set_register (MATES_HANDLE h, int addr, int reg, int value) |
Set regular (integral) MATES register. More... | |
UOS_STATUS | mates_set_register_f (MATES_HANDLE h, int addr, int reg, float value) |
Set floating point MATES register. More... | |
UOS_STATUS | mates_get_register (MATES_HANDLE h, int addr, int reg, int *value) |
Get regular (integral) MATES register. More... | |
UOS_STATUS | mates_get_register_f (MATES_HANDLE h, int addr, int reg, float *value) |
Get floating point MATES register. More... | |
UOS_STATUS | mates_get_register_sr (MATES_HANDLE h, int addr, int *value) |
Convenience function to get the status register SR. More... | |
UOS_STATUS | mates_get_register_fir (MATES_HANDLE h, int addr, int *value) |
Convenience function to get the firmware identification register FIR. More... | |
UOS_STATUS | mates_node_info (MATES_HANDLE h, int addr, char *buf, int max) |
Get node information as string. More... | |
UOS_STATUS | mates_enable_generators (MATES_HANDLE h, int addr, int enable) |
Enable signal generators for a node. More... | |
UOS_STATUS | mates_setup_generator (MATES_HANDLE h, int addr, int channel, unsigned int period, unsigned int rise_time, unsigned int fall_time) |
Setup signal generator for a digital channel. More... | |
UOS_STATUS | mates_lamp_test (MATES_HANDLE h, int addr) |
Execute the lamp test. See CR register documentation for details. More... | |
UOS_STATUS | mates_alcd_write (MATES_HANDLE h, int addr, int row, int col, char *text) |
Write text onto the alphanumeric LCD display. More... | |
char * | mates_status_name (UOS_STATUS code) |
Translate MATES status code into string representation. More... | |
MATES system access library.
Copyright (C) 2013-2018 Viresco Lukasz Matecki lukas All rights reserved z.ma tecki @vir esco. pl
Project: MATES-DLL Platform: Windows XP SP3, Windows 7, Windows 8, Windows 10 Processor: x86
typedef MATES_DESC_TYPE* MATES_HANDLE |
Represents MATES connection handle.
enum UOS_STATUS |
Generic status.
MATES node address enumeration. Used to distinguish node types and node specimens.
enum MATES_OUTPUT_TYPE |
MATES output channels enumeration.
enum MATES_INPUT_TYPE |
The outputs setting mode to be used with mates_set_dout_all_ex().
Enumerator | |
---|---|
MATES_DIO_OUT_MODE_SET |
(0) SET mode. |
MATES_DIO_OUT_MODE_AND |
(1) AND mode. |
MATES_DIO_OUT_MODE_OR |
(2) OR mode. |
MATES_DIO_OUT_MODE_XOR |
(3) XOR mode. |
void mates_set_verbosity | ( | int | level | ) |
Set the verbosity level.
[in] | level | The verbosity level:
|
All verbose messages are appended to the error log. They can be obtained the same way the error messages (using e.g. mates_get_last_error()).
UOS_STATUS mates_monitor_version | ( | char * | buf, |
int | max | ||
) |
Get the underlying uOS_monitor instance version.
[out] | buf | Where to place the result; the version format is "X.X.X.X". |
[in] | max | Amount of space in buf. |
UOS_STATUS_OK | when successful. |
UOS_STATUS_EINVAL | when there was not enough room in buf. |
UOS_STATUS_ENODATA | when there was no alive handle to operate on. |
Example usage (mates_test_20.c):
UOS_STATUS mates_monitor_path | ( | char * | buf, |
int | max | ||
) |
Get the underlying uOS_monitor instance path.
[out] | buf | Where to place the result. |
[in] | max | Amount of space in buf. |
[in,out] | - |
UOS_STATUS_OK | when successful. |
UOS_STATUS_EINVAL | when buf is NULL. |
Example usage (mates_test_38.c):
UOS_STATUS mates_dll_version | ( | char * | buf, |
int | max | ||
) |
Get the mates.dll file version.
[out] | buf | Where to place the result; the version format is "X.X.X.X". |
[in] | max | Amount of space in buf. |
UOS_STATUS_OK | when successful. |
UOS_STATUS_EINVAL | when there was not enough room in buf. |
UOS_STATUS_ERROR | when the value cannot be established. |
Example usage (mates_test_35.c):
UOS_STATUS mates_dll_path | ( | char * | buf, |
int | max | ||
) |
Get the mates.dll file path.
[out] | buf | Where to place the result. |
[in] | max | Amount of space in buf. |
[in,out] | - |
UOS_STATUS_OK | when successful. |
UOS_STATUS_EINVAL | when there was not enough room in buf. |
UOS_STATUS_ERROR | when the value cannot be established. |
Example usage (mates_test_37.c):
int mates_get_last_error | ( | char * | msg, |
int | max | ||
) |
Get the lastly occurred error.
[out] | msg | Where to place the result. |
[in] | max | Space available in msg. |
n | Number of characters that would have been written if there is enough room in msg. |
0 | on error. |
Example usage (mates_test_21.c):
int mates_get_last_error_ex | ( | MATES_HANDLE | h, |
char * | msg, | ||
int | max | ||
) |
Get the lastly occurred error for the specified MATES handle.
[in] | h | The MATES communication handle. |
[out] | msg | Where to place the result. |
[in] | max | Amount of space in msg. |
Number | of characters that would have been written if there is enough room in msg. |
0 | on error. |
Example usage (mates_test_34.c):
void mates_print_errors | ( | void | ) |
Print MATES error messages to standard output.
[in] | - |
Example usage (mates_test_18.c):
void mates_print_errors_ex | ( | MATES_HANDLE | h | ) |
Print MATES error messages to standard output.
[in] | h | The MATES communication handle. |
Example usage (mates_test_36.c):
void mates_clear_errors | ( | void | ) |
Clear all error messages without printing.
[in] | - |
Example usage (mates_test_19.c):
void mates_clear_errors_ex | ( | MATES_HANDLE | h | ) |
Clear all error messages without printing.
[in] | h | The MATES communication handle. |
MATES_HANDLE mates_open | ( | char * | conf_file_name, |
int | addr | ||
) |
Open the MATES communication channel.
[in] | conf_file_name | uOS_monitor configuration file. |
[in] | addr | The MATES device communication address to use (in the uOS_monitor communication network). Physical devices of the MK1 family have always addresses equal to 0. This has to have the same value as the corresponding @map attribute of the *.mon configuration file specified. The mates_proxy server assumes clients to connect using address of 1. Other values can be used when there is a proxy transport layer implemented between the physical device and mates.dll (like e.g. socket). |
Example usage (mates_test_03.c):
MATES_HANDLE mates_open_buffer | ( | char * | conf_string, |
int | addr | ||
) |
Open the MATES communication channel.
[in] | conf_string | uOS_monitor XML configuration string. |
[in] | addr | The MATES device communication address to use (in the uOS_monitor communication network). Physical devices of the MK1 family have always addresses equal to 0. This has to have the same value as the corresponding @map attribute of the *.mon configuration file specified. The mates_proxy server assumes clients to connect using address of 1. Other values can be used when there is a proxy transport layer implemented between the physical device and mates.dll (like e.g. socket). |
Example usage (mates_test_41.c):
UOS_STATUS mates_close | ( | MATES_HANDLE | h | ) |
Close the MATES communication channel.
[in] | h | The MATES communication handle. |
UOS_STATUS_OK | when successful. |
UOS_STATUS_EINVAL | for invalid handle. |
UOS_STATUS_ECORRUPT | when handle was already closed. |
Example usage (mates_test_39.c):
This functions performs all necessary cleanup - closes the communication channels and frees any allocated resources.
UOS_STATUS mates_discover_single_node | ( | MATES_HANDLE | h, |
int | addr | ||
) |
Check if the specified node is present on the bus.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
UOS_STATUS_OK | when the given node was found in the system. |
UOS_STATUS_EINVAL | when h is invalid or addr is out of range. |
UOS_STATUS_ETIMEOUT | when the node cannot be found. |
UOS_STATUS_ERROR | on any other error. |
Example usage (mates_test_04.c):
See also MATES manual
UOS_STATUS mates_get_din_all | ( | MATES_HANDLE | h, |
int | addr, | ||
int * | value | ||
) |
Get value of all digital inputs.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[out] | value | Where to store the result, LSB is IN01. |
UOS_STATUS_OK | when successful. |
Example usage (mates_test_23.c):
UOS_STATUS mates_get_din | ( | MATES_HANDLE | h, |
int | addr, | ||
int | channel, | ||
int * | value | ||
) |
Get value of an individual digital input.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[in] | channel | The DIN channel number [0,19]. |
[out] | value | Where to store the result. |
UOS_STATUS_OK | when successful. |
Example usage (mates_test_05.c):
UOS_STATUS mates_set_dout_all | ( | MATES_HANDLE | h, |
int | addr, | ||
int | value | ||
) |
Set value of all digital outputs.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[in] | value | The output value, LSB is OUT01. |
UOS_STATUS_OK | when successful. |
Example usage (mates_test_25.c):
UOS_STATUS mates_set_dout_all_ex | ( | MATES_HANDLE | h, |
int | addr, | ||
int | value, | ||
MATES_DIO_OUT_MODE_TYPE | mode | ||
) |
Set value of all digital outputs using the specified mode.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[in] | value | The output value, LSB is OUT01. |
[in] | mode | Value setting mode:
|
UOS_STATUS_OK | when successful. |
Example usage (mates_test_26.c):
UOS_STATUS mates_set_dout | ( | MATES_HANDLE | h, |
int | addr, | ||
int | channel, | ||
int | value | ||
) |
Set value of an individual digital output.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[in] | channel | The DOUT channel number [0,19]. |
[in] | value | The output value. |
UOS_STATUS_OK | when successful. |
Example usage (mates_test_06.c):
UOS_STATUS mates_get_dout_all | ( | MATES_HANDLE | h, |
int | addr, | ||
int * | value | ||
) |
Get value of all digital outputs.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[out] | value | Where to store the result, LSB is OUT01. |
UOS_STATUS_OK | when successful. |
Example usage (mates_test_24.c):
UOS_STATUS mates_get_dout | ( | MATES_HANDLE | h, |
int | addr, | ||
int | channel, | ||
int * | value | ||
) |
Get value of an individual digital output.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[in] | channel | The DOUT channel number [0,19]. |
[out] | value | Where to store the result. |
UOS_STATUS_OK | when successful. |
Example usage (mates_test_07.c):
UOS_STATUS mates_toggle_dout | ( | MATES_HANDLE | h, |
int | addr, | ||
int | channel | ||
) |
Toggle state of an individual digital output.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[in] | channel | The DOUT channel number [0,19]. |
UOS_STATUS_OK | when successful. |
Example usage (mates_test_08.c):
UOS_STATUS mates_set_dac_raw | ( | MATES_HANDLE | h, |
int | addr, | ||
int | channel, | ||
int | value | ||
) |
Set raw value of the DAC.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[in] | channel | The DAC channel number [0,39]. |
[in] | value | The raw DAC binary code to write. |
UOS_STATUS_OK | when successful. |
Example usage (mates_test_09.c):
UOS_STATUS mates_get_dac_raw | ( | MATES_HANDLE | h, |
int | addr, | ||
int | channel, | ||
int * | value | ||
) |
Get the raw value of the DAC.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[in] | channel | The DAC channel number [0,39]. |
[out] | value | Where to place the result (raw DAC value). |
UOS_STATUS_OK | when successful. |
Example usage (mates_test_22.c):
UOS_STATUS mates_set_dac | ( | MATES_HANDLE | h, |
int | addr, | ||
int | channel, | ||
double | value | ||
) |
Set the value of the DAC (Volts).
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[in] | channel | The DAC channel number [0,39]. |
[in] | value | The voltage value to set (Volts). |
UOS_STATUS_OK | when successful. |
UOS_STATUS_ERANGE | when written value is out of range. |
Example usage (mates_test_10.c):
UOS_STATUS mates_get_dac | ( | MATES_HANDLE | h, |
int | addr, | ||
int | channel, | ||
double * | value | ||
) |
Get the value of the DAC (Volts).
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[in] | channel | The DAC channel number [0,39]. |
[out] | value | Where to place the result (voltage value in Volts). |
UOS_STATUS_OK | when successful. |
Example usage (mates_test_11.c):
UOS_STATUS mates_get_adc | ( | MATES_HANDLE | h, |
int | addr, | ||
int | channel, | ||
double * | value | ||
) |
Get the value of the ADC (Volts).
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[in] | channel | The ADC channel number [0,39]. |
[out] | value | Where to place the result (voltage value in Volts). |
UOS_STATUS_OK | when successful. |
Example usage (mates_test_28.c):
UOS_STATUS mates_get_adc_raw | ( | MATES_HANDLE | h, |
int | addr, | ||
int | channel, | ||
int * | value | ||
) |
Get the raw value of the ADC.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[in] | channel | The ADC channel number [0,39]. |
[out] | value | Where to place the result (raw DAC value)). |
UOS_STATUS_OK | when successful. |
Example usage (mates_test_29.c):
UOS_STATUS mates_save_default | ( | MATES_HANDLE | h, |
int | addr, | ||
int | channel | ||
) |
Save the current value of an output channel as a default value.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[in] | channel | The output node channel number, [0,39] for DAC node, [0,19] for DIO3 or DIOX node. |
UOS_STATUS_OK | when successful. |
UOS_STATUS_EINVAL | when the node is not an output node or the channel number is out of range. |
Example usage (mates_test_30.c):
UOS_STATUS mates_set_register | ( | MATES_HANDLE | h, |
int | addr, | ||
int | reg, | ||
int | value | ||
) |
Set regular (integral) MATES register.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[in] | reg | The register number to access (see MATES_REG_TYPE). |
[in] | value | The register value. |
UOS_STATUS_OK | when successful. |
UOS_STATUS_EINVAL | when register number is invalid. |
UOS_STATUS_ERANGE | when written value is out of range. |
Example usage (mates_test_12.c):
UOS_STATUS mates_set_register_f | ( | MATES_HANDLE | h, |
int | addr, | ||
int | reg, | ||
float | value | ||
) |
Set floating point MATES register.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[in] | reg | The register number to access (see MATES_REG_TYPE). |
[in] | value | The register value. |
UOS_STATUS_OK | when successful. |
UOS_STATUS_EINVAL | when register number is invalid. |
UOS_STATUS_ERANGE | when written value is out of range. |
Example usage (mates_test_13.c):
UOS_STATUS mates_get_register | ( | MATES_HANDLE | h, |
int | addr, | ||
int | reg, | ||
int * | value | ||
) |
Get regular (integral) MATES register.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[in] | reg | The register number to access (see MATES_REG_TYPE). |
[out] | value | Where to place the result. |
UOS_STATUS_OK | when successful. |
UOS_STATUS_EINVAL | when register number is invalid. |
Example usage (mates_test_14.c):
UOS_STATUS mates_get_register_f | ( | MATES_HANDLE | h, |
int | addr, | ||
int | reg, | ||
float * | value | ||
) |
Get floating point MATES register.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[in] | reg | The register number to access (see MATES_REG_TYPE). |
[out] | value | Where to place the result. |
UOS_STATUS_OK | when successful. |
UOS_STATUS_EINVAL | when register number is invalid. |
Example usage (mates_test_15.c):
UOS_STATUS mates_get_register_sr | ( | MATES_HANDLE | h, |
int | addr, | ||
int * | value | ||
) |
Convenience function to get the status register SR.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[out] | value | Where to place the result. |
UOS_STATUS_OK | when successful. |
Example usage (mates_test_16.c):
For registers definitions see MATES manual.
UOS_STATUS mates_get_register_fir | ( | MATES_HANDLE | h, |
int | addr, | ||
int * | value | ||
) |
Convenience function to get the firmware identification register FIR.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[out] | value | Where to place the result. |
UOS_STATUS_OK | when successful. |
Example usage (mates_test_17.c):
For registers definitions see MATES manual.
UOS_STATUS mates_node_info | ( | MATES_HANDLE | h, |
int | addr, | ||
char * | buf, | ||
int | max | ||
) |
Get node information as string.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[out] | buf | Where to place the result. |
[in] | max | The amount of space in buf. |
UOS_STATUS_OK | when successful. |
Example usage (mates_test_27.c):
UOS_STATUS mates_enable_generators | ( | MATES_HANDLE | h, |
int | addr, | ||
int | enable | ||
) |
Enable signal generators for a node.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[in] | enable | The generators enable state. |
UOS_STATUS_OK | when successful. |
Example usage (mates_test_31.c):
UOS_STATUS mates_setup_generator | ( | MATES_HANDLE | h, |
int | addr, | ||
int | channel, | ||
unsigned int | period, | ||
unsigned int | rise_time, | ||
unsigned int | fall_time | ||
) |
Setup signal generator for a digital channel.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[in] | channel | The generator channel to setup [0,19]. |
[in] | period | The waveform period in microseconds. |
[in] | rise_time | Signal rise time within the period in microseconds. |
[in] | fall_time | Signal fall time within the period in microseconds. |
UOS_STATUS_OK | when successful. |
UOS_STATUS_EINVAL | if
|
Example usage (mates_test_32.c):
UOS_STATUS mates_lamp_test | ( | MATES_HANDLE | h, |
int | addr | ||
) |
Execute the lamp test. See CR register documentation for details.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
UOS_STATUS_OK | when successful. |
Example usage (mates_test_33.c):
UOS_STATUS mates_alcd_write | ( | MATES_HANDLE | h, |
int | addr, | ||
int | row, | ||
int | col, | ||
char * | text | ||
) |
Write text onto the alphanumeric LCD display.
[in] | h | The MATES communication handle. |
[in] | addr | The node CAN address. |
[in] | row | The LCD row number (0 - based). |
[in] | col | The LCD column number (0 - based). |
[in] | text | The NUL - terminated text to write at the given position. |
UOS_STATUS_OK | when successful. |
UOS_STATUS_ERANGE | when row or col are out of display's range. |
UOS_STATUS_ETOOBIG | when text doesn't fit into the display. |
Example usage (mates_test_40.c):
char* mates_status_name | ( | UOS_STATUS | code | ) |
Translate MATES status code into string representation.
[in] | code | The status code. |