computer interfacing tutorial-printer, serial, game, usb port
 

 

3.3.1. Basic Drive Motor Stepper Up-Parallel Port

A basic example of stepper motor driver is shown in figure bellow. Notice the separate voltages for logic and for the stepper motor. Usually the motor will require a different voltage than the logic portion of the system. Typically logic voltage is +5 Vdc and the stepper motor voltage can range from +5 Vdc up to about +48 Vdc. The driver is also an "open collector" driver, wherein it takes its outputs to GND to activate the motor's windings.

Delphi Programming ( Download file ex331.zip )

a. Puts 4 Timers Components, 2 Button and label on Form, as shown in picture bellow. Setting up all timer Timer component for Enabled = false, and Interval = 1000 ( approximataly = 1000 ms delay time ).

           

b.Click on timer1 component to insert with the program as shown bellow

procedure TMotor.Button1Click(Sender: TObject);
begin timer1.enabled:=true; { turn on timer1 } end;
procedure TMotor.Timer1Timer(Sender: TObject);
begin
 timer1.enabled:=false; {turn off timer1 }
asm mov dx,$378 mov al,11111110b out dx,al end; timer2.enabled:=true; {turn on timer2 } end;
procedure TMotor.Timer2Timer(Sender: TObject);
begin
 timer2.enabled:=false; { turn off timer2 }
asm mov dx,$378 mov al,11111110b out dx,al end; timer3.enabled:=true; ( turn on timer3 } end;
procedure TMotor.Timer3Timer(Sender: TObject);
begin
 timer3.enabled:=false; {turn off timer3 }
asm mov dx,$378 mov al,11111110b out dx,al end; timer4.enabled:=true; {turn on timer4 } end;
procedure TMotor.Timer4Timer(Sender: TObject);
begin
 timer4.enabled:=false; {turn off timer4 }
 asm
  mov dx,$378
  mov al,11111110b
  out dx,al
 end;
 timer1.enabled:=true; {turn on timer1 again }
end;
procedure TMotor.Button2Click(Sender: TObject);
begin
 timer1.enabled:=false;
 timer2.enabled:=false;
 timer3.enabled:=false;
 timer4.enabled:=false;
end

c. To run the program, you can hits F9 or RUN menu, and then you will show a picture as shown bellow, and try to simulate the program hit TURN RIGHT button.

 

Free Software
Delphi

Lesson 1
Delphi Programming
1.1. IDE Delphi
1.2. Component


Lesson 2
Printer Port
/ LPT
1.1.Basic
1.2.Address
1.3.Port Register
1.4.8 Bit Data Input
1.5.Test Circuitry
1.6.Assignment

Lesson 3
Printer Port / LPT
Experiments

3.1.LED
3.2.Swicht
3.3.Motor Stepper
3.4.DAC
3.5.ADC
3.6.Graph Display

Lesson 4
Serial Port

4.1.Basic
4.2.Hardware
4.3.Port Register

Lesson 5
Serial Port Experiments

5.1.LED
5.2.Stepper Motor
5.3.Swicht
5.4.ADC

Lesson 6
Game Port
Joy Stick
6.1. Basic
6.2. Experiments