Tic Stepper Motor Controller library for Arduino
|
#include <Tic.h>
Protected Attributes | |
uint8_t | _lastError = 0 |
Represents an I2C connection to a Tic.
For the high-level commands you can use on this object, see TicBase.
|
inline |
|
inlineinherited |
|
inlineinherited |
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().
|
inlineinherited |
|
inlineinherited |
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.
|
inlineinherited |
|
inlineinherited |
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.
|
inlineinherited |
Gets the AGC bottom current limit.
This is only valid for the Tic T249.
See also setAgcBottomCurrentLimit().
|
inlineinherited |
Gets the AGC current boost steps.
This is only valid for the Tic T249.
See also setAgcCurrentBoostSteps().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
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:
|
inherited |
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().
|
inlineinherited |
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().
|
inlineinherited |
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:
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Gets the raw encoder count measured from the Tic's RX and TX lines.
Example usage:
|
inlineinherited |
|
inlineinherited |
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:
|
inlineinherited |
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:
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
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().
|
inlineinherited |
Gets the current state of the Tic's main input.
Example usage:
See TicInputState for more information.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
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().
|
inlineinherited |
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().
|
inlineinherited |
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().
|
inlineinherited |
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.
|
inlineinherited |
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:
|
inlineinherited |
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:
|
inlineinherited |
|
inlineinherited |
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:
|
inlineinherited |
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.
|
inlineinherited |
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().
|
inlineinherited |
|
inlineinherited |
Gets the target position, in microsteps.
This is only relevant if the planning mode from getPlanningMode() is TicPlanningMode::Position.
See also setTargetPosition().
|
inlineinherited |
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().
|
inlineinherited |
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.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
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().
|
inlineinherited |
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().
|
inlineinherited |
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().
|
inlineinherited |
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.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Temporarily sets the AGC bottom current limit.
This is only valid for the Tic T249.
See also getAgcBottomCurrentLimit().
|
inlineinherited |
Temporarily sets the AGC current boost steps.
This is only valid for the Tic T249.
See also getAgcCurrentBoostSteps().
|
inlineinherited |
Temporarily sets the AGC frequency limit.
This is only valid for the Tic T249.
See also getAgcFrequencyLimit().
|
inlineinherited |
|
inherited |
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().
|
inlineinherited |
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().
|
inlineinherited |
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().
|
inlineinherited |
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().
|
inlineinherited |
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().
|
inlineinherited |
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.
|
inlineinherited |
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().
|
inlineinherited |
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().
|
inlineinherited |
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().
|
inlineinherited |
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().
|
protectedinherited |