资源简介
步进电机的线速度控制算法源码加上说明文档

代码片段和文件信息
/*This file has been prepared for Doxygen automatic documentation generation.*/
/*! \file *********************************************************************
*
* \brief Demo of Linear speed ramp controller.
*
* 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.
*
* - File: main.c
* - Compiler: IAR EWAAVR 4.11A
* - Supported devices: All devices with a 16 bit timer can be used.
* The example is written for ATmega48
* - AppNote: AVR446 - Linear speed control of stepper motor
*
* \author Atmel Corporation: http://www.atmel.com \n
* Support email: avr@atmel.com
*
* $Name: RELEASE_1_0 $
* $Revision: 1.2 $
* $RCSfile: main.cv $
* $Date: 2006/05/08 12:25:58 $
*****************************************************************************/
#include
#include
#include
#include “global.h“
#include “uart.h“
#include “sm_driver.h“
#include “speed_cntr.h“
//! Global status flags
struct GLOBAL_FLAGS status = {FALSE FALSE 0};
void ShowHelp(void);
void ShowData(int position int acceleration int deceleration int speed int steps);
/*! \brief Init of peripheral devices.
*
* Setup IO uart stepper timer and interrupt.
*/
void Init(void)
{
// Init of IO pins
sm_driver_Init_IO();
// Init of uart
InitUART();
// Set stepper motor driver output
sm_driver_StepOutput(0);
// Init of Timer/Counter1
speed_cntr_Init_Timer1();
__enable_interrupt();
}
/*! \brief Demo of linear speed controller.
*
* Serial interface frontend to test linear speed controller.
*/
void main(void)
{
// Number of steps to move.
int steps = 1000;
// Accelration to use.
int acceleration = 100;
// Deceleration to use.
int deceleration = 100;
// Speed to use.
int speed = 800;
// Tells if the received string was a valid command.
char okCmd = FALSE;
Init();
// Outputs help screen.
uart_SendString(“\n\r“);
ShowHelp();
ShowData(stepPosition acceleration deceleration speed steps);
while(1) {
// If a command is received check the command and act on it.
if(status.cmd == TRUE){
if(UART_RxBuffer[0] == ‘m‘){
// Move with...
if(UART_RxBuffer[1] == ‘ ‘){
// ...number of steps given.
steps = atoi((char const *)UART_RxBuffer+2);
speed_cntr_Move(steps acceleration deceleration speed);
okCmd = TRUE;
uart_SendString(“\n\r “);
}
else if(UART_RxBuffer[1] == ‘o‘){
if(UART_RxBuffer[2] == ‘v‘){
if(UART_RxBuffer[3] == ‘e‘){
// ...all parameters given
if(UART_RxBuffer[4] == ‘ ‘){
int i = 6;
steps = atoi((char const *)UART_RxBuffer+5);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2006-05-08 15:05 code\IAR\
文件 8149 2006-05-08 15:05 code\IAR\doxyfile
目录 0 2006-05-08 15:05 code\IAR\doxygen\
文件 1488 2006-05-08 15:05 code\IAR\doxygen\annotated.html
文件 5221 2006-05-08 15:05 code\IAR\doxygen\doxygen.css
文件 1576 2006-05-08 15:05 code\IAR\doxygen\doxygen.png
文件 2783 2006-05-08 15:05 code\IAR\doxygen\files.html
文件 174 2006-05-08 15:05 code\IAR\doxygen\ftv2blank.png
文件 255 2006-05-08 15:05 code\IAR\doxygen\ftv2doc.png
文件 259 2006-05-08 15:05 code\IAR\doxygen\ftv2folderclosed.png
文件 261 2006-05-08 15:05 code\IAR\doxygen\ftv2folderopen.png
文件 233 2006-05-08 15:05 code\IAR\doxygen\ftv2lastnode.png
文件 358 2006-05-08 15:05 code\IAR\doxygen\ftv2li
文件 160 2006-05-08 15:05 code\IAR\doxygen\ftv2mlastnode.png
文件 194 2006-05-08 15:05 code\IAR\doxygen\ftv2mnode.png
文件 235 2006-05-08 15:05 code\IAR\doxygen\ftv2node.png
文件 165 2006-05-08 15:05 code\IAR\doxygen\ftv2plastnode.png
文件 200 2006-05-08 15:05 code\IAR\doxygen\ftv2pnode.png
文件 229 2006-05-08 15:05 code\IAR\doxygen\ftv2vertline.png
文件 2073 2006-05-08 15:05 code\IAR\doxygen\functions.html
文件 1976 2006-05-08 15:05 code\IAR\doxygen\functions_vars.html
文件 7677 2006-05-08 15:05 code\IAR\doxygen\globals.html
文件 4647 2006-05-08 15:05 code\IAR\doxygen\globals_defs.html
文件 3350 2006-05-08 15:05 code\IAR\doxygen\globals_func.html
文件 1920 2006-05-08 15:05 code\IAR\doxygen\globals_vars.html
文件 2689 2006-05-08 15:05 code\IAR\doxygen\global_8h-source.html
文件 5330 2006-05-08 15:05 code\IAR\doxygen\global_8h.html
文件 150 2006-05-08 15:05 code\IAR\doxygen\global_8h__dep__incl.map
文件 32 2006-05-08 15:05 code\IAR\doxygen\global_8h__dep__incl.md5
文件 1554 2006-05-08 15:05 code\IAR\doxygen\global_8h__dep__incl.png
文件 2181 2006-05-08 15:05 code\IAR\doxygen\graph_legend.dot
............此处省略95个文件信息
- 上一篇:vfp学生信息管理系统
- 下一篇:64位RootKit源码
相关资源
- 设备管理系统源码
- 安卓wifi直连app源码
- 我的世界源码(易语言版)
- labview编程软件滤波器以及编写程序设
- 我的界面(visual foxpro)源码
- 易语言:一键cf基址源码
- The Secret Path 3D 3D魔方迷宫[源码][scra
- scratch垃圾分类源码(最终版本).sb
- 安卓QQ6.71协议源码易语言,qq协议源码
- 编译原理实验工具及参考源码(lex&
- E盾偷后台工具源码
- UNIX/LINUX编程实践教程的源码
- 十以内加减法练习 powerbuilder源码
- 农场开发项目
- OCR源码
- PLC上位机编程软件
- 用foobar2000听google音乐[更新一下]
- 学生信息管理系统源码
- 用VC 编写的仿QQ聊天室程序源代码
- 毕业论文之温度传感器DS18B20(源码
- 可自定义导航网站源码
- 栅栏填充算法源码(VC)
- msp430F149操作红外接收模块源码
- 步进电机课程设计(个人设计)
- [免费]图像识别c 源码
- 周易排盘源码
- RSA算法源码
- 一个人脸识别程序源码
- 编译原理课程设计:词法语法编译器
- FPGA在步进电机驱动上的应用实例及代
评论
共有 条评论