Demo of linear speed ramp controller. Control of stepper motor by the serial port. A menu gives the user status and shows the avaliable commands.
Definition in file main.c.
#include <ioavr.h>
#include <inavr.h>
#include <stdlib.h>
#include "global.h"
#include "uart.h"
#include "sm_driver.h"
#include "speed_cntr.h"
Include dependency graph for main.c:
Go to the source code of this file.
Functions | |
void | Init (void) |
Init of peripheral devices. | |
void | main (void) |
Demo of linear speed controller. | |
void | ShowData (int position, int acceleration, int deceleration, int speed, int steps) |
Sends out data. | |
void | ShowHelp (void) |
Sends help message. | |
Variables | |
__flash char | Help [] = {"\n\r--------------------------------------------------------------\n\rAtmel AVR446 - Linear speed control of stepper motor\n\r\n\r? - Show help\n\ra [data] - Set acceleration (range: 71 - 32000)\n\rd [data] - Set deceleration (range: 71 - 32000)\n\rs [data] - Set speed (range: 12 - motor limit)\n\rm [data] - Move [data] steps (range: -64000 - 64000)\n\rmove [steps] [accel] [decel] [speed]\n\r - Move with all parameters given\n\r<enter> - Repeat last move\n\r\n\r acc/dec data given in 0.01*rad/sec^2 (100 = 1 rad/sec^2)\n\r speed data given in 0.01*rad/sec (100 = 1 rad/sec)\n\r--------------------------------------------------------------\n\r"} |
Help message. | |
GLOBAL_FLAGS | status = {FALSE, FALSE, 0} |
Global status flags. |
|
Init of peripheral devices. Setup IO, uart, stepper, timer and interrupt. Definition at line 42 of file main.c. References InitUART(), sm_driver_Init_IO(), sm_driver_StepOutput(), and speed_cntr_Init_Timer1(). Referenced by main().
Here is the call graph for this function: ![]() |
|
Demo of linear speed controller. Serial interface frontend to test linear speed controller. Definition at line 62 of file main.c. References GLOBAL_FLAGS::cmd, FALSE, Init(), GLOBAL_FLAGS::running, ShowData(), ShowHelp(), speed_cntr_Move(), status, stepPosition, TRUE, uart_FlushRxBuffer(), UART_RxBuffer, and uart_SendString().
Here is the call graph for this function: ![]() |
|
Sends out data. Outputs the values of the data you can control by serial interface and the current position of the stepper motor.
Definition at line 190 of file main.c. References uart_SendInt(), and uart_SendString(). Referenced by main().
Here is the call graph for this function: ![]() |
|
Sends help message. Outputs help message. Definition at line 173 of file main.c. References Help, and uart_SendByte(). Referenced by main().
Here is the call graph for this function: ![]() |
|
Help message.
Definition at line 167 of file main.c. Referenced by ShowHelp(). |
|
Global status flags.
Definition at line 33 of file main.c. Referenced by main(), speed_cntr_Move(), speed_cntr_TIMER1_COMPA_interrupt(), and UART_RX_interrupt(). |