Professional Documents
Culture Documents
Comparison
Unipolar
Bipolar
Less torque
High Torque
Modes of Operation
Single Coil Excitation: Only one out of the
4 coils is excited at a given time
Double Coil: Two adjacent coils are
excited at a given time
Single and Double: Its a hybrid of
both..(refer diagram for details)
Note that until the next coil is switched on, the stator remains in its position only
And as we can control when to switch on a particular coil thru software, we can
rotate it by exactly the angle we wish.. Compare this with DC motor where the
shaft keeps on rotating as soon as the current is switched on
Comparison
Single coil
Double coil
Low torque
High torque
energy
Settling time is less
Note: The advantage of hybrid mode is that the step angle gets
halved.. So we can control the rotation with double precision
Circuit Diagram
Pin details
Pin Details
D0-D7 are the data pins(used for output)
C0-C3 are control pins. Note that C1 and
C3 are hardware inverted. They can be
used for both input and output
S3-S7 are status pins. They are used for
taking input from external ckt
PC parallel Port
The PC's Parallel Printer Port had a total of
outportb(0x378,5)
0x378 is the address of the data pins of the parallel port.
The binary form of 5 will appear as an output in the data
pins
i.e the binary of 5 is 00000101. Therefore D0 and D2 are on
and rest pins are off. The ouput can be upto 2^8-1=255
Control pins
The address for control pins can be
Implementation of H bridge
Data
Port1
Data
Port2
Motor 1
Motor 2
Hybrid mode
The order of the values to be written to parallel
port(data pins)
00000001
00000011
00000010
00000110
00000100
00001100
00001000
00001001
The values for the other coil can be determined by shifting the binary representation by 4
places left or multiply the decimal values by 2^4=16
//double coil
#include <stdio.h>
#include <dos.h>
main()
main()
{ char a[]={3,6,12,9};
{ char a[]={1,2,4,8};
for (int
for (int i=0;i<=100;i++)
i=0;i<=100;i++)
{ outportb(888,a[i%4]);
delay(10);
}
outportb(888,0);
{outportb(888,a[i%
4]);
delay(10);
}
outportb(888,0);
//hybrid mode
#include <stdio.h>
#include <dos.h>
main()
{ char
a[]={1,3,2,6,4,12,8,9
};
for (int
i=0;i<=100;i++)
{
outportb(888,a[i%8]);
delay(10);
}
outportb(888,0);
}
//double coil
#include <stdio.h>
#include <dos.h>
//hybrid mode
#include <stdio.h>
#include <dos.h>
main()
{ char a[]={3,6,12,9};
for (int i=100;i<=0;i-)
main()
{ char
a[]={1,3,2,6,4,12,8,9
};
for (int i=100;i<=0;i--)
{
outportb(888,a[i%8]);
delay(10);
}
outportb(888,0);
}
{outportb(888,a[i%
4]);
delay(10);
}
outportb(888,0);
//double coil
#include <stdio.h>
#include <dos.h>
main()
{ char a[]={3,6,12,9};
//hybrid mode
#include <stdio.h>
#include <dos.h>
main()
{ char
a[]={1,3,2,6,4,12,8,9
char
};
b[]={48,96,192,144};
for (int i=100;i<=0;i- char
b[]={16,48,32,96,64,19
-)
2,128,144};
{outportb(888,a[i%
4]|b[i%4]);
delay(10);
}
outportb(888,0);
}
//double coil
#include <stdio.h>
#include <dos.h>
main()
{ char a[]={3,6,12,9};
char
b[]={48,96,192,144};
for (int
i=0;i<=100;i++)
//hybrid mode
#include <stdio.h>
#include <dos.h>
main()
{ char
a[]={1,3,2,6,4,12,8,
9};
char
b[]={16,48,32,96,64,1
92,128,144};
{outportb(888,a[i%
4]|b[i%4]);
delay(10);
}
outportb(888,0);
}
for (int
i=0;i<=100;i++)
{
outportb(888,a[i%8]
|b[i%8]);
delay(10);
}
outportb(888,0);
//hybrid mode
#include <stdio.h>
#include <stdio.h>
#include <dos.h>
#include <dos.h>
main()
main()
{ char
{ char a[]={1,2,4,8};
a[]={1,3,2,6,4,12,8,
char
char
9};
b[]={48,96,192,144};
b[]={16,32,64,128};
char
for (int
for (int i=0;i<=100;i++)
b[]={16,48,32,96,64,1
i=0;i<=100;i++)
{ outportb(888,a[(100//single coil mode
i)%4]|b[i%4]);
delay(10);
}
outportb(888,0);
{outportb(888,a[(10
0-i)%4]|b[i%4]);
delay(10);
}
outportb(888,0);
92,128,144};
for (int
i=0;i<=100;i++)
{
outportb(888,a[(100
-i)%8]|b[i%8]);
delay(10);
}
outportb(888,0);
//hybrid mode
#include <stdio.h>
#include <stdio.h>
#include <dos.h>
#include <dos.h>
main()
main()
{ char
{ char a[]={1,2,4,8};
a[]={1,3,2,6,4,12,8,
char
char
9};
b[]={48,96,192,144};
b[]={16,32,64,128};
char
for (int
for (int i=0;i<=100;i++)
b[]={16,48,32,96,64,1
i=0;i<=100;i++)
{
92,128,144};
outportb(888,a[i%4]|b {outportb(888,a[i%4]|
[(100-i)%4]);
b[(100-i)%4]);
for (int
delay(10);
i=0;i<=100;i++)
delay(10);
}
{
}
outportb(888,0);
outportb(888,a[i%8]
outportb(888,0);
|b[(100-i)%8]);
}
}
delay(10);
}
outportb(888,0);
//single coil mode
MATLAB CODE
dio=digitalio('parallel','LPT1');
addline(dio,0:3,'out');
putvalue(dio,[0 1 1 0]);