The code prompts you to select a certain speed
The computer program controls these resistors. When S1 is on
however and both S2 and S3 are off, the timer output is set to logic one, thereby driving the motor with its maximum speed. When S1 and S2 are on, the 555 timer generates a pulse signal with a 50% duty cycle.
In this case, the charging resistor, RA1, is equal to the discharging resistor, RB. In the third case, S1 and S3 are on, and the charging resistor is RA2,where RA2=0.1×RB, reducing the on time of the pulse signal and, consequently, the speed of the motor to the lower limit. Table 1 summarizes the on/off-operation conditions of the relays and the corresponding dc-motor speeds.
The code prompts you to select a certain speed, stores your selection as an integer variable choice, generates the proper digital sequence, and stores it at another integer variable. You place the value of the integer variable data at a PC’s parallel port using the outportb function. The program uses the kbhit
however function to stop the motor when you hit any key on the keyboard.