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

📄 teststep.c

📁 linux下 步进电机驱动
💻 C
字号:
/* Must be compiled with -O for outb to be inlined, otherwise link error */#include <stdlib.h>#include <stdio.h>#include <unistd.h>#include <asm/io.h>int base=0x378;void verbose_outb(int port, int value){   printf("outb(%02X,%04X)\n",port,value);   outb(port,value);}unsigned char steptable[8]={0x01,0x05,0x04,0x06,0x02,0x0A,0x08,0x09};slow_sweep(){   int i;   for(i=0;i<800;i++) {      verbose_outb(steptable[i%8],base+0);      usleep(100000);   }}main(){   int i;   int inval;   int outval;     printf("this program must be run as root\n");   iopl(3);   /* Enable i/o (if root) */   slow_sweep();}

⌨️ 快捷键说明

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