Lab #6 Advanced Rotation
Introduction:
After this lab, the user will have gathered advanced knowledge on how to control acceleration adn deceleration profiles. The user is encouraged to study Memory Read/Write and EEPROM Programming before continuing with this tutorial as writting to EEPROM and RAM are expected to be basic knowledge during this course.
Objectives:
What is Acceleration and Deceleration?
A body is said to accelerate when its speed is not contants, hence it changes during a finite amount of time. Your car accelerates when it is moving at 10 miles per hour now and then moves at 60 miles per hour a few seconds later. Steppers can accelerate too when we change the speed. In fact, accelerating the stepper is a very healthy process as it ensures jitter free motion, resonance reduction and gives a better chance of getting to higher speeds without stalling.
Deceleration is the inverse of acceleration in the sense that acceleration implies an increase of speed and deceleration implease a decrease of speed. Deceleration is useful when the stepper is about to stop. If the stepper is moving too fast, stopping it right away is kind of hard. Hence, the deceleration profile helps the shaft to follow the magnetic field diminishing the risks of stalling and resonance.
A profile is a controlled speed to speed sequence. The controller changes the speed according to the command and to a series if parameters that define the shape of the acceleration/deceleration curve. An example is hown below
![]() |
As can be seen, the acceleration looks like a ramping up while the deceleration looks like a ramping down. This is precissely what happens in terms of spee change. Do notice that the way the speed is altered can not be done in a continuous mode. Since controllers are discrete components, changes are managed on a discrete time frame. In other words, speed is changed every so amount of milliseconds. This is called the Acceleration/ Deceleration Time Base.
In the same fashion, the amount of how much the speed is increased can’t be continuous either. Even if you just increase the speed by a factor of 1, this is a discrete amount and will look like a stair case. How much the speed is increased or decreased every unit of Time Base is called the Acceleration/Deceleration Rate. Larger values of Accel/Decel Rate, will result in the desired speed being acquired faster.
The controller, when commanded to accelerate, always starts to move the stepper at a speed known as the Starting Speed. Then, after a number of Time Base milliseconds, the speed is increased by the Accel/Decel Rate. Eventually the computed speed is as large or larger than the commanded speed. At this time the controller simply sets the speed to whatever the commanded speed is and the acceleration portion of the profile is complete.
At some point in time in the future a stop command is received which includes the deceleration option. As soon as this happens, the speed is decreased by a factor equal to Accel/Decel Rate. A Time Base number of milliseconds later, the speed is decreased again. Eventually the speed will be so slow that the controller determines it is time to stop the motor. At this moment, the steps are no longer generated and the stepper shaft has truly stopped.
Configuring the Acceleration / Deceleration profiles:
The profile is configured by means of some memory allocations which were discussed on the EEPROM Programming tutorial. For convenience a similar table is shown below:
|
The SS-ST68 contains 128 EEPROM memory locations from which 121 are meant to be used by the user as general purpose memory. The first seven are not to be played with without expecting adverse results. Understanding how these bytes affect the application is very important. Programming them becomes the user responsibility as soon as the factory defaults fail to function as desired (i.e an acceleration rate may not work with the user’s desired profile).
Accel Decel Rate (EEPROM Address 2 and 3): This word parameter (16 bits) constitutes the stepper acceleration deceleration rate. When acceleration or deceleration is specified (either from motor start or motor stop), the stepper speed is modified from a starting value until reaching the desired speed. The acceleration rate represents how much the speed is increased whenever is turn to increase the speed. The same applies for deceleration. Refer to the picture above for a better understanding of acceleration and deceleration profiles.
Accel Decel Time Base (EEPROM Address 4): This byte specifies how many ms will happen before the speed is increased or decreased again. In the picture above, the speed is increased with the Acceleration Rate and decreased with the Deceleration rate. How often this happens is proportional to the Time Base. The parameter can hold values from 0 to 255 which represent a number of milliseconds, where 0 means 1 millisecond and 255 equals 256 milliseconds.
Starting Speed (EEPROM Address 5 and 6): This word parameter (16 bits) specifies how fast the stepper starts to move when the Turn CW Speed or Turn CCW Speed commands are sent with the acceleration option enabled.
The BAUD Rate and SS Address parameters are transferred to appropriate registers in the controller operating system. Once there, they are used to configure the serial communication engine. If the user changes these two parameters, they will not take effect until next power up.
These are the two more important bytes as failing to program them with good values practically guarantees no functionality (i.e. programming the baud rate with a value other than 12 will make it impossible for the module to receive commands on a 19200 BAUD Rate serial bus)..
Remaining application specific parameters are transferred to RAM after reset. The idea is having a set of values in the controller without having to send a variety of Write RAM commands before actually start using the module. The user can change the EEPROM defaults or simply work with the values in RAM
Since BAUD Rate and SS Address are the most important parameters for controller operation, we will learn how to program them. Whatever we discuss in this section apply for all remaining parameters and equally to the free EEPROM space.
Programming the BAUD Rate and SS Address parameters
A paradox may arise. If the BAUD Rate and Address are the most important bytes necessary for system functionality, how are we supposed to program them with correct values if we don’t know what the board is configured to when we buy it?
Two points are important here. First, the controllers are always shipped with BAUD Rate of 19,200 and address 0. But even if that were not true, there is a way in which the BAUD Rate and SS Address are always fixed and unchangeable. This is achieved thru the SS Mode Bits:
Hence Lets start with our tutorial by:
Lets now test the new system functionality:
The reason for the observed behavior was that the controller was no longer responding to messages on address 0, but would receive and execute commands on address 1. You can now modify all EEPROM bytes as needed.
NOTE: In this tutorial we programmed the EEPROM BAUD Rate and SS Address bytes with the jumpers off. There is no need to always have the jumpers off when programming EEPROM. This was done just to ensure there was communication with the board. There will be instances in which the configuration bytes on EEPROM will be unknown and hence this will be the only way to gain access to the board resources.
Congratulations!!! You have successfully completed the fifth lab on the Super Stepper Architecture. You are now capable of reading and writing data from and to the memory inside the super stepper controller module.
Hungry for more? Next topic is Advanced Rotation.
Last Updated on Jan 10, 2008
Other Avayanic Web Sites