Data Structures | Defines | Typedefs | Enumerations

include/xidcusb.h File Reference

Header file for XIDCUSB library. More...

Go to the source code of this file.

Data Structures

struct  state_t
 Device state. More...
struct  chart_data_t
 Additional device state. More...
struct  calibration_settings_t
 Calibration settings. More...
struct  engine_settings_t
 Engine settings. More...
struct  pid_settings_t
 PID settings. More...
struct  sync_settings_t
 Synchronization settings. More...
struct  home_settings_t
 Position calibration settings. More...
struct  analog_data_t
 Analog data. More...

Defines

#define DCCONTROL_API   __attribute__((visibility("default")))
 Library import macros.
#define device_undefined   -1
 Handle specified undefined device.
Result statuses

#define result_ok   0
 success
#define result_error   -1
 generic error
#define result_not_implemented   -2
 function is not implemented
#define result_dataerror   -3
 device reports wrong request or response
#define result_nodevice   -4
 device is lost
Status flags

Controller flags returned by device query.

Contains boolean part of controller status. May be combined with bitwise OR

See also:
state_t::flags
get_status
#define STATE_RIGHT_EDGE   0x0001
 Engine stucks at the right edge.
#define STATE_LEFT_EDGE   0x0002
 Engine stucks at the left edge.
#define STATE_EXT_POWER   0x0004
 External power is used.
#define STATE_ERRC   0x0008
 Command error encountered.
#define STATE_ERRD   0x0010
 Data error encountered.
#define STATE_POWER_DISABLE   0x0020
 FTDI reports "Power disable".
#define STATE_TTLIO_PINOUT   0x0040
 Synchronization In/Out works as Out, if flag set; otherwise works as In.
#define STATE_TTLIO_LEVEL   0x0080
 State of synchronization In/Out pin.
#define STATE_BUTTON_RIGHT   0x0100
 Button "right" state (1 if pressed).
#define STATE_BUTTON_LEFT   0x0200
 Button "left" state (1 if pressed).
#define STATE_OVERHEAT   0x2000
 Temperature sensor show value that exceed maximum temperature rating less then 1 ms.
#define STATE_OVERLOAD_VOLTAGE   0x4000
 Voltage overload encountered.
#define STATE_OVERLOAD_CURRENT   0x8000
 Current overlaod encountered.
Flags of engine settings

Specify motor shaft movement algorithm and list of limitations.

Flags returned by query of engine settings. May be combined with bitwise OR

See also:
engine_settings_t::flags
set_engine_settings
get_engine_settings
#define ENGINE_REVERSE   0x0001
 Reverse flag.
#define ENGINE_FINISHING   0x0002
 Fine tuneup flag.
#define ENGINE_MAX_SPEED   0x0004
 Max speed flag.
#define ENGINE_ANTIPLAY   0x0008
 Play compensation flag.
#define ENGINE_ACCEL_ON   0x0010
 Acceleration enable flag.
#define ENGINE_LIMIT_VOLT   0x0020
 Maxumum motor voltage limit enable flag.
#define ENGINE_LIMIT_CURR   0x0040
 Maxumum motor current limit enable flag.
#define ENGINE_LIMIT_RPM   0x0080
 Maxumum motor speed limit enable flag.
#define ENGINE_HOLD   0x0100
 Hold motor shaft when motor is stopped if this flag set.
#define ENGINE_DYNAMIC_HOLD   0x0200
 Holding motor shaft dynamically (power supply is applied to motor always), if set; when shaft position is different from specified, if not set.
#define ENGINE_ONLY_FINISHING   0x0400
 Move in fine tuneup mode only if this flag set.
Flags of microstep mode

Specify settings of microstep mode.

Used with step motors. Flags returned by query of engine settings. May be combined with bitwise OR

See also:
engine_settings_t::flags
set_engine_settings
get_engine_settings
#define MICROSTEP_MODE_FULL   0x01
 Full step mode.
#define MICROSTEP_MODE_FRAC_2   0x02
 1/2 step mode.
#define MICROSTEP_MODE_FRAC_4   0x04
 1/4 step mode.
#define MICROSTEP_MODE_FRAC_8   0x08
 1/8 step mode.
#define MICROSTEP_MODE_FRAC_16   0x10
 1/16 step mode.
#define MICROSTEP_MODE_FRAC_32   0x20
 1/32 step mode.
#define MICROSTEP_MODE_FRAC_64   0x40
 1/64 step mode.
#define MICROSTEP_MODE_FRAC_128   0x80
 1/128 step mode.
Flags of engine type

Specify motor type.

Flags returned by query of engine settings.

See also:
engine_settings_t::flags
set_engine_settings
get_engine_settings
#define ENGINE_TYPE_DC   0x01
 DC motor.
#define ENGINE_TYPE_STEP   0x02
 Step motor.
#define ENGINE_TYPE_BRUSHLESS   0x04
 Brushless motor.

#define FEEDBACK_POTENTIOMETER   0x00
 Describes feedback type.
#define FEEDBACK_ENCODER   0x01
 feedback by encoder.
#define FEEDBACK_ENCODERDIFF   0x02
 feedback by encoder with differential input.
#define FEEDBACK_ENCODERHALL   0x04
 feedback by Hall detector.
#define FEEDBACK_EMF   0x08
 feedback by EMF.
#define FEEDBACK_NONE   0x10
 feedback is absent.
Flags of synchronization In/Out setup
#define TTL_SETUP_DIROUT   0x0001
 Synchronization In/Out works as Out, if flag set; otherwise works as In.
#define TTL_SETUP_OUTSET   0x0002
 Value on Synchronization Out, used if direction is out only.
#define TTL_SETUP_FRONT   0x0010
 Synchronization In mode.
Flags for synchronization input setup
#define TTL_SYNCIN_ONMOVE   0x0001
 Infinite moving in TTL_SYNCIN_DIRRIGHT direction, if set; moving to given position or given shift, if not set.
#define TTL_SYNCIN_MULTI_SHIFT   0x0004
 Response on every incoming pulse, if set; one time response, if not set.
#define TTL_SYNCIN_DIRRIGHT   0x0008
 Movement direction to the right, if set.
Flags of synchronization output
#define TTL_SYNCOUT_ONSTART   0x0001
 Generate synchronization pulse when moving started.
#define TTL_SYNCOUT_ONSTOP   0x0002
 Generate synchronization pulse when moving stopped.
#define TTL_SYNCOUT_ONPERIOD   0x0004
 Generate synchronization pulse every impulse_period encoder pulses.
Border flags

Specify types of borders and motor behaviour on borders.

May be combined with bitwise OR

See also:
get_edges_settings
set_edges_settings
#define BORDER_IS_ENCODER   0x0001
 Borders are fixed by predetermined encoder values, if set; borders position on limit switches, if not set.
#define BORDER_STOP_LEFT   0x0002
 Motor should stop on left border.
#define BORDER_STOP_RIGHT   0x0004
 Motor should stop on right border.
Limit switches flags

Specify electrical behaviour of limit switches like order and pulled positions.

May be combined with bitwise OR

See also:
get_edges_settings
set_edges_settings
#define ENDER_DIRECT   0x0001
 First limit switch on the right side, if set; otherwise on the left side.
#define ENDER_ON1   0x0002
 First limit switch pulled position is closed, if set; otherwise pulled position is opened.
#define ENDER_ON2   0x0004
 Second limit switch pulled position is closed, if set; otherwise pulled position is opened.
Home settings flags

Specify behaviour for home command.

May be combined with bitwise OR

See also:
get_home_settings
set_home_settings
command_home
#define HOME_DIR_FAST   0x01
 Flag defines direction of 1st motion after execute home command.
#define HOME_STOP_FAST   0x02
 Fast motion stops by synchronization input, if set; otherwise by limit switch.
#define HOME_DIR_SLOW   0x04
 Flag defines direction of 2nd motion.
#define HOME_REV_EN   0x08
 Revolution sensor is used, if set; otherwise this action passed.

Typedefs

typedef int device_t
 Type describes device identifier.
typedef int result_t
 Type specifies result of any XIDC operation.

Enumerations

enum  DevState {
  DevStateOff, DevStateStop, DevStateMoving, DevStateTune,
  DevStateHoming, DevStateCalibr = 0x0C, DevStateAlarm = 0x0A
}
 

Describes motor state.

More...
enum  PwmState {
  PwmStateOff, PwmStateBrak, PwmStateRunfwd, PwmStateRunbck,
  PwmStateInvbrak
}
 

Describes PWM state.

More...
enum  SyncPinMode { PinGPIO = 0x00, PinSyncIn = 0x01, PinSyncOut = 0x02 }
 

Describes synchronization pin mode.

More...

Functions

Boards and drivers control

Functions for searching and opening/closing devices

device_t DCCONTROL_API open_device (const char *name)
 Open a device with OS name name and return identifier of the device which can be used in XIDC calls.
result_t DCCONTROL_API close_device (device_t id)
 Close specified device.
result_t DCCONTROL_API probe_device (const char *name)
 Check if a device with OS name name is XIMC device.
result_t DCCONTROL_API enumerate_devices (int *name_count, char ***names, int probe_devices)
 Enumerate all devices that looks like XIDC valid.
result_t DCCONTROL_API free_enumerate_devices (int name_count, char **names)
 Free memory returned by enumerate_devices.
result_t DCCONTROL_API init_device (device_t id)
 Init device.
result_t DCCONTROL_API deinit_device (device_t id)
 Deinit device.
result_t DCCONTROL_API get_device_information (device_t id, char *manufacturer, char *manufacturer_id, char *product_description)
 Return device information.
result_t DCCONTROL_API reset_locks ()
 Reset library locks in a case of deadlock.
Engine control

Main functions for controlling engine movement

result_t DCCONTROL_API command_move (device_t id, unsigned int pos)
 Move engine to position pos.
result_t DCCONTROL_API command_movr (device_t id, int offset)
 Move engine to the distance offset relatively to initial position.
result_t DCCONTROL_API command_left (device_t id)
 Start continous moving to the left.
result_t DCCONTROL_API command_right (device_t id)
 Start continous moving to the right.
result_t DCCONTROL_API command_stop (device_t id)
 Stop engine.
result_t DCCONTROL_API command_zero (device_t id)
 Reset current position to zero.
result_t DCCONTROL_API command_home (device_t id)
 Position calibrating Move in direction, defined by HOME_DIR_FAST (right, if set; otherwise - left) with speed home_settings_t::fast_home.
result_t DCCONTROL_API get_status (device_t id, state_t *state)
 Return device state.
Engine setup

Functions for adjusting engine read/write almost all controller settings

result_t DCCONTROL_API get_pwm_freq (device_t id, unsigned int *freq)
 Read pwm frequency.
result_t DCCONTROL_API set_pwm_freq (device_t id, unsigned int freq)
 Set pwm frequency.
result_t DCCONTROL_API get_feedback_settings (device_t id, unsigned int *ips, unsigned int *feedback_flags)
 Read feedback settings.
result_t DCCONTROL_API set_feedback_settings (device_t id, unsigned int ips, unsigned int feedback_flags)
 Set feedback settings.
result_t DCCONTROL_API get_move_settings (device_t id, unsigned int *rpm, unsigned int *accel, unsigned int *tuneup_threshold)
 Read specified motor shaft speed and acceleration.
result_t DCCONTROL_API set_move_settings (device_t id, unsigned int rpm, unsigned int accel, unsigned int tuneup_threshold)
 Set specified for this and next motion motor shaft speed and acceleration.
result_t DCCONTROL_API get_engine_settings (device_t id, engine_settings_t *engine_settings)
 Read engine settings.
result_t DCCONTROL_API set_engine_settings (device_t id, const engine_settings_t *engine_settings)
 Set engine settings.
result_t DCCONTROL_API get_secure_settings (device_t id, unsigned int *critical_curr, unsigned int *critical_voltage, unsigned int *critical_temp)
 Read engine voltage, current and temperature maxumum ratings.
result_t DCCONTROL_API set_secure_settings (device_t id, unsigned int critical_curr, unsigned int critical_voltage, unsigned int critical_temp)
 Set engine voltage, current and temperature maxumum ratings.
result_t DCCONTROL_API get_edges_settings (device_t id, int *border_flags, int *enders_flags, int *left, int *right)
 Read border and limit switches settings.
result_t DCCONTROL_API set_edges_settings (device_t id, int border_flags, int enders_flags, int left, int right)
 Set border and limit switches settings.
result_t DCCONTROL_API get_pid_settings (device_t id, pid_settings_t *pid_settings)
 Read PID settings.
result_t DCCONTROL_API set_pid_settings (device_t id, const pid_settings_t *pid_settings)
 Set PID settings.
result_t DCCONTROL_API get_sync_settings (device_t id, sync_settings_t *sync_settings)
 Read synchronization settings.
result_t DCCONTROL_API set_sync_settings (device_t id, const sync_settings_t *sync_settings)
 Set synchronization settings.
result_t DCCONTROL_API get_home_settings (device_t id, home_settings_t *home_settings)
 Read home settings.
result_t DCCONTROL_API set_home_settings (device_t id, const home_settings_t home_settings)
 Set home settings.
result_t DCCONTROL_API command_read_settings (device_t id)
 Read all settings from controller's flash memory to controller's RAM, replacing previous data in controller's RAM.
result_t DCCONTROL_API command_save_settings (device_t id)
 Save all settings from controller's RAM to controller's flash memory, replacing previous data in controller's flash memory.
result_t DCCONTROL_API get_serial_number (device_t id, uint32_t *serial)
 Read device serial number.
result_t DCCONTROL_API get_firmware_version (device_t id, unsigned int *major, unsigned int *minor, unsigned int *release)
 Read controller's firmware version.
result_t DCCONTROL_API get_analog_data (device_t id, analog_data_t *ad)
 Read analog data structure that contains raw analog data from ADC embedded on board.
result_t DCCONTROL_API get_chart_data (device_t id, chart_data_t *chart_data)
 Return device electrical parameters, useful for charts.
Service functions

Functions are intended for deep controller setup.

There is no necessity to use it during normal operation. These functions have to be used by skilled engineers only. If you want to use it please consult with the manufacturer. Wrong usage lead to device malfunction, can lead to irreversible damage of board

result_t DCCONTROL_API get_calibration_coeffs (device_t id, calibration_settings_t *cs)
 Read calibration coefficients.
result_t DCCONTROL_API set_calibration_coeffs (device_t id, const calibration_settings_t *cs)
 Set calibration coefficients.
device_t DCCONTROL_API open_raw_device (const char *name)
 Open a device with OS name name and return identifier of the device which can be used in XIDC calls.
result_t DCCONTROL_API set_serial_number (device_t id, uint32_t serial, uint32_t key)
 Write device serial number to controller's flash memory.
result_t DCCONTROL_API has_firmware (device_t id, uint8_t *ret)
 Check for firmware on device.
result_t DCCONTROL_API write_key (device_t id, uint32_t key)
 Write controller key.
result_t DCCONTROL_API command_calibrate (device_t id)
 Calibrate controller.
result_t DCCONTROL_API command_reset (device_t id)
 Reset controller.
result_t DCCONTROL_API command_update_firmware (device_t id, const uint8_t *data, uint32_t data_size)
 Update firmware.

Detailed Description

Header file for XIDCUSB library.


Define Documentation

#define DCCONTROL_API   __attribute__((visibility("default")))

Library import macros.

Macros allows to automatically import function from shared library. It automatically expands to dllimport on msvc when including header file

#define ENGINE_ACCEL_ON   0x0010

Acceleration enable flag.

If it set, motion begins with acceleration and ends with deceleration

#define ENGINE_ANTIPLAY   0x0008

Play compensation flag.

If it set, engine makes backlash (play) compensation procedure and reach the predetermined position accurately on low speed

#define ENGINE_FINISHING   0x0002

Fine tuneup flag.

If it set, engine makes special tuneup procedure and reach the predetermined end position accurately on low speed

#define ENGINE_MAX_SPEED   0x0004

Max speed flag.

If it is set, engine uses maxumum speed achievable with the present engine settings as nominal speed

#define ENGINE_ONLY_FINISHING   0x0400

Move in fine tuneup mode only if this flag set.

Do not use this flag in normal operation mode. It used for PID tuning only

#define ENGINE_REVERSE   0x0001

Reverse flag.

It determines motor shaft rotation direction that corresponds to feedback counts increasing. If not set (default), motor shaft rotation direction under positive voltage corresponds to feedback counts increasing and vice versa. Change it if you see that positive directions on motor and feedback are opposite

#define FEEDBACK_POTENTIOMETER   0x00

Describes feedback type.

See also:
set_feedback_settings
get_feedback_settings feedback by potentiometer.
#define HOME_DIR_FAST   0x01

Flag defines direction of 1st motion after execute home command.

Direction is right, if set; otherwise left.

#define HOME_DIR_SLOW   0x04

Flag defines direction of 2nd motion.

Direction is right, if set; otherwise left.

#define STATE_OVERLOAD_CURRENT   0x8000

Current overlaod encountered.

Motor current exceed maximum rating less then 1 ms

#define STATE_OVERLOAD_VOLTAGE   0x4000

Voltage overload encountered.

Voltage drop on motor exceed maximum rating less then 1 ms

#define TTL_SETUP_FRONT   0x0010

Synchronization In mode.

Response on front, if set. Response on cut, if not set

#define TTL_SYNCIN_DIRRIGHT   0x0008

Movement direction to the right, if set.

Used when TTL_SYNCIN_ONMOVE set


Enumeration Type Documentation

enum DevState

Describes motor state.

Enumerator:
DevStateOff 

motor is turned off.

DevStateStop 

motor is stopped.

DevStateMoving 

motor is moving.

DevStateTune 

motor is tuning.

DevStateHoming 

motor is going to home position.

DevStateCalibr 

motor is calibrating.

DevStateAlarm 

engine in alarm state.

enum PwmState

Describes PWM state.

Pulse-width modulation (PWM) module drive MOSFET full brige that control current through the motor

Enumerator:
PwmStateOff 

PWM is off, motor winding is cut off power.

PwmStateBrak 

braking mode, motor winding is closed.

PwmStateRunfwd 

motor running forward.

PwmStateRunbck 

motor running backward.

PwmStateInvbrak 

inverted braking mode.

Describes synchronization pin mode.

Enumerator:
PinGPIO 

GPIO.

PinSyncIn 

sync in.

PinSyncOut 

sync out.


Function Documentation

result_t DCCONTROL_API close_device ( device_t  id  ) 

Close specified device.

Parameters:
id an identifier of device
result_t DCCONTROL_API command_calibrate ( device_t  id  ) 

Calibrate controller.

Can be used by manufacturer only

Parameters:
id an identifier of device
result_t DCCONTROL_API command_home ( device_t  id  ) 

Position calibrating Move in direction, defined by HOME_DIR_FAST (right, if set; otherwise - left) with speed home_settings_t::fast_home.

If HOME_STOP_FAST is set, motor stops by synchronization input activity; otherwise - by limit switch. Shift in reverse direction to home_settings_t::home_delta with speed home_settings_t::slow_home. Move in direction, defined by HOME_DIR_SLOW (right, if set; otherwise - left) with speed home_settings_t::slow_home. If HOME_STOP_SLOW is set, motor stops by limit switch; otherwise - by synchronization input activity.

Parameters:
id an identifier of device
See also:
home_settings_t
get_home_settings
set_home_settings
result_t DCCONTROL_API command_left ( device_t  id  ) 

Start continous moving to the left.

Parameters:
id an identifier of device
result_t DCCONTROL_API command_move ( device_t  id,
unsigned int  pos 
)

Move engine to position pos.

Parameters:
pos position to move. Range: 0..4294967295
id an identifier of device
result_t DCCONTROL_API command_movr ( device_t  id,
int  offset 
)

Move engine to the distance offset relatively to initial position.

Parameters:
offset shift from initial position. Range: -2147483647..2147483647
id an identifier of device
result_t DCCONTROL_API command_read_settings ( device_t  id  ) 

Read all settings from controller's flash memory to controller's RAM, replacing previous data in controller's RAM.

Parameters:
id an identifier of device
result_t DCCONTROL_API command_reset ( device_t  id  ) 

Reset controller.

Can be used by manufacturer only

Parameters:
id an identifier of device
result_t DCCONTROL_API command_right ( device_t  id  ) 

Start continous moving to the right.

Parameters:
id an identifier of device
result_t DCCONTROL_API command_save_settings ( device_t  id  ) 

Save all settings from controller's RAM to controller's flash memory, replacing previous data in controller's flash memory.

Parameters:
id an identifier of device
result_t DCCONTROL_API command_stop ( device_t  id  ) 

Stop engine.

Parameters:
id an identifier of device
result_t DCCONTROL_API command_update_firmware ( device_t  id,
const uint8_t *  data,
uint32_t  data_size 
)

Update firmware.

Service command

Parameters:
id an identifier of device
data firmware byte stream
data_size size of byte stream
result_t DCCONTROL_API command_zero ( device_t  id  ) 

Reset current position to zero.

Parameters:
id an identifier of device
result_t DCCONTROL_API deinit_device ( device_t  id  ) 

Deinit device.

Return inited device to initial state. For comunication with this device use init_device function ones more time

Parameters:
id an identifier of device
result_t DCCONTROL_API enumerate_devices ( int *  name_count,
char ***  names,
int  probe_devices 
)

Enumerate all devices that looks like XIDC valid.

Value passed at name_count should specify size of allocated in names array. Strings in array names must be freed by free_enumerate_devices

Parameters:
[in,out] name_count count of found devices
[out] names pointer to allocated by caller array
[in] probe_devices probe devices if non-zero. Range: 0..INT_MAX
result_t DCCONTROL_API free_enumerate_devices ( int  name_count,
char **  names 
)

Free memory returned by enumerate_devices.

Value passed at name_count should specify size of allocated in names array

Parameters:
[in] name_count count of elements in names
[in] names memory with devices info
result_t DCCONTROL_API get_analog_data ( device_t  id,
analog_data_t ad 
)

Read analog data structure that contains raw analog data from ADC embedded on board.

This function used for device testing and deep recalibraton by manufacturer only

Parameters:
id an identifier of device
[out] ad analog data coefficients
result_t DCCONTROL_API get_calibration_coeffs ( device_t  id,
calibration_settings_t cs 
)

Read calibration coefficients.

This function fill structure with set of calibration data stored in controller's memory. There is no necessity to use it during normal operation. These data change after special device recalibraton only

See also:
set_calibration_coeffs
Parameters:
id an identifier of device
[out] cs calibration coefficients
result_t DCCONTROL_API get_chart_data ( device_t  id,
chart_data_t chart_data 
)

Return device electrical parameters, useful for charts.

Useful function that fill structure with snapshot of controller voltages and currents.

See also:
chart_data_t
Parameters:
id an identifier of device
[out] chart_data structure with snapshot of controller parameters.
result_t DCCONTROL_API get_device_information ( device_t  id,
char *  manufacturer,
char *  manufacturer_id,
char *  product_description 
)

Return device information.

Works with both raw or initialized device.

Parameters:
id an identifier of device
[out] manufacturer manufacturer name
[out] manufacturer_id identifier of manufacturer
[out] product_description product description
result_t DCCONTROL_API get_edges_settings ( device_t  id,
int *  border_flags,
int *  enders_flags,
int *  left,
int *  right 
)

Read border and limit switches settings.

See also:
set_edges_settings
Parameters:
id an identifier of device
[out] border_flags border flags, specify types of borders and motor behaviour on borders
[out] enders_flags ender flags, specify electrical behaviour of limit switches like order and pulled positions
[out] left left border position, used if BORDER_IS_ENCODER flag is set
[out] right right border position, used if BORDER_IS_ENCODER flag is set
result_t DCCONTROL_API get_engine_settings ( device_t  id,
engine_settings_t engine_settings 
)

Read engine settings.

This function fill structure with set of useful motor settings stored in controller's memory. These settings specify motor shaft movement algorithm, list of limitations and rated characteristics

See also:
set_engine_settings
Parameters:
id an identifier of device
[out] engine_settings engine settings
result_t DCCONTROL_API get_feedback_settings ( device_t  id,
unsigned int *  ips,
unsigned int *  feedback_flags 
)

Read feedback settings.

Parameters:
id an identifier of device
[out] ips number of encoder pulses per shaft revolution
[out] feedback_flags flags of feedback
result_t DCCONTROL_API get_firmware_version ( device_t  id,
unsigned int *  major,
unsigned int *  minor,
unsigned int *  release 
)

Read controller's firmware version.

Parameters:
id an identifier of device
[out] major major version
[out] minor minor version
[out] release release version
result_t DCCONTROL_API get_home_settings ( device_t  id,
home_settings_t home_settings 
)

Read home settings.

This function fill structure with settings of calibrating position

See also:
home_settings_t
Parameters:
id an identifier of device
[out] home_settings calibrating position settings
result_t DCCONTROL_API get_move_settings ( device_t  id,
unsigned int *  rpm,
unsigned int *  accel,
unsigned int *  tuneup_threshold 
)

Read specified motor shaft speed and acceleration.

Parameters:
id an identifier of device
[out] rpm motor shaft speed, RPM
[out] accel motor shaft acceleration, RPM/s
[out] tuneup_threshold threshold for enabling tuneup
result_t DCCONTROL_API get_pid_settings ( device_t  id,
pid_settings_t pid_settings 
)

Read PID settings.

This function fill structure with set of motor PID settings stored in controller's memory. These settings specify behaviour of PID routines for position, speed, voltage and current. These factors are slightly different for different positioners All boards are supplied with standart set of PID setting on controller's flash memory

See also:
set_pid_settings
Parameters:
id an identifier of device
[out] pid_settings pid settings
result_t DCCONTROL_API get_pwm_freq ( device_t  id,
unsigned int *  freq 
)

Read pwm frequency.

Parameters:
id an identifier of device
[out] freq frequency
result_t DCCONTROL_API get_secure_settings ( device_t  id,
unsigned int *  critical_curr,
unsigned int *  critical_voltage,
unsigned int *  critical_temp 
)

Read engine voltage, current and temperature maxumum ratings.

If one of these litims exceed engine will be stopped and de-energized, corresponding flag in state_t structuse will be set

See also:
state_t::flags
Parameters:
id an identifier of device
[out] critical_curr maxumum current rating, if it will be exceed STATE_OVERLOAD_CURRENT flag in state_t structuse will be set
[out] critical_voltage maxumum voltage rating, if it will be exceed STATE_OVERLOAD_VOLTAGE flag in state_t structure will be set
[out] critical_temp maxumum temperature rating, if it will be exceed STATE_OVERHEAT flag in state_t structuse will be set
result_t DCCONTROL_API get_serial_number ( device_t  id,
uint32_t *  serial 
)

Read device serial number.

Parameters:
id an identifier of device
[out] serial serial number
result_t DCCONTROL_API get_status ( device_t  id,
state_t state 
)

Return device state.

Useful function that fill structure with snapshot of controller status, including speed, position and boolean flags

Parameters:
id an identifier of device
[out] state structure with snapshot of controller status
result_t DCCONTROL_API get_sync_settings ( device_t  id,
sync_settings_t sync_settings 
)

Read synchronization settings.

This function fill structure with set synchronization settings, modes, periods and flags, that specify behaviour of synchronization In/Out. All boards are supplied with standart set of these settings

See also:
set_sync_settings
Parameters:
id an identifier of device
[out] sync_settings synchronization settings
result_t DCCONTROL_API has_firmware ( device_t  id,
uint8_t *  ret 
)

Check for firmware on device.

Parameters:
id an identifier of device
[out] ret non-zero if firmware existed
result_t DCCONTROL_API init_device ( device_t  id  ) 

Init device.

Parameters:
id an identifier of device
device_t DCCONTROL_API open_device ( const char *  name  ) 

Open a device with OS name name and return identifier of the device which can be used in XIDC calls.

Parameters:
[in] name - a device name - e.g. COM3 or /dev/tty.s123
device_t DCCONTROL_API open_raw_device ( const char *  name  ) 

Open a device with OS name name and return identifier of the device which can be used in XIDC calls.

Device can be raw, i.e. without firmware.

Parameters:
[in] name - a COM device name - e.g. COM3 or /dev/tty.s123
result_t DCCONTROL_API probe_device ( const char *  name  ) 

Check if a device with OS name name is XIMC device.

Be carefuly with this call because it sends some data to the device.

Parameters:
[in] name - a device name
result_t DCCONTROL_API set_calibration_coeffs ( device_t  id,
const calibration_settings_t cs 
)

Set calibration coefficients.

This function send structure with set of calibration data to controller's memory. Note that all boards are supplied with full set of right calibration data. There is no necessity to change it during normal operation. These data have to be changed after special hardware device recalibraton only. If you want to recalibrate board please consult with the manufacturer. Wrong calibration settings lead to device malfunction, can lead to irreversible damage of board

See also:
get_calibration_coeffs
Parameters:
id an identifier of device
[in] cs calibration coefficients
result_t DCCONTROL_API set_edges_settings ( device_t  id,
int  border_flags,
int  enders_flags,
int  left,
int  right 
)

Set border and limit switches settings.

Parameters:
id an identifier of device
[in] border_flags border flags, specify types of borders and motor behaviour on borders
[in] enders_flags ender flags, specify electrical behaviour of limit switches like order and pulled positions
[in] left left border position, used if BORDER_IS_ENCODER flag is set. Range: -2147483647..2147483647
[in] right right border position, used if BORDER_IS_ENCODER flag is set. Range: -2147483647..2147483647
result_t DCCONTROL_API set_engine_settings ( device_t  id,
const engine_settings_t engine_settings 
)

Set engine settings.

This function send structure with set of engine settings to controller's memory. These settings specify motor shaft movement algorithm, list of limitations and rated characteristics. Use it when you change motor, encoder, positioner etc. Please note that wrong engine settings lead to device malfunction, can lead to irreversible damage of board

See also:
get_engine_settings
Parameters:
id an identifier of device
[in] engine_settings engine settings
result_t DCCONTROL_API set_feedback_settings ( device_t  id,
unsigned int  ips,
unsigned int  feedback_flags 
)

Set feedback settings.

Parameters:
id an identifier of device
[in] ips number of encoder pulses per shaft revolution. Range: 1..65535
[in] feedback_flags flags of feedback
result_t DCCONTROL_API set_home_settings ( device_t  id,
const home_settings_t  home_settings 
)

Set home settings.

This function send structure with calibrating position settings to controller's memory.

See also:
home_settings_t
Parameters:
id an identifier of device
[in] home_settings calibrating position settings
result_t DCCONTROL_API set_move_settings ( device_t  id,
unsigned int  rpm,
unsigned int  accel,
unsigned int  tuneup_threshold 
)

Set specified for this and next motion motor shaft speed and acceleration.

Parameters:
id an identifier of device
[in] rpm Motor shaft speed, RPM. Range: 1..65535
[in] accel motor shaft acceleration, RPM/s. Range: 1..65535
[in] tuneup_threshold threshold for enabling tuneup. Range: 1..65535
result_t DCCONTROL_API set_pid_settings ( device_t  id,
const pid_settings_t pid_settings 
)

Set PID settings.

This function send structure with set of PID factors to controller's memory. These settings specify behaviour of PID routines for position, speed, voltage and current. These factors are slightly different for different positioners. All boards are supplied with standart set of PID setting on controller's flash memory. Please use it for loading new PID settings when you change positioner. Please note that wrong PID settings lead to device malfunction

See also:
get_pid_settings
Parameters:
id an identifier of device
[in] pid_settings pid settings
result_t DCCONTROL_API set_pwm_freq ( device_t  id,
unsigned int  freq 
)

Set pwm frequency.

Parameters:
id an identifier of device
[in] freq frequency. Range: 1000..65535
result_t DCCONTROL_API set_secure_settings ( device_t  id,
unsigned int  critical_curr,
unsigned int  critical_voltage,
unsigned int  critical_temp 
)

Set engine voltage, current and temperature maxumum ratings.

If one of these litims exceed engine will be stopped and de-energized, corresponding flag in state_t structuse will be set. Use this function when you change motor, encoder, positioner etc. Please note that wrong maxumum ratings can lead to irreversible damage of motor

See also:
state_t::flags
Parameters:
id an identifier of device
[in] critical_curr maxumum current rating, if it will be exceed STATE_OVERLOAD_CURRENT flag in state_t structure will be set. Range: 1..65535
[in] critical_voltage maxumum voltage rating, if it will be exceed STATE_OVERLOAD_VOLTAGE flag in state_t structure will be set. Range: 1..65535
[in] critical_temp maxumum temperature rating, if it will be exceed STATE_OVERHEAT flag in state_t structure will be set. Range: 0..65535
result_t DCCONTROL_API set_serial_number ( device_t  id,
uint32_t  serial,
uint32_t  key 
)

Write device serial number to controller's flash memory.

Can be used by manufacturer only

Parameters:
id an identifier of device
[in] serial serial number. Range: 0..4294967295
[in] key protection key. Range: 0..4294967295
result_t DCCONTROL_API set_sync_settings ( device_t  id,
const sync_settings_t sync_settings 
)

Set synchronization settings.

This function send structure with set of synchronization settings, that specify behaviour of synchronization In/Out, to controller's memory. All boards are supplied with standart set of these settings

See also:
get_sync_settings
Parameters:
id an identifier of device
[in] sync_settings synchronization settings
result_t DCCONTROL_API write_key ( device_t  id,
uint32_t  key 
)

Write controller key.

Can be used by manufacturer only

Parameters:
id an identifier of device
[in] key protection key. Range: 0..4294967295