#include main() { int port; char string[80]; char *ptr; char ch; unsigned char axis; unsigned char dir,direction; long x; long count; ch=0x00; ptr=string; clrscr(); printf("When asked to enter count , use 5000 for a 450MHZ CPU:\n"); printf("Use 10000 for a 1GHz CPU etc. This program is NOT interrupt\n"); printf("driven, so you will notice roughness as the motor turns\n"); printf("Smaller numbers for count make the motor go faster\n"); printf("Press F for forward and R for reverse\n"); printf("Press to exit\n\r"); printf("Press + for faster speed, - for slower speed\n"); while (1) { printf("Enter Port 278, 378, or 3BC: "); gets(string); ptr=strupr(string); if (strcmp(string,"278")==0) {port=0x278; break; } if (strcmp(string,"378")==0) {port=0x378; break; } if (strcmp(string,"3BC")==0) {port=0x3BC; break; } printf("Invalid port\n\r"); } printf("\n"); while (ch==0x00) { printf("Which axis X, Y, or Z "); ch=getch(); switch (ch) {case 'x': case 'X': axis=0x01; direction=0x02; break; case 'y': case 'Y': axis=0x04; direction=0x08; break; case 'z': case 'Z': axis=0x10; direction=0x20; break; default:ch=0x00; printf("\n\rInvalid Axis.\n\r"); break; } } printf("%c\n",ch); dir=0x00; ch=0x00; printf("enter count: "); gets(string); count=atoi(string); if (count<2500) count=2500; printf("count=%ld\n",count); while (ch !=0x1b) {outp(port,axis | dir); for (x=0;x