Machine Design
Machine Design
! Interface
! Algorithm
Initialise A as 00H
Send A on P1
Call delay (100 milliseconds)
Increment A
Loop till A crosses FFH and rolls back to 00H.
! Program
! All these waveforms like staircase, ramp, saw-tooth, triangle etc. sound very boring when you only treat them as
just waveforms. But if you imagine controlling external devices using these waveforms, you will understand WHY
you are required to learn these programs.
! Imagine if this output was connected to a bulb. It will turn on with increasing levels of brightness on each step.
Smoothen the output and now you will get theatre dimming and glowing effect.
! Connect the output to the spout of a fountain and you will see the water jet rising higher and higher with increasing
intensity, and so on.
! Algorithm
Initialise A as 00H
Send A on P1
Call delay (10 milliseconds)
Tech-Neo Publications...........Where Authors inspire innovation .....A SACHIN SHAH Venture
Microcontroller & Embedded Prog. (MU-Sem 5-IT) 5-7 8051 Interfacing and Applications
Increment A
Loop infinitely, so that the output goes from
00H gradually to FFH then drops to 00H and repeats
! Program
interfacing with 8051 micro controller. (Q. 4(A), Dec. 18, 10 Marks)
Q. Write a program to generate a triangular waveform using DAC and 8051. Draw the
! Algorithm
Initialise A as 00H
Send A on P1
Call delay (10 milliseconds)
Increment A gradually from 00H…FFH and stop
Repeat the process decrementing A from FEH…01H.
Repeat the whole process, infinitely.
! Program
We need to control the four stator by giving a sequence of 0s and 1s. that decides the movement of the
rotor, and hence the stepper motor on the whole.
For this we simply need to connect four lines of a Port of 8051 say P1.
! Interface
Fig. 5.3.2
! Working
Pins P1.0… P1.3 of 8051 are used to control the motor via ULN2003.
By sending values on these pins we rotate the motor in clockwise and anti-clockwise direction. The
motor is connected at the output of ULN2003.
The logic table for controlling the motor movement is given below.
Here we activate only one stator. This uses less power but also produces low torque in the rotor’s
movement as only one end of the magnet is pulled.
This mode is rarely used due to its low torque.
This is the most commonly used mode. Here we activate only two stators at a time. This uses more
power but also produces double the torque in the rotor’s movement as both ends of the magnet are
pulled.
The Excitation sequence for the stators is as shown :
0 0 1 1 3H
0 1 1 0 6H
1 1 0 0 CH
1 0 0 1 9 H
0 0 1 1 0 0 1 1 33 H
0 1 1 0 0 1 1 0 66 H
1 1 0 0 1 1 0 0 CC H
1 0 0 1 1 0 0 1 99 H
This mode is used when we want better accuracy and more steps in the movement. Full step
produces 4 steps in the cycle but half step produces 8 steps.
Tech-Neo Publications...........Where Authors inspire innovation .....A SACHIN SHAH Venture
Microcontroller & Embedded Prog. (MU-Sem 5-IT) 5-11 8051 Interfacing and Applications
Here we activate two stators, then only one stator then two stators and so on.
This allows half steps as in the rotor not only stops at every stator’s position but also stops in in-
between the stators, being pulled (or repelled) by both stators equally.
The Excitation sequence for the stators is as shown:
P1.3 (D) P1.2 (C) P1.1 (B) P1.0 (A) Value
0 0 0 1 1H
0 0 1 1 3H
0 0 1 0 2H
0 1 1 0 6H
0 1 0 0 4H
1 1 0 0 CH
1 0 0 0 8H
1 0 0 1 9H
! In some other literature you may find the four stator lines, ABCD connected in a different way and hence the
numbers may appear different but the logic remains the same. The idea is, in one excitation we must activate one
stator, in the next we must activate the current and the next stator and repeat the process.
! Also, unlike full step, these codes cannot be derived by simply rotating one of the numbers. Hence we must first
store these codes in memory in the form of a… yes you guessed it right! A look up table at 0400H.
Org 0400H
Table DB 01H, 03H, 02H, 06H, 04H, 0CH, 08H, 09H
# Write a program to rotate the Stepper motor continuously using half step 8 sequence.
Assume look up table at 0400H …
! Algorithm
! Program
Calculation :
! Algorithm:
Initialise A register as 33H (any one of the four excitation codes to be used in full step mode)