Application programming interface for control of neMESYS via RS232. More...
#include "nem_rs232_api.h"
Macros | |
#define | CFGBIT_NEW_CONFIG (1 << 31) |
if bit 31 is set, then this device contains a new configuration | |
#define | CFGBIT_VALVE_INSTALLED 0x200 |
test bit for valve for old configuration word | |
#define | CFGBIT_VALVE_INSTALLED_NEW 0x01 |
test bit for valve for new configuration word | |
#define | CWBIT_FAULT_RESET 0x0080 |
controlword bit fault reset | |
#define | CWBIT_HALT 0x0100 |
controlword bit halt | |
#define | CWBIT_HOMING_START 0x0010 |
controlword bit start homing move | |
#define | CWBIT_IMMEDIATELY 0x0020 |
change set immediately | |
#define | CWBIT_NEW_SET_POINT 0x0010 |
new set point | |
#define | CWBIT_OP_EN 0x0008 |
controlword bit operation enabled | |
#define | CWBIT_QUICK_STOP 0x0004 |
controlword bit quick stop | |
#define | CWBIT_RELATIVE 0x0040 |
target position is an relative value | |
#define | CWBIT_SWON 0x0001 |
controlword bit switch on | |
#define | CWBIT_VOLT_EN 0x0002 |
controlword bit voltage enabled | |
#define | DRV_PROC_TIME 10 |
processing time | |
#define | STATE_IS_FAULT(_wState_) (((_wState_) & 0x004F) == SW_FAULT) |
Checks if state is fault. | |
#define | STATE_IS_FAULT_REAC(_wState_) (((_wState_) & 0x004F) == SW_FAULT_REAC) |
Checks if state is fault reaction active. | |
#define | STATE_IS_OP_EN(_wState_) (((_wState_) & 0x006F) == SW_OP_EN) |
Checks if state is operation enabled. | |
#define | STATE_IS_QUICK_STOP(_wState_) (((_wState_) & 0x006F) == SW_QUICK_STOP) |
Checks if state is quick stop. | |
#define | STATE_IS_SWON(_wState_) (((_wState_) & 0x006F) == SW_SWON) |
Checks if state is switch on. | |
#define | STATE_IS_SWON_DIS(_wState_) (((_wState_) & 0x004F) == SW_SWON_DIS) |
Checks if state is disabled. | |
#define | STATE_IS_SWON_NOT_RDY(_wState_) (((_wState_) & 0x004F) == SW_SWON_NOT_RDY) |
Checks if state is not ready to witch on. | |
#define | STATE_IS_SWON_RDY(_wState_) (((_wState_) & 0x006F) == SW_SWON_RDY) |
Checks if state is ready to switch on. | |
#define | SWBIT_FAULT 0x0008 |
fault | |
#define | SWBIT_HOMING_ATTAINED 0x1000 |
homing position attained | |
#define | SWBIT_HOMING_ERROR 0x2000 |
homing error occured | |
#define | SWBIT_INT_LIM 0x0800 |
internal limit active | |
#define | SWBIT_OP_EN 0x0004 |
operation enabled | |
#define | SWBIT_QUICK_STOP 0x0020 |
quick stop | |
#define | SWBIT_REMOTE 0x0200 |
remote | |
#define | SWBIT_SWON 0x0002 |
switched on | |
#define | SWBIT_SWON_DIS 0x0040 |
switch on disabled | |
#define | SWBIT_SWON_RDY 0x0001 |
ready to switch on | |
#define | SWBIT_TARG_REACHED 0x0400 |
target reached | |
#define | SWBIT_VOLT_EN 0x0010 |
voltage enabled | |
#define | SWBIT_WARNING 0x0080 |
warning | |
Typedefs | |
typedef enum eCtrlWord | TCtrlWord |
Control words of object dictionary entry OD_H6040_CTRL_WORD. | |
typedef enum eCustMemId | TCustMemId |
Object dictionary sub indexes of OD_H200C_CUST_PERSISTENT_MEM The custom memory in EPOS stores various configuration values. | |
typedef enum eDigOutFunc | TDigOutFunc |
Digital out functionalities sub index. | |
typedef enum eDigOutFunction | TDigOutFunction |
Function of digital outputs. | |
typedef enum eDigOutPurpose | TDigOutPurpose |
EPOS sepecific purpose of digital outputs | |
typedef enum eErrHistSub | TErrHistSub |
Error history sub indexes. | |
typedef enum eHomingModes | THomingMode |
Homing methods. | |
typedef enum eNemObjDicEntries | TNemObjDicEntries |
Object dictionary entries. | |
typedef enum eNemOpModes | TNemOpModes |
Enumeration of nemesys deviceoperation modes. | |
typedef enum eStatusWord | TStatusWord |
Status words of object dictionary entry OD_H6041_STATUS_WORD. | |
Enumerations | |
enum | eCtrlWord { CW_SHUTDOWN = 0x06, CW_SWON = 0x07, CW_VOLT_DIS = 0x00, CW_QUICK_STOP = 0x02, CW_OP_DIS = 0x07, CW_OP_EN = 0x0F, CW_FAULT_RST = 0x80, CW_UNDEFINED = 0xFF, CW_SHUTDOWN = 0x06, CW_SWON = 0x07, CW_VOLT_DIS = 0x00, CW_QUICK_STOP = 0x02, CW_OP_DIS = 0x07, CW_OP_EN = 0x0F, CW_FAULT_RST = 0x80, CW_UNDEFINED = 0xFF } |
Control words of object dictionary entry OD_H6040_CTRL_WORD. More... | |
enum | eCustMemId { CUST_MEM_AXIS_LEN = 2, CUST_MEM_AXIS_CONF = 3 } |
Object dictionary sub indexes of OD_H200C_CUST_PERSISTENT_MEM The custom memory in EPOS stores various configuration values. More... | |
enum | eDigOutFunc { SUB_01_DIG_OUT_STATE = 1, SUB_02_DIG_OUT_MASK, SUB_03_DIG_OUT_POLARITY } |
Digital out functionalities sub index. | |
enum | eDigOutFunction { DIG_OUT_VALVE_SWITCH = DIG_OUT_GENERAL_PURPOSE_C, DIG_OUT_VALVE_8V = DIG_OUT_GENERAL_PURPOSE_D } |
Function of digital outputs. More... | |
enum | eDigOutPurpose { DIG_OUT_GENERAL_PURPOSE_A = 0x010000, DIG_OUT_GENERAL_PURPOSE_B = 0x100000, DIG_OUT_GENERAL_PURPOSE_A = 0x8000, DIG_OUT_GENERAL_PURPOSE_B = 0x4000, DIG_OUT_GENERAL_PURPOSE_C = 0x2000, DIG_OUT_GENERAL_PURPOSE_D = 0x1000 } |
EPOS sepecific purpose of digital outputs | |
enum | eErrHistSub { H1003_SUB_01_NUMBER_OF_ERR = 0, H1003_SUB_01_ERR_IDX_1 = 1, H1003_SUB_01_NUMBER_OF_ERR = 0, H1003_SUB_01_ERR_IDX_1 = 1 } |
Error history sub indexes. | |
enum | eHomingModes { HM_POS_LIM = 18, HM_ACTUAL_POSITION = 35 } |
Homing methods. More... | |
enum | eNemObjDicEntries { NemV4_OD_H1003_ERROR_HISTORY = 0x1003, NemV4_OD_H210C_CUSTOM_PERSISTENT_MEM = 0x210C, NemV4_OD_H3000_AXIS_CONFIGURATION = 0x3000, NemV4_OD_H3003_GEAR_CONFIGURATION = 0x3003, NemV4_OD_H3141_DIG_INPUTS_PROPERTIES = 0x3141, NemV4_OD_H3160_ANALOG_INPUT = 0x3160, NemV4_OD_H3182_ANALOG_OUT = 0x3182, NemV4_OD_H6040_CTRL_WORD = 0x6040, NemV4_OD_H6041_STATUS_WORD = 0x6041, NemV4_OD_H6060_OP_MODE = 0x6060, NemV4_OD_H6064_ACTUAL_POSITION = 0x6064, NemV4_OD_H606B_VELOCITY_DEMAND = 0x606B, NemV4_OD_H607A_TARGET_POSITION = 0x607A, NemV4_OD_H607D_SW_POS_LIMITS = 0x607D, NemV4_OD_H607F_PROFILE_VELOCITY_MAX = 0x607F, NemV4_OD_H6081_PROFILE_VELOCITY = 0x6081, NemV4_OD_H60A9_SI_UNIT_VELOCITY = 0x60A9, NemV4_OD_H60AA_SI_UNIT_ACCELERATION = 0x60AA, NemV4_OD_H60FD_DIGITAL_INPUTS = 0x60FD, NemV4_OD_H60FE_DIG_OUT = 0x60FE, NEM_OD_H1003_ERROR_HISTORY = 0x1003, NEM_OD_H200C_CUSTOM_PERSISTENT_MEM = 0x200C, NEM_OD_H2078_DIGITAL_OUT_FUNC = 0x2078, NEM_OD_H2081_HOME_POSITION = 0x2081, NEM_OD_H6040_CTRL_WORD = 0x6040, NEM_OD_H6041_STATUS_WORD = 0x6041, NEM_OD_H6060_OP_MODE = 0x6060, NEM_OD_H6064_ACTUAL_POSITION = 0x6064, NEM_OD_H606B_VELOCITY_DEMAND = 0x606B, NEM_OD_H607A_TARGET_POSITION = 0x607A, NEM_OD_H607C_HOME_OFFSET = 0x607C, NEM_OD_H6081_PROFILE_VELOCITY = 0x6081, NEM_OD_H6098_HOMING_METHOD = 0x6098, NEM_OD_H6099_HOMING_SPEEDS = 0x6099 } |
Object dictionary entries. | |
enum | eNemOpModes { NemV4_OP_MODE_PROFILE_POSITION = 1, NemV4_OP_MODE_HOMING = 6, NEM_OP_MODE_PROFILE_POSITION = 1, NEM_OP_MODE_HOMING = 6 } |
Enumeration of nemesys deviceoperation modes. More... | |
enum | eStatusWord { SW_SWON_NOT_RDY = 0x00, SW_SWON_DIS = 0x40, SW_SWON_RDY = 0x21, SW_SWON = 0x23, SW_OP_EN = 0x27, SW_QUICK_STOP = 0x07, SW_FAULT_REAC = 0x0F, SW_FAULT = 0x08, SW_UNDEFINED = 0xFF, SW_SWON_NOT_RDY = 0x00, SW_SWON_DIS = 0x40, SW_SWON_RDY = 0x21, SW_SWON = 0x23, SW_OP_EN = 0x27, SW_QUICK_STOP = 0x07, SW_FAULT_REAC = 0x0F, SW_FAULT = 0x08, SW_UNDEFINED = 0xFF } |
Status words of object dictionary entry OD_H6041_STATUS_WORD. More... | |
Functions | |
static long | Nem_ClearErrHist (TNemesys *Nemesys) |
Clears the device error history and error register. More... | |
static long | Nem_ExecDrvStateCmd (TNemesys *Nemesys, uint16_t wCmd, uint16_t *pwState, uint16_t wProcessTime) |
Execute one single drive state command. More... | |
static long | Nem_GetAxisLen (TNemesys *Nemesys, uint32_t *pAxisLen) |
Reads the absolut axis length in increments from device. More... | |
static long | Nem_GetDevCfg (TNemesys *Nemesys, uint32_t *NemesysCfg) |
Reads device configuration (gear, encoder spindle slope, valve). More... | |
static long | Nem_GetHomeOffset (TNemesys *Nemesys, int32_t *pHomeOffset) |
Read the home ofset from the device. More... | |
static long | Nem_GetPosIs (TNemesys *Nemesys, int32_t *pdwPosIs) |
Query actual device position value. More... | |
static long | Nem_IsState (TNemesys *Nemesys, uint16_t wMask, uint16_t wState, uint8_t *pResult) |
Test the status word for a certain bit pattern. More... | |
static long | Nem_MoveToPos (TNemesys *Nemesys, int32_t dwPosAbs, uint32_t dwVelocity) |
Move pusher to a certain position. More... | |
static long | Nem_SetControlWord (TNemesys *Nemesys, uint16_t wControlWord) |
Transmits the controlword to the device. More... | |
static long | Nem_SetHomePos (TNemesys *Nemesys, int32_t dwHomePos) |
Set the value of the psotion counter on end of refernce move. More... | |
static long | Nem_SetHomingMode (TNemesys *Nemesys, THomingMode Mode) |
Change homing mode for refernce move. More... | |
static long | Nem_SetHomingSpeed (TNemesys *Nemesys, uint32_t Velocity) |
Change speed for calibration move. More... | |
static long | Nem_SetOpMode (TNemesys *Nemesys, TNemOpModes OpMode) |
Change operation mode of neMESYS device. More... | |
long | NemCalibrate (TNemesys *Nemesys, uint32_t Velocity) |
Execute reference move (homing move) for single dosing unit. More... | |
long | NemClearFault (TNemesys *Nemesys) |
Clear fault state of device. More... | |
long | NemDevInit (struct CsiBus *Bus, uint8_t NodeId, TNemesys *Nemesys) |
Initialize neMESYS device object with all parameters This function reads configuration parameters from device and stores the parameters into the device object. More... | |
long | NemDoseVolume (TNemesys *Nemesys, uint32_t dwVolume, int32_t dwFlowRate) |
Dose a certain volume with a certain flowrate. More... | |
long | NemGenerateConstantFlow (TNemesys *Nemesys, int32_t FlowRate) |
Generate a constant flow rate. More... | |
long | NemGetFlowRate (TNemesys *Nemesys, int32_t *pFlowRate) |
Query actual flow rate of dosing unit. More... | |
long | NemGetLastDevErr (TNemesys *Nemesys, int32_t *pLastDevErr) |
Read last device error from error register. More... | |
long | NemGetSyringeLevel (TNemesys *Nemesys, int32_t *pSyringeLevel) |
Query actual syringe fill level. More... | |
long | NemIsCalibrationFinished (TNemesys *Nemesys) |
Checks if a dosing unit finished the calibration move. More... | |
long | NemIsDosingFinished (TNemesys *Nemesys) |
Checks if a dosing unit finished the last dosing task. More... | |
uint32_t | NemIsEnabled (TNemesys *Nemesys) |
Check if device is in enabled state. More... | |
uint32_t | NemIsInFaultState (TNemesys *Nemesys) |
Query fault state of device Check if device is in fault state. More... | |
uint8_t | NemIsValveInstalled (TNemesys *Nemesys) |
Checks the device configuration if a valve is installed. More... | |
uint32_t | NemIsValveStateDispense (TNemesys *Nemesys) |
Check if valve is switched to dispense state (output). More... | |
long | NemReadStatusWord (TNemesys *Nemesys, uint16_t *pwStatusWord) |
Read status word from device The bits of the statusword indicate the current state of the drive. More... | |
long | NemRestorePos (TNemesys *Nemesys, int32_t dwPos) |
Restore position value. More... | |
long | NemSetEnabled (TNemesys *Nemesys) |
Set single dosing unit into enable state. More... | |
long | NemSetSyringeLevel (TNemesys *Nemesys, uint32_t dwSyringeLevel, uint32_t dwFlowRate) |
Set syringe to a certain fill level. More... | |
long | NemStop (TNemesys *Nemesys) |
Stops actual dosing move. More... | |
long | NemSwitchValve (TNemesys *Nemesys, uint8_t SwitchToDispense) |
Switch the integrated three way valve (if one is installed). More... | |
Detailed Description
Application programming interface for control of neMESYS via RS232.
- Date
- 2019/03/12
Enumeration Type Documentation
enum eCtrlWord |
Control words of object dictionary entry OD_H6040_CTRL_WORD.
enum eCustMemId |
Object dictionary sub indexes of OD_H200C_CUST_PERSISTENT_MEM The custom memory in EPOS stores various configuration values.
Enumerator | |
---|---|
CUST_MEM_AXIS_LEN |
axis length in encoder increments |
CUST_MEM_AXIS_CONF |
axis configuration |
enum eDigOutFunction |
enum eHomingModes |
enum eNemOpModes |
Enumeration of nemesys deviceoperation modes.
enum eStatusWord |
Status words of object dictionary entry OD_H6041_STATUS_WORD.
Function Documentation
|
static |
Clears the device error history and error register.
The device keeps track of the errors that occured with an internal error history. The function NemClerFault() calls this function to clear the error history.
- Parameters
-
[in] Nemesys The device to change
- Returns
- Error code - ERR_NOERR indicates success
Referenced by NemClearFault().
|
static |
Execute one single drive state command.
The function excutes one drive state command, waits a certain amount of time for the drive to process the command (wProcessTime) and then reads the statusword of the device and returns it to the application.
- Parameters
-
[in] Nemesys The device to query [in] wCmd The command to execute [out] pwState State of the devcie after execution of the command in wCmd [in] wProcessTime Time between sending the command and reading the status
- Returns
- Error code - ERR_NOERR indicates success
Referenced by NemSetEnabled().
|
static |
Reads the absolut axis length in increments from device.
The axis length is the length in increments between the upper limit sensor and the lower limit sensor. Normally the pusher should never reach the upper or lower limit sensor. If the pusher moves into a limit sensr, the drive is stopped immediatelly and the device goes into fault state. The application then needs to call NemClearFault() and NemSetOperational() to continue dosing. If the device moves into a limit sensor, then a calibration should be excuted.
- Parameters
-
[in] Nemesys The device to query [out] pAxisLen Stores the axis length in increments
- Returns
- Error code - ERR_NOERR indicates success
Referenced by NemDevInit().
|
static |
Reads device configuration (gear, encoder spindle slope, valve).
This function is called from NemInitDev() to initialize the nemesys device object.
- Parameters
-
[in] Nemesys The device to query [out] NemesysCfg Stores the device configuration word.
- Returns
- Error code - ERR_NOERR indicates success
Referenced by NemDevInit().
|
static |
Read the home ofset from the device.
The pusher of the neMESYS device travels between the upper and lower limit sensors. The home offset defines the range between the zero position and the lower limit sensor and between the maximum position and the upper limit sensor. So the maximum position is the axis length (Nem_GetAxisLen()) minus 2 x the home offset. This ensures that the device never reaches the limit sensors during normal operation. The value of the home offset depends on device configuration (gear, spindle slope, encoder...) and is stored in custom persistent memory.
- Parameters
-
[in] Nemesys The device to query [out] pHomeOffset Stores the home offset
- Returns
- Error code - ERR_NOERR indicates success
Referenced by NemDevInit().
|
static |
Query actual device position value.
- Parameters
-
[in] Nemesys The device to move [out] pdwPosIs Store position is in increments
- Returns
- Error code - ERR_NOERR indicates success
Referenced by NemDoseVolume(), NemGetSyringeLevel(), and NemSetSyringeLevel().
|
static |
Test the status word for a certain bit pattern.
The function applies the mask to the status word and checks if the masked statusword matches the bitpattern in state.
- Parameters
-
[in] Nemesys The device to query [in] wMask The bitmask to apply to device statusword [in] wState The state bitmask to check [out] pResult Result of the test (0 = false, 1 = true)
- Returns
- Error code - ERR_NOERR indicates success
Referenced by NemIsCalibrationFinished(), NemIsDosingFinished(), NemIsEnabled(), and NemIsInFaultState().
|
static |
Move pusher to a certain position.
This is a private low level function that is called from public API functions to execute dosing tasks. This function performs basic steps like range checking, position value translation and transmission of positon values to device.
- Parameters
-
[in] Nemesys The device to move [in] dwPosAbs The position value in increments [in] dwVelocity The speed in mrpm (milli revolution per minute)
- Returns
- Error code - ERR_NOERR indicates success
Referenced by NemDoseVolume(), NemGenerateConstantFlow(), and NemSetSyringeLevel().
|
static |
Transmits the controlword to the device.
Call this function to change th controlword.
- Parameters
-
[in] Nemesys The device to change [in] wControlWord The new controlword to store into device
- Returns
- Error code - ERR_NOERR indicates success
Referenced by Nem_ExecDrvStateCmd(), Nem_MoveToPos(), NemCalibrate(), NemClearFault(), NemRestorePos(), and NemStop().
|
static |
Set the value of the psotion counter on end of refernce move.
If device finishes calibration, the home position is loaded into the position counter. Normally if a reference move is executed, the home position should be 0.
- Parameters
-
[in] Nemesys The device to change [in] dwHomePos Home position to store in position counter after refernece move
- Returns
- Error code - ERR_NOERR indicates success
Referenced by NemCalibrate(), and NemRestorePos().
|
static |
Change homing mode for refernce move.
Call this function the set the homing method for reference move. The following homing methods are supported: If a calibration move is executed the function NemCalibrate() calls this private function to set the speed of the homing move.
- Parameters
-
[in] Nemesys The device to change [in] Mode Homing mode to set - HM_POS_LIM: Homing move to positive limit switch
- HM_ACTUAL_POSITION: Take actual position as home
- Returns
- Error code - ERR_NOERR indicates success
Referenced by NemCalibrate(), and NemRestorePos().
|
static |
Change speed for calibration move.
If a calibration move is executed the function NemCalibrate() calls this private function to set the speed of the homing move.
- Parameters
-
[in] Nemesys The device to change [in] Velocity The speed in mrpm (milli revolutions per minute)
- Returns
- Error code - ERR_NOERR indicates success
Referenced by NemCalibrate().
|
static |
Change operation mode of neMESYS device.
A neMESYS device can operate in two different operation modes. During normal dosing the device works in profile position mode (NEM_OP_MODE_PROFILE_POSITION). During calibration the device is in homing mode (NEM_OP_MODE_HOMING).
- Parameters
-
[in] Nemesys The device to change [in] OpMode The new operation mode to set
- Returns
- Error code - ERR_NOERR indicates success
Referenced by Nem_MoveToPos(), NemCalibrate(), NemDevInit(), and NemRestorePos().