資源簡介
步進電機的線速度控制算法源碼加上說明文檔

代碼片段和文件信息
/*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源碼
評論
共有 條評論