⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stepmotor_main.c

📁 s3c2410 的步进电机实验,是我千心万苦求来的代码!
💻 C
字号:
/* * 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;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -