Adds support for a generic L297 stepper motor controller.
- MAKE_L297 - Create an L297 stepper motor controller.
L297 MAKE_L297(inverted, steps, accel, every, direction,pulse,reset,enable)
Create an L297 stepper motor controller.
The parameters are as follows:
- inverted - TRUE or FALSE - if the motor is turning in the wrong direction then flip this parameter value
- steps - The number of steps per revolution. If you are half stepping the motor then don't forget to multiply the actual value for the motor by 2
- accel - A number from 0 to DRIVE_SPEED_MAX. When the motor is changing speed it will limit the acceleration to this value
- every -The number of timer ticks between accelerating by the 'accel' value above
- direction - The IOPin used to connect to the direction pin
- pulse - The IOPin used to connect to the pulse pin
- reset - The IOPin used to connect to the RESET pin, or may be 'null' if you don't need that functionality
- enable - The IOPin used to connect to the ENABLE pin, or may be 'null' if you don't need that functionality
Let's assume that we have a stepper motor with 200 steps per revolution and that we have configured the L297 to use half stepping to achieve 400 steps per revolution. Also assume we configure the driver to produce a maximum of 300 pulses per second. This means that the maximum speed of the motor will be 0.75 revolutions per second (ie 45 rpm).
If we used 'accel = 10' and 'every = 2' then this means the motor speed will increase by 10 units every 150th of a second (300 pulses per second divided by 2) until it reaches the requested speed. Note that values of 'accel = DRIVE_SPEED_MAX' and 'every = 1' will effectively give infinite acceleration.
We will use pins A0 and A1 for direction and pulse and leave the reset and enable unused.
L297 motor = MAKE_L297( FALSE, 400, 10, 2, A0, A1, null, null);