#include <mcdc3006s.h>
Public Member Functions | |
int | activateLimits (int action) |
Activates/Deactivates the driver Limits. If the limits aren't activated the driver will NOT respect the Maximum or Minimum positions. | |
int | calibrateDriver (long int limit, int current_limit, int calibration_speed, int time_out) |
starts the calibration sequence of the drive | |
int | disableDriver () |
Disables the driver. | |
int | enableDriver () |
Enables the driver. | |
int | getDriverConf (driverConf_t *dc) |
Function that gets the current driver configuration as is stored in the flash memory of the driver and writes it in a driverConf_t type format. | |
int | getDriverCurLim () |
get the continous current limit (CCL) in mA. | |
int | getDriverInstantCurrent (int *current) |
asks for the instant velocity from sensor data of the driver. | |
int | getDriverInstantPos (long int *positon) |
asks for the instant position from sensor data of the driver. | |
int | getDriverInstantVel (long int *velocity) |
asks for the instant velocity from sensor data of the driver. | |
long int | getDriverMaxAcc () |
returns the maximum acceleration allowed by the driver. To set this value see | |
long int | getDriverMaxDec () |
returns the maximum decceleration allowed by the driver. To set this value see | |
long int | getDriverMaxPos () |
returns the maximum position allowed by the driver. To set this value see | |
long int | getDriverMaxVel () |
Returns the maximum speed allowed by the driver which is set with setDriverMaxVel() function. | |
long int | getDriverMinPos () |
This function reads from the driver min position from its flash memory. | |
int | getDriverPCurLim () |
get the Peak Current Limit (PCL) in mA. | |
int | getDriverSensor (driverSensor_t *sensor) |
asks for sensor data of the driver | |
int | getDriverStatus (driverStatus_t *drvStatus) |
Asks to the driver its current status. | |
int | init (int baudrate, char *dev, char *sem) |
high level functions | |
Mcdc3006s () | |
Empty constructor. | |
int | moveDriverAbsPos (long int pos) |
Sends to the driver the order to move to an absolute position in pulses. | |
int | moveDriverRelPos (long int pos) |
Sends to the driver the order to move to a relative position in pulses. | |
int | moveDriverVel (long int vel) |
Sends to the driver the order to move at a determined speed (in rpm) | |
int | saveToFlash () |
Save current configuartion params to FLASH memory of the drive, so the nest time the drive is turned on it loads thas configuration. WARNING!!! It should not be used more than 10,000 times because the FLASH memory could get damaged!!! | |
int | setDriverBaud (int baud) |
tells to the driver at which baudrate we want to operate | |
int | setDriverConf (driverConf_t dc) |
Function that configures the driver from a driverConf_t type. | |
int | setDriverCurLim (int cl) |
loads continous current limit | |
int | setDriverHomePosition (long int home) |
Sets the current positon as the given value. NOTE: Use only during the calibration phase. This function sends to the driver the Home command. The home commands tells to the driver which is the current position. For example If we send home = 0 we are telling to the driver that the current position is 0 position (and it should used as a reference). | |
int | setDriverMaxAcc (long int maxAcc) |
sets the maximum acceleration allowed by the driver in revolutions/s^2 | |
int | setDriverMaxDec (long int maxDec) |
sets the maximum deceleration allowed by the driver in revolutions/s^2 | |
int | setDriverMaxPos (long int maxPos) |
Sets the maximum absolute position in pulses. | |
int | setDriverMaxVel (long int maxVel) |
Sets the maximum speed allowed by the driver in rpm. | |
int | setDriverMinPos (long int minPos) |
Sets the minimum absolute position in pulses. | |
int | setDriverPCurLim (int pcl) |
loads peak current limit | |
~Mcdc3006s () | |
Destructor. | |
Private Attributes | |
Rs232 | _comm |
Definition at line 34 of file mcdc3006s.h.
Empty constructor.
Definition at line 30 of file mcdc3006s.cpp.
Destructor.
Definition at line 36 of file mcdc3006s.cpp.
int Mcdc3006s::activateLimits | ( | int | action | ) | [virtual] |
Activates/Deactivates the driver Limits. If the limits aren't activated the driver will NOT respect the Maximum or Minimum positions.
action | it only has two allowed values: ACTIVATE to activate de driver or DEACTIVATE to disºable de driver |
Implements MotorDriverInterface.
Definition at line 172 of file mcdc3006s.cpp.
int Mcdc3006s::calibrateDriver | ( | long int | limit, |
int | current_limit, | ||
int | calibration_speed, | ||
int | time_out | ||
) | [virtual] |
starts the calibration sequence of the drive
limit | sensor position in pulses measured from the desired 0 position |
currentLimit | max current the motor is not allowed to exceed (in mA) This limit is directly related to torque of the motor. |
calibrationSpeed | The speed of the motor during the calibration |
timeOut | maximum time (in milli seconds) to perform the calibration. If this time is exceeded the function will return an error. |
Error control here
Implements MotorDriverInterface.
Definition at line 677 of file mcdc3006s.cpp.
int Mcdc3006s::disableDriver | ( | ) | [virtual] |
Disables the driver.
Implements MotorDriverInterface.
Definition at line 71 of file mcdc3006s.cpp.
int Mcdc3006s::enableDriver | ( | ) | [virtual] |
Enables the driver.
Implements MotorDriverInterface.
Definition at line 57 of file mcdc3006s.cpp.
int Mcdc3006s::getDriverConf | ( | driverConf_t * | dc | ) | [virtual] |
Function that gets the current driver configuration as is stored in the flash memory of the driver and writes it in a driverConf_t type format.
dc | is the driverConf_t type where the driver configuration is stored |
Implements MotorDriverInterface.
Definition at line 85 of file mcdc3006s.cpp.
int Mcdc3006s::getDriverCurLim | ( | ) | [virtual] |
get the continous current limit (CCL) in mA.
WARNING: Untested Function
Implements MotorDriverInterface.
Definition at line 283 of file mcdc3006s.cpp.
int Mcdc3006s::getDriverInstantCurrent | ( | int * | current | ) | [virtual] |
asks for the instant velocity from sensor data of the driver.
current | is where the instant current data from the driver will be stored. The units from the driver are [rpm] |
Implements MotorDriverInterface.
Definition at line 427 of file mcdc3006s.cpp.
int Mcdc3006s::getDriverInstantPos | ( | long int * | positon | ) | [virtual] |
asks for the instant position from sensor data of the driver.
position | is a pointer pointing to where the position sensor data from the driver will be stored. The units from the driver are in [pulses] |
Implements MotorDriverInterface.
Definition at line 389 of file mcdc3006s.cpp.
int Mcdc3006s::getDriverInstantVel | ( | long int * | velocity | ) | [virtual] |
asks for the instant velocity from sensor data of the driver.
velocity | is where the velocity sensor data from the driver will be stored. The units from the driver are [rpm] |
Implements MotorDriverInterface.
Definition at line 408 of file mcdc3006s.cpp.
long int Mcdc3006s::getDriverMaxAcc | ( | ) | [virtual] |
returns the maximum acceleration allowed by the driver. To set this value see
Implements MotorDriverInterface.
Definition at line 247 of file mcdc3006s.cpp.
long int Mcdc3006s::getDriverMaxDec | ( | ) | [virtual] |
returns the maximum decceleration allowed by the driver. To set this value see
Implements MotorDriverInterface.
Definition at line 265 of file mcdc3006s.cpp.
long int Mcdc3006s::getDriverMaxPos | ( | ) | [virtual] |
returns the maximum position allowed by the driver. To set this value see
Implements MotorDriverInterface.
Definition at line 192 of file mcdc3006s.cpp.
long int Mcdc3006s::getDriverMaxVel | ( | ) | [virtual] |
Returns the maximum speed allowed by the driver which is set with setDriverMaxVel() function.
Implements MotorDriverInterface.
Definition at line 229 of file mcdc3006s.cpp.
long int Mcdc3006s::getDriverMinPos | ( | ) | [virtual] |
This function reads from the driver min position from its flash memory.
Implements MotorDriverInterface.
Definition at line 209 of file mcdc3006s.cpp.
int Mcdc3006s::getDriverPCurLim | ( | ) | [virtual] |
get the Peak Current Limit (PCL) in mA.
WARNING: Untested Function
Implements MotorDriverInterface.
Definition at line 300 of file mcdc3006s.cpp.
int Mcdc3006s::getDriverSensor | ( | driverSensor_t * | sensor | ) | [virtual] |
asks for sensor data of the driver
sensor | is the sensor structure where we want to store the sensor data from the driver. |
Implements MotorDriverInterface.
Definition at line 351 of file mcdc3006s.cpp.
int Mcdc3006s::getDriverStatus | ( | driverStatus_t * | drvStatus | ) | [virtual] |
Asks to the driver its current status.
drvStatus | is a structure where the current driver status is stored. Each of the parameters of the drvStatus are set to 1 if true or 0 if false |
Implements MotorDriverInterface.
Definition at line 317 of file mcdc3006s.cpp.
int Mcdc3006s::init | ( | int | baudrate, |
char * | dev, | ||
char * | sem | ||
) | [virtual] |
int Mcdc3006s::moveDriverAbsPos | ( | long int | pos | ) | [virtual] |
Sends to the driver the order to move to an absolute position in pulses.
p | absolute position in pulses |
Implements MotorDriverInterface.
Definition at line 605 of file mcdc3006s.cpp.
int Mcdc3006s::moveDriverRelPos | ( | long int | pos | ) | [virtual] |
Sends to the driver the order to move to a relative position in pulses.
p | relative position in pulses |
Implements MotorDriverInterface.
Definition at line 626 of file mcdc3006s.cpp.
int Mcdc3006s::moveDriverVel | ( | long int | vel | ) | [virtual] |
Sends to the driver the order to move at a determined speed (in rpm)
v | velocity in rpm (revolutions per minute) |
Implements MotorDriverInterface.
Definition at line 647 of file mcdc3006s.cpp.
int Mcdc3006s::saveToFlash | ( | ) | [virtual] |
Save current configuartion params to FLASH memory of the drive, so the nest time the drive is turned on it loads thas configuration. WARNING!!! It should not be used more than 10,000 times because the FLASH memory could get damaged!!!
The EEPSAV command always responds with the character string “EEPROM writing done” after successful saving of the current settings in the data Flash memory, or with “Flash defect”, if the save has failed.
Implements MotorDriverInterface.
Definition at line 156 of file mcdc3006s.cpp.
int Mcdc3006s::setDriverBaud | ( | int | baud | ) | [virtual] |
tells to the driver at which baudrate we want to operate
baud | is the baudrate of the communication. |
Implements MotorDriverInterface.
Definition at line 577 of file mcdc3006s.cpp.
int Mcdc3006s::setDriverConf | ( | driverConf_t | dc | ) | [virtual] |
Function that configures the driver from a driverConf_t type.
dc | is where dc configuration is read in order to write it into the driver |
Implements MotorDriverInterface.
Definition at line 128 of file mcdc3006s.cpp.
int Mcdc3006s::setDriverCurLim | ( | int | cl | ) | [virtual] |
loads continous current limit
cl | current limit in mA Range = [0 - 12000mA] |
Implements MotorDriverInterface.
Definition at line 545 of file mcdc3006s.cpp.
int Mcdc3006s::setDriverHomePosition | ( | long int | home | ) | [virtual] |
Sets the current positon as the given value. NOTE: Use only during the calibration phase. This function sends to the driver the Home command. The home commands tells to the driver which is the current position. For example If we send home = 0 we are telling to the driver that the current position is 0 position (and it should used as a reference).
home | is the given position in pulses. This parameter specifies which is the current position. |
Implements MotorDriverInterface.
Definition at line 662 of file mcdc3006s.cpp.
int Mcdc3006s::setDriverMaxAcc | ( | long int | maxAcc | ) | [virtual] |
sets the maximum acceleration allowed by the driver in revolutions/s^2
maxAcc | maximum acceleration in revolutions/s^2 |
Implements MotorDriverInterface.
Definition at line 513 of file mcdc3006s.cpp.
int Mcdc3006s::setDriverMaxDec | ( | long int | maxDec | ) | [virtual] |
sets the maximum deceleration allowed by the driver in revolutions/s^2
maxDec | maximum deceleration in r/sec² |
Implements MotorDriverInterface.
Definition at line 529 of file mcdc3006s.cpp.
int Mcdc3006s::setDriverMaxPos | ( | long int | maxPos | ) | [virtual] |
Sets the maximum absolute position in pulses.
maxPos | in pulses |
Implements MotorDriverInterface.
Definition at line 446 of file mcdc3006s.cpp.
int Mcdc3006s::setDriverMaxVel | ( | long int | maxVel | ) | [virtual] |
Sets the maximum speed allowed by the driver in rpm.
maxVel | in r.p.m. |
Implements MotorDriverInterface.
Definition at line 497 of file mcdc3006s.cpp.
int Mcdc3006s::setDriverMinPos | ( | long int | minPos | ) | [virtual] |
Sets the minimum absolute position in pulses.
minPos | is the minimum absolute position in pulses |
Implements MotorDriverInterface.
Definition at line 471 of file mcdc3006s.cpp.
int Mcdc3006s::setDriverPCurLim | ( | int | pcl | ) | [virtual] |
loads peak current limit
pcl | current limit in mA Range = [0 - 12000mA] |
Implements MotorDriverInterface.
Definition at line 561 of file mcdc3006s.cpp.
Rs232 Mcdc3006s::_comm [private] |
Definition at line 368 of file mcdc3006s.h.