Tic Stepper Motor Controller library for Arduino
|
#include <Tic.h>
Protected Attributes | |
uint8_t | _lastError = 0 |
This is a base class used to represent a connection to a Tic. This class provides high-level functions for sending commands to the Tic and reading data from it.
|
inline |
|
inline |
De-energizes the stepper motor coils.
Example usage:
This function sends a De-energize command to the Tic, causing it to disable its stepper motor driver. The motor will stop moving and consuming power. The Tic will set the "Intentionally de-energized" error bit, turn on its red LED, and drive its ERR line high. This command also sets the "Position uncertain" flag (because the Tic is no longer in control of the motor's position).
Note that the Energize command, which can be sent with energize(), will undo the effect of this command (except it will leave the "Position uncertain" flag set) and could make the system start up again.
See also haltAndHold().
|
inline |
|
inline |
Sends the "Enter safe start" command.
Example usage:
This command has no effect if safe-start is disabled in the Tic's settings.
In Serial/I2C/USB control mode, this command causes the Tic to stop the motor and set its safe start violation error bit. An "Exit safe start" command is required before the Tic will move the motor again.
See the Tic user's guide for information about what this command does in the other control modes.
|
inline |
|
inline |
Gets the acting target position, in microsteps.
This is a variable used in the Tic's target position step planning algorithm, and it could be invalid while the motor is stopped.
This is mainly intended for getting insight into how the Tic's algorithms work or troubleshooting issues, and most people should not use this.
|
inline |
Gets the AGC bottom current limit.
This is only valid for the Tic T249.
See also setAgcBottomCurrentLimit().
|
inline |
Gets the AGC current boost steps.
This is only valid for the Tic T249.
See also setAgcCurrentBoostSteps().
|
inline |
|
inline |
|
inline |
Gets the analog reading from the specified pin.
The reading is left-justified, so 0xFFFF represents a voltage equal to the Tic's 5V pin (approximately 4.8 V).
Returns TicInputNull if the analog reading is disabled or not ready.
Example usage:
uint16_t TicBase::getCurrentLimit | ( | ) |
Gets the stepper motor coil current limit in milliamps.
This is the value being used now, which could differ from the value in the Tic's settings.
Example usage:
By default, this function assumes you are using a Tic T825 or Tic T834. If you are using a different kind of Tic, we recommend calling setProduct() some time before calling getCurrentLimit().
See also setCurrentLimit().
|
inline |
Gets the current position of the stepper motor, in microsteps.
Note that this just tracks steps that the Tic has commanded the stepper driver to take; it could be different from the actual position of the motor for various reasons.
For an example of how to use this this, see the SerialPositionControl example or the I2CPositionControl exmaple.
See also haltAndSetPosition().
|
inline |
Gets the current velocity of the stepper motor, in microsteps per 10000 seconds.
Note that this is just the velocity used in the Tic's step planning algorithms, and it might not correspond to the actual velocity of the motor for various reasons.
Example usage:
|
inline |
|
inline |
|
inline |
|
inline |
Gets the raw encoder count measured from the Tic's RX and TX lines.
Example usage:
|
inline |
|
inline |
Gets the errors that have occurred since the last time this function was called.
Note that the Tic Control Center constantly clears the bits in this register, so if you are running the Tic Control Center then you will not be able to reliably detect errors with this function.
Each bit in the returned register represents a different error. The bits are defined in TicError enum.
Example usage:
|
inline |
Gets the errors that are currently stopping the motor.
Each bit in the returned register represents a different error. The bits are defined in TicError enum.
Example usage:
|
inline |
|
inline |
|
inline |
Gets the value of the Tic's main input after scaling has been applied.
If the input is valid, this number is the target position or target velocity specified by the input.
Example usage:
See also getInputState().
|
inline |
Gets the current state of the Tic's main input.
Example usage:
See TicInputState for more information.
|
inline |
|
inline |
|
inline |
|
inline |
Gets the maximum acceleration, in microsteps per second per 100 seconds.
This is the current value, which could differ from the value in the Tic's settings.
Example usage:
See also setMaxAccel().
|
inline |
Gets the maximum deceleration, in microsteps per second per 100 seconds.
This is the current value, which could differ from the value in the Tic's settings.
Example usage:
See also setMaxDecel().
|
inline |
Gets the current maximum speed, in microsteps per 10000 seconds.
This is the current value, which could differ from the value in the Tic's settings.
See also setMaxSpeed().
|
inline |
Gets the Tic's current operation state, which indicates whether it is operating normally or in an error state.
Example usage:
For more information, see the "Error handling" section of the Tic user's guide.
|
inline |
Gets the current state of a pin, i.e. what kind of input or output it is.
Note that the state might be misleading if the pin is being used as a serial or I2C pin.
Example usage:
|
inline |
Returns the current planning mode for the Tic's step generation code.
This tells us whether the Tic is sending steps, and if it is sending steps, tells us whether it is in Target Position or Target Velocity mode.
Example usage:
|
inline |
|
inline |
Gets the raw pulse width measured on the Tic's RC input, in units of twelfths of a microsecond.
Returns TicInputNull if the RC input is missing or invalid.
Example usage:
|
inline |
Gets a contiguous block of settings from the Tic's EEPROM.
The maximum length that can be fetched is 15 bytes.
Example usage:
This library does not attempt to interpret the settings and say what they mean. If you are interested in how the settings are encoded in the Tic's EEPROM, see the "Settings reference" section of the Tic user's guide.
|
inline |
Gets the starting speed in microsteps per 10000 seconds.
This is the current value, which could differ from the value in the Tic's settings.
Example usage:
See also setStartingSpeed().
|
inline |
|
inline |
Gets the target position, in microsteps.
This is only relevant if the planning mode from getPlanningMode() is TicPlanningMode::Position.
See also setTargetPosition().
|
inline |
Gets the target velocity, in microsteps per 10000 seconds.
This is only relevant if the planning mode from getPlanningMode() is TicPlanningMode::Velocity.
See also setTargetVelocity().
|
inline |
Gets the time since the last step, in timer ticks.
Each timer tick represents one third of a microsecond. The Tic only updates this variable every 5 milliseconds or so, and it could be invalid while the motor is stopped.
This is mainly intended for getting insight into how the Tic's algorithms work or troubleshooting issues, and most people should not use this.
|
inline |
|
inline |
|
inline |
Tells the Tic to start its homing procedure in the forward direction.
See the "Homing" section of the Tic user's guide for details.
See also goHomeReverse().
|
inline |
Tells the Tic to start its homing procedure in the reverse direction.
See the "Homing" section of the Tic user's guide for details.
See also goHomeForward().
|
inline |
Stops the motor abruptly without respecting the deceleration limit.
Example usage:
This function sends a "Halt and hold" command to the Tic. Besides stopping the motor, this command also sets the "Position uncertain" flag (because the abrupt stop might cause steps to be missed), sets the "Input state" to "halt", and clears the "Input after scaling" variable.
If the control mode is something other than Serial/I2C/USB, ths command will be silently ignored.
See also deenergize().
|
inline |
Stops the motor abruptly without respecting the deceleration limit and sets the "Current position" variable, which represents where the Tic currently thinks the motor's output is.
Example usage:
This function sends a "Halt and set position" command to the Tic. Besides stopping the motor and setting the current position, this command also clears the "Postion uncertain" flag, sets the "Input state" to "halt", and clears the "Input after scaling" variable.
If the control mode is something other than Serial, this command will be silently ignored.
|
inline |
|
inline |
|
inline |
Temporarily sets the AGC bottom current limit.
This is only valid for the Tic T249.
See also getAgcBottomCurrentLimit().
|
inline |
Temporarily sets the AGC current boost steps.
This is only valid for the Tic T249.
See also getAgcCurrentBoostSteps().
|
inline |
Temporarily sets the AGC frequency limit.
This is only valid for the Tic T249.
See also getAgcFrequencyLimit().
|
inline |
void TicBase::setCurrentLimit | ( | uint16_t | limit | ) |
Temporarily sets the stepper motor coil current limit in milliamps. If the desired current limit is not available, this function uses the closest current limit that is lower than the desired one.
When converting the current limit from milliamps to a code to send to the Tic, this function needs to know what kind of Tic you are using. By default, this function assumes you are using a Tic T825 or Tic T834. If you are using a different kind of Tic, we recommend calling setProduct() some time before calling setCurrentLimit().
Example usage:
This function sends a "Set current limit" command to the Tic. For more information about this command and how to choose a good current limit, see the Tic user's guide.
See also getCurrentLimit().
|
inline |
Temporarily sets the stepper motor driver's decay mode.
Example usage:
The decay modes are documented in the Tic user's guide.
See also getDecayMode().
|
inline |
Temporarily sets the maximum acceleration, in units of steps per second per 100 seconds.
Example usage:
This function sends a "Set max acceleration" command to the Tic. For more information, see the Tic user's guide.
See also getMaxAccel().
|
inline |
Temporarily sets the maximum deceleration, in units of steps per second per 100 seconds.
Example usage:
This function sends a "Set max deceleration" command to the Tic. For more information, see the Tic user's guide.
See also getMaxDecel().
|
inline |
Temporarily sets the maximum speed, in units of steps per 10000 seconds.
Example usage:
This function sends a "Set max speed" command to the Tic. For more information, see the Tic user's guide.
See also getMaxSpeed().
|
inline |
You can use this function to specify what type of Tic you are using.
Example usage (pick one of the following):
This changes the behavior of the setCurrentLimit() function.
|
inline |
Temporarily sets the starting speed, in units of steps per 10000 seconds.
Example usage:
This function sends a "Set starting speed" command to the Tic. For more information, see the Tic user's guide.
See also getStartingSpeed().
|
inline |
Temporarily sets the stepper motor's step mode, which defines how many microsteps correspond to one full step.
Example usage:
This function sends a "Set step mode" command to the Tic. For more information, see the Tic user's guide.
See also getStepMode().
|
inline |
Sets the target position of the Tic, in microsteps.
Example usage:
This function sends a "Set target position" to the Tic. If the Control mode is set to Serial/I2C/USB, the Tic will start moving the motor to reach the target position. If the control mode is something other than Serial, this command will be silently ignored.
See also getTargetPosition().
|
inline |
Sets the target velocity of the Tic, in microsteps per 10000 seconds.
Example usage:
This function sends a "Set target velocity" command to the Tic. If the Control mode is set to Serial/I2C/USB, the Tic will start accelerating or decelerating to reach the target velocity.
If the control mode is something other than Serial, this command will be silently ignored.
See also getTargetVelocity().
|
protected |