?? stepmotor_main.c
字號(hào):
/* * stepmotor_main.c * * S3C2410-S STEPMOTOR * derived from s3c2410_exio.c * * Author: wang bin <wbinbuaa@163.com> * Date : $Date: 2005/07/25 $ * * $Revision: 1.0.0.1 $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive * for more details. */#include <stdio.h>#include <fcntl.h>#include <string.h>#include <sys/ioctl.h>#define STEPMOTOR_IOCTRL_PHASE 0x13static int step_fd = -1;char *STEP_DEV="/dev/exio/0raw";/********* A, AB, B, BC, C CD, D, DA ***/char stepdata[]={0x10,0x30,0x20,0x60,0x40,0xc0,0x80,0x90};void Delay(int t){ int i; for(;t>0;t--) for(i=0;i<400;i++);}/****************************************************************/int main(int argc, char **argv){ int i = 0; if((step_fd=open(STEP_DEV, O_WRONLY))<0){ printf("Error opening /dev/exio/0raw device\n"); return 1; } for (;;) { for (i=0; i<sizeof(stepdata)/sizeof(stepdata[0]); i++) { ioctl(step_fd, STEPMOTOR_IOCTRL_PHASE, stepdata[i]); } // printf("Delay(100)\n"); // Delay(100); } close(step_fd); printf("Step motor start running!\n"); return 0;}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -