Page 146 - C Programming
P. 146

ตัวอย่างที่ 11-1 โปรแกรมควบคุมการหมุนซ้ายของสเต็ปเปอร์มอเตอร์แบบ 1 เฟส





                 #include<stdio.h>


                 main()

                     {          char i=0,data[4]={0x01,0x02,0x04,0x08};


                                 gotoxy(30,10);  printf("************************");


                                 gotoxy(30,11);  printf("Motor turn Left  One Phase");

                                 gotoxy(30,12);  printf("*************************");


                                 while(!kbhit())

                                    {  outport(0x378,data[i]);


                                       delay(500);


                                       gotoxy(43-i,13);  printf("   <   ");

                                       i++;


                                       if (i>3) i=0;

                                      }


                        }
   141   142   143   144   145   146   147   148   149   150   151