H-BRIDGE interfacing with parallel port This tutorial is taken from the book
MY EXPERIENCE IN PARALLEL PORT INTERFACING.
you can download it free from the files
section(file:-parallelport(3 files) of
yahoo group-booksbybibinhttp://groups.yahoo.com/group/booksbybibin/
comments about this book on
www.booksbybibin.blogspot.comH-BRIDGE
See the circuit diagram above you will get it.
For forward motion transistors (1,3) should be ON and remaining (2,4) OFF. For
Backward motion transistors (2,0) should be ON and (1,3) should be OFF. For
stopping(0,0) condition of H-bridge, Transistors(1,3) should be ON and (0,3) should be
OFF. For braking(1,1) transistors (1,2) should be ON and (0,3) should be OFF. So make
a programm according to this to turn motor forward,backward,brake.
#include"bparlib.c"
void main()
{
int a;
printf("stop : 0 \n forward : 1\n backward : 2\n brake: 3\n");
printf("enter the value");
scanf("%d",&a);
Write_DataPort(0x00); //to avoid malfunctioning and short circuit of supply
switch(a)
{
case 0:
printf("motor is stopped (0,0) of H-bridge");
Write_DataPort(0x00); //to clear all other bits
Set_DataPort_bit(0);
Set_DataPort_bit(3);
case 1:
printf("motor is moving forward(0,1)");
Write_DataPort(0x00); //to clear all other bits
Set_DataPort_bit(1);
Set_DataPort_bit(3);
break;
case 2:
printf("motor is moving backward(1,0)");
Write_DataPort(0x00); //to clear all other bits
Set_DataPort_bit(2);
Set_DataPort_bit(0);
break;
case 3:
printf("motor is braked(1,1)");
Write_DataPort(0x00); //to clear all other bits
Set_DataPort_bit(1);
Set_DataPort_bit(2);
break;
default:
break;
}
getch();
}
see not to short circuit Vcc and power supply by making (2,3) ON, first condition and
(0,1) ON another condition when Vcc is connected to ground and short circuit occurs.
But if you use power transistor then the heat sink will get heated too much.
adapter o/p 6.42v,voltage across motor 2.35v.
Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.