Hardware Reference
In-Depth Information
211 break;
212 case 'J': /
Mode 0
/
213 case 'K': /
Mode 1
/
214 case 'L': /
Mode 2
/
215 move_oclock(0);
216 set_mode((int) ch - (int) 'J');
217 break;
218 case 'A': /
10 o'clock
/
219 case 'B': /
/
220 move_oclock ((int) ch - (int) 'A'+10);
221 break;
222 case 'O': /
11 o'clock
Toggle on/ off drive
/
223 on_off ^= 1;
224 if ( !on_off )
225 drive(0); /
Turn off motor drive
/
226 else advance(0); /
Re_assert motor drive
/
227 break;
228 case '+': /
Advance +1
/
229 case '=': /
Tread '=' as '+' for convenience
/
230 case '-': /
Counter clock_wise 1
/
231 move(ch == '-' ? -1 : 1);
232 /
/
233 case 'P': /
Fall thru
/
234 printf("Position: %d of %d\n",position,
steps_per_r);
235 break;
236 default: /
Display Position
0 to 9'oclock
/
237 if ( ch >= '0' && ch <= '9' )
238 move_oclock((int) ch - (int) '0');
239 else write (1,"???\n",4);
240 }
241 }
242
243 puts("\nExit.");
244
245 drive(0);
246 for ( x=0; x<4; ++x )
247 gpio_config(gpios[x],Input); /
Set GPIO pin as Input
/
248
249 tcsetattr(tty,TCSAFLUSH,&sv_ios); /
Restore terminal mode
/
250 return 0;
251 }
252
253 /
End unipolar.c
/27.5. SOFTWARE
 
Search WWH ::




Custom Search