Page 150 - C Programming
P. 150
ตัวอย่างที่11-3 โปรแกรมควบคุมการหมุนซ้ายของสเต็ปเปอร์มอเตอร์แบบ 2เฟส
#include<stdio.h>
main()
{ char i=0,chk=1,data[4]={0x03,0x06,0x0c,0x09};
gotoxy(30,10); printf("**********************");
gotoxy(30,11); printf(" Control Motor 2 Phase");
gotoxy(30,12); printf("**********************");
do{ outport(0x378,data[i]);
delay(300);
gotoxy(42-i,13); printf(" << ");
i++;
if(i>3) i=0;
if(kbhit())
chk=getch();
} while(chk!=27);
}