资源简介
步进电机的线速度控制算法源码加上说明文档
代码片段和文件信息
/*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源码
相关资源
- 64位RootKit源码
- stm32f103zet6开发板LCD显示屏源码
- QT5串口通信程序源码
- EXE捆绑工具源码
- linux高性能服务器编程源码66818
- rtp/rtcp协议实现源码
- DELPHI 地磅称重源码
- GitHack改进版git源码泄露恢复工具
- 64位的libmodbus3.1.6 源码+库
- OpenCV 飞行游戏手势控制源码.rar
- VC轻松实现非客户区按钮及源码
- 易语言自动更新例程源码
- Delphi中的经典RSA算法源码
- VOD视频点播系统源码
- 多模匹配 Wu-Manber算法源码
- wince下ZIP压缩和解压缩的源码
- 新浪微博舆情检测源码C.rar
- 西门子PLC步进电机源程序
- 排序算法过程演示程序源码
- 仿QQ的微信小程序
- vs2005在线压缩、解压缩文件源码
- 水库调洪计算表格源码
- linux下多线程socket通信完整源码文件
- 人事档案管理系统设计文档+源码全套
- EXE文件捆绑工具源码.rar
- IOS苹果ibeacon官方demo源码
- 易语言软件版本在线自动更新系统源
- E语言免重启修改MAC带皮肤源码
- 用298驱动两相步进电机的51单片机的驱
- iwconfig工具源码
评论
共有 条评论