Safety header
The Safety functions and the values of limit switch parameters are defined in the header file AxisConfiguration.h
. Notice that the values we provide are examples. You should customize the settings for your limit switches.
In AxisConfiguration.h
, your Safety code should be as follows:
#pragma once
/* Safety */
//Soft Limit switch
#define ENABLE_SOFTLIMIT_POSITIVE TRUE
#define ENABLE_SOFTLIMIT_NEGATIVE TRUE
//The position of the positive software limit switch.
#define SOFT_LIMIT_POSITIVE 15000
//The position of the negative software limit switch.
#define SOFT_LIMIT_NEGATIVE -15000
//Limit sensors
//Type of module containing the max sensor.
//TRUE for axis, FALSE for I/O module.
#define MAX_SENSOR_TYPE FALSE
//Index of an axis/module containing the sensor.
#define MAX_SENSOR_INDEX 0
//Offset of the sensor in the module input data.
#define MAX_SENSOR_OFFSET 0
//Invert the max sensor value.
#define MAX_SENSOR_INVERT FALSE
//Enable the max sensor value.
#define MAX_SENSOR_ENABLE TRUE
//Type of module containing the min sensor.
//TRUE for axis, FALSE for I/O module.
#define MIN_SENSOR_TYPE FALSE
//Index of an axis/module containing the sensor.
#define MIN_SENSOR_INDEX 0
//Offset of the sensor in the module input data.
#define MIN_SENSOR_OFFSET 0
//Invert the min sensor value.
#define MIN_SENSOR_INVERT FALSE
//Enable the min sensor value.
#define MIN_SENSOR_ENABLE TRUE
VOID SoftLimitSwitch(int Index);
VOID LimitSensor(int Index);
VOID LimitDirection(int Index);