Microcontrollers - Lab Manual - Final
Microcontrollers - Lab Manual - Final
Microcontrollers
Course Code: ECE 233
Laboratory Manual
2018-19
www.mitwpu.edu.in
Preface
Microcontrollers
Microcontrollers are single chip computers, integrating processor, memory and other
peripheral modules into a single System-on-Chip (SoC). The single chip solution makes the
footprint of the computational element small in the overall system package, eliminating the
necessity of additional chips on board. Microcontrollers like 8051, PIC belong to this category.
This course includes Silicon Labs' 8-bit Microcontroller C8051F340 which implements the
standard 8051 organization. It introduces undergraduate students to the field of microcontrollers –
what they are, how they work, how they interface with their I/O components, and what
considerations the programmer has to observe in hardware-based and embedded programming.
Understanding the architecture is the basis followed by hardware intricacies of these processors
and their programming will be covered. Different system design examples built around these
processors will also be elaborated. The lab for this course covers experiments based on interfacing
of peripherals with C8051F340. Programming is in assembly and embedded C. IDE is Keil µvision
and Simplicity Studio. After completion of this lab, students should able to develop a
microcontroller based interfaces for real life applications.
www.mitwpu.edu.in
Microcontrollers
INDEX
CERTIFICATE
www.mitwpu.edu.in
Laboratory Instructions
Microcontrollers
1. Students should have a valid ID card before entering the laboratory.
2. Playing of games on computer in the lab is strictly prohibited.
3. Before leaving the lab, users must close all programs/windows and turn-off the computer.
4. Do not modify or delete any important file and install any software or settings in the
computer
5. Internet facility is to be used only for educational/ study purpose.
6. If any problem arises, please bring the same to the notice of Lab In-Charge.
7. Each student must take mobile phones in “Switched Off” or “Vibration” mode while
entering and or working in laboratory.
8. In case of theft / destruction of the computers or peripherals, double the cost of that item
will be charged from the student/user.
9. Tampering with the hardware or software settings will not be tolerated.
10. Lab Assistants are available to assist with basic computer and software problems.
11. Copying and/or installing of pirated software not permitted.
12. Personal files are not to be stored on the local drive. Students are responsible for their own
means of digital storage. All lab computers are configured to remove any data stored or
any programs installed by users.
13. Do not leave your personal belongings at the computer desk. The School is not responsible
for items left behind.
14. Users are strictly prohibited from downloading, viewing or distributing any offensive
materials.
15. Internet surfing or chatting for personal reasons is not allowed.
www.mitwpu.edu.in
Guidelines to use µVISION IDE
Keil MicroVision is an Integrated Development Environment (IDE), which includes a text editor
to write programs, a compiler to convert the source code to hex files and a debugger to test, verify,
and optimize the application code.
Step 2: After Creating project now Select your device model eg. Silicon Lab’s C8051F340
Step 3: So now your project is created and Message window will appear to add start-up file of
your device. Click on Yes so it will be added to your project folder you are programming in C and
click on no if you are programming in assembly.
Step 4: Now go to File and create new file and save it with .asm extension in the folder where you
created the project if you want to write program in assembly language
Step 6: After that on left you see project window [if it’s not there….go to View tab and click on
restore window to default].
www.mitwpu.edu.in
Right click on target and click on options for target
Step 7: Now Expand target and you will see source group
Now add your program file which you have written in C/assembly.
Step 8: Now Click on Build target. You can find it under Project tab or in toolbar. It can also be
done by pressing F7 key.
Step 9: you can see Status of your program in Build output window
[If it’s not there go to view and click on Build output window]
www.mitwpu.edu.in
S. Y. B. Tech (ECE)
Trimester: VI Subject: MICROCONTROLLERS
Name: Class:
Roll No: Batch:
Experiment No: 01
Name of the Experiment: Assembly language programing
Submitted on:
Aim: Write assembly language program for addition of N 8-bit numbers. Take the input numbers
from memory and store result in memory.
Theory:
Programming in the sense of Microcontrollers (or any computer) means writing a sequence
of instructions that are executed by the processor in a particular order to perform a predefined task.
The three levels of Programming Languages are as shown in figure 1.1.
The Programs written in Assembly gets executed faster and they occupy less memory.
With the help of Assembly Language, you can directly exploit all the features of a
Microcontroller.
www.mitwpu.edu.in
Using Assembly Language, you can have direct and accurate control of all the
Microcontroller’s resources like I/O Ports, RAM, SFRs, etc.
Compared to High-level Languages, Assembly Language has less rules and restrictions.
The ADD instruction is used for the addition of two operands. The destination operand is
always in register A, while the source operand can be register, immediate data or memory. The
AF, CY and P bits of the flag register are affected by the ADD instruction depending on the
operands. Program Status Word (PSW) is the flag register as shown in figure 1.2.
CY AC FO RS1 RS0 OV UD P
Symbol Function
CY Carry flag
01 Bank1
www.mitwpu.edu.in
10 Bank2
11 Bank3
OV Overflow flag
P Parity flag; P=1 for Odd no. of 1’s; P=0 for Even no. of 1’s
Algorithm:
Sample Example:
Program:
Note: Attach the printout of the code.
Conclusion:
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
Study Question:
1. Explain the instructions: DJNZ, INC, SUBB.
2. What is an IDE?
Additional links:
1. https://nptel.ac.in/courses/117104072/13
2. https://www.electronicshub.org/8051-microcontroller-assembly-language-programming/
www.mitwpu.edu.in
Guidelines to use Silicon Lab’s Simplicity Studio
Simplicity Studio simplifies the Embedded development process with one-click access to
everything developers need to complete their projects using an integrated development
environment (IDE) based on Eclipse 4.5.
Steps to create project and program compilation:
Steps:
Open Simplicity Studio.
Click File > Import…, to import the project.
Click General > Existing Projects into Workspace and click Next.
First Select Root Directory of your Eclipse Template for EPB_F340. Then select “Copy
projects into workspace” check box and Click Finish.
Every time you import a project make sure to rename it. So Right Click Project > Rename
or press F2 while selecting project to rename it.
To write source files, right click on Sources, go to New > Source File and you will see New
Source File Wizard. Enter Source File name (For example main.c) then Click Finish.
To write header files, right click on Includes, go to New > Header File and you will see
New Header File Wizard. Enter Header File name (For example main.h) then Click Finish.
Write your code and then save your Files.
OR
Copy necessary .c and .h files to your local Sources and Includes project folders
respectively. They will be added to your project in Simplicity Studio IDE.
Click on Build Project in Project>Build Project to compile and build the project.
After successful building the project the .hex file will be generated in the project folder in
the workspace.
Steps to use hardware:
Connect 9V DC Power supply to the educational practice board for F340
Connect USB cable between PL4 connector of EPBF340 board and PC.
Using the RUN/PROGRAM mode selection switch set the board in the program mode by
pressing switch SW2 and press reset.
Using download tool (USB Bootloader) download the .HEX file to the target board.
Wait for the “Successfully loaded image” message in display.
Connect flat cable between ASK25 and EPBF340 boards according to each experiment’s
requirement.
Using the RUN/PROGRAM mode selection switch, set the board in the run mode by
releasing Switch SW2. Apply reset to execute the program.
Observe the expected output of the experiment.
www.mitwpu.edu.in
NOTE: Use this tool for Experiment No. 2 to 8. Draw interfacing diagram on separate sheet and attach
the printout of the tested code.
F340 Hardware
The EPB-F340Mini is a stand-alone card--allowing developers to evaluate the C8051F340 USB
Flash MCU Family to determine if it meets their Application requirements. Furthermore, the
module is an excellent platform to develop and run software for the 8051 processor. The EPB-
F340Mini is shipped with a C8051F340. The EPB-F340Mini allows full speed verification of 8051
code. In addition, an onboard C2 connector provides interface to emulators, with assembly
language and ‘C’ high level language debug.
www.mitwpu.edu.in
Figure 2.2 The EPB-F340Mini development board layout
www.mitwpu.edu.in
The EPB-F340Mini has 8 connectors. The function of each connector is shown in the table
below:
Table 2.1 EPB-F340Mini connector description
Unit Reference Description
Power jack connector PL1 Power jack connector
I2C PL2 4 Pins
I/O Port PL3 PORT1 and 2 GPIO
USB PL4 USB Connector
JTAG PL5 JTAG Interface
I/O Port PL6 PORT3 and 4 GPIO
SPI PL7 6 Pins
UART0/Debug PL8 USB Connector
UART0 PL9 3 Pins Connector
UART1 PL10 DB9 -M Connector
www.mitwpu.edu.in
Figure2.3 The ASK-25 board layout
The ASK-25A has 10 connectors. The function of each connector is shown in the table below:
Table 2.2 ASK-25A connector description
Unit Reference Description
SPI PL1 6 Pins
I2C PL2 4 Pins
I/O Port PL3 GPIO
Stepper Motor Connector PL4 6 Pins Connector
DC Motor Connector PL5 2 Pin Green Terminal
Buzzer Connector PL6 2 Pin Connector
Relay Connector PL7 3 Pin Green Terminal
I/O Ports PL8 GPIO
Stepper Motor Power Supply PL9 Power Socket
Analog Output PL10 3 Pin Connector
www.mitwpu.edu.in
S. Y. B. Tech (ECE)
Trimester: VI Subject: MICROCONTROLLERS
Name: Class:
Roll No: Batch:
Experiment No: 02
Name of the Experiment: Interfacing of LED, Buzzer, Relay and Switch with C8051F340
Submitted on:
Aim: Write C program for interfacing of LED, Buzzer, Relay and Switch with C8051F340 to turn
it ON when key is pressed.
Apparatus: EPBF340 Board, ASK25 board, Connectors
Theory:
Ports in C8051F340:
Digital and analog resources are available through 40 I/O pins. These pins are available on ports.
C8051F340 has 5 ports, each port has eight pins. Each of the Port pins can be defined as general-
purpose I/O (GPIO) or analog input. This resource assignment flexibility is achieved through the
use of a Priority Crossbar Decoder. Registers XBR0, XBR1, and XBR2 are used to assign the
digital I/O resources to the physical I/O Port pins.
www.mitwpu.edu.in
Step 4. Assign Port pins to desired peripherals (XBR0, XBR1) as shown in figure 2.3.
Step 5. Enable the Crossbar (XBARE = ‘1’).
SFR definitions:
www.mitwpu.edu.in
LED, Buzzer, Relay and Switch:
LED: LED is an output device. 8 LED’s are connected to 8 port pins. The LED’s are connected in
common anode configuration. Thus, to turn ON the LED logic ‘0’ must be given and to turn OFF
the led logic ‘1’ must be given.
Buzzer: Buzzer is an output device. The buzzer is turned ON when logic ‘1’ is applied to the port
pin and turned OFF when logic ‘0’ is applied to port pin.
Relay: Relay is an output device. The relay is turned ON when logic ‘0’ is applied to port pin and
turned OFF when logic ‘1’ is applied to the port pin.
Switch/button: Switch is an input device. Push button switches are used. When the switch is
released the port pin has logic ‘1’ and when the switch is pushed the port pin has logic ‘0’.
Algorithm:
Interfacing Diagram:
www.mitwpu.edu.in
Hardware Connections:
Connect flat cable between PL8 connector of ASK25 and PL6 connector of EPBF340 board.
Connect other flat cable between PL3 connector of ASK25 and PL3 connector of EPBF340 board.
Table 2.3 Hardware connections between EPBF340 and ASK25 board
Expected Result:
www.mitwpu.edu.in
LEDs, Buzzer and Relay should turn on when respective key is pressed.
Conclusion:
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
Study Question:
1. Explain the common anode and common cathode configuration of LED.
2. How many ports are available in C8051F340?
3. How to configure port as an input/output?
4. Explain Priority Crossbar Decoder.
Additional links:
1. https://www.silabs.com/documents/public/data-sheets/C8051F34x.pdf
2. https://aticleworld.com/interfacing-of-switch-and-led-using-the-8051/
www.mitwpu.edu.in
S. Y. B. Tech (ECE)
Trimester: VI Subject: MICROCONTROLLERS
Name: Class:
Roll No: Batch:
Experiment No: 03
Name of the Experiment: Interfacing of LCD
Submitted on:
Aim: Write C program for interfacing of 16x2 LCD with C8051F340 in 8-bit mode.
Theory:
LCD has the ability to display letters, numbers and characters. A 16x2 LCD can display 16
characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel
matrix.
LCD pin descriptions:
Vcc, Vss and Vee:
While Vcc and Vss provide +5V and ground, respectively, Vee is used for controlling LCD
contrast.
Register Select (RS):
There are two very important registers inside the LCD. The RS pin is used for their
selection as follows.
a. RS = 0: the instruction command code register is selected, allowing the user to send a
command such as clear display, cursor at home.
b. RS = 1: the data register is selected, allowing the user to send the data to be displayed on
the LCD.
www.mitwpu.edu.in
Read/write (R/W):
R/W input allows the user to write information to the LCD or read information from it.
R/W = 1 when reading, R/W = 0 when writing.
Enable (EN):
The enable pin is used by the LCD to latch information presented to its data pins. When
data is supplied to data pins, a high to low pulse must be applied to the pin in order for the LCD
to latch in the data present at the data pins. This pulse must be a minimum of 450ns wide.
Data bus (D0 – D7):
The 8-bit data pins, D0-D7 are used to send the information to the LCD or read the contents
of the LCD’s internal registers. To display the numbers and letters, we send ASCII codes to these
pins while making RS=1.
There are also instruction command codes that can be sent to the LCD to clear the display
or blink the cursor.
We also use RS = 0 to check the busy flag bit to see if the LCD is ready to receive
information. The busy flag is D& and can be read when R/W = 1 and RS=0. When D7 =1, the
LCD is busy taking care of internal operations and will not accept any new information. When D7
= 0, the LCD is ready to receive new information.
Table 3.1 Pin Assignment of 16x2 LCD
0 = Instruction input
4 RS 0/1 I
1 = Data input
www.mitwpu.edu.in
Pin number Symbol Level I/O Function
15 VB+ 1 -
Backlight Supply
16 VB- 0 -
In 8-bit mode eight data pins are used. 8-bit ASCII value of a character is sent at a single
time period and displayed on the LCD.
Interfacing Diagram:
www.mitwpu.edu.in
Hardware Connections:
Connect flat cable between PL3 connector of ASK25 and PL3 connector of EPBF340 board.
Table 3.1 Hardware connections between EPBF340 and ASK25 board for LCD Interfacing
Result:
String should be displayed on the LCD.
www.mitwpu.edu.in
Conclusion:
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
Study Question:
1. Explain the 4-bit mode of LCD.
2. Explain the significance of RS pin and list commands of LCD.
Additional link:
1. https://www.electronicshub.org/interfacing-16x2-lcd-8051/
www.mitwpu.edu.in
S. Y. B. Tech (ECE)
Trimester: VI Subject: MICROCONTROLLERS
Name: Class:
Roll No: Batch:
Experiment No: 04
Name of the Experiment: Implement UART with C8051F340
Submitted on:
Aim: Write a C program for serial communication using C8051F340 to transfer data from
C8051F340 to PC
Apparatus: EPBF340 Board, Connectors
www.mitwpu.edu.in
Interfacing Diagram:
Hardware Connections: Connect USB cable between PL8 connector of EPBF340 board and PC.
Expected Result:
The string should be displayed on HyperTerminal.
www.mitwpu.edu.in
Conclusion:
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
Study Question:
1. Explain the need of MAX232 in serial communication.
2. Write the Port Properties for setting Hyper Terminal connection.
3. Explain UART registers.
Additional link:
https://exploreembedded.com/wiki/A4.8051_Communication_Protocols:UART,_RS232
www.mitwpu.edu.in
S. Y. B. Tech (ECE)
Trimester: VI Subject: MICROCONTROLLERS
Name: Class:
Roll No: Batch:
Experiment No: 05
Name of the Experiment: Programming of on chip ADC
Submitted on:
Theory:
Analog to digital converter is among the most widely used device for data acquisition. It is
used to convert the analog signals to digital numbers so that microcontroller can read and process
them.
On-chip ADC Features:
10-Bit ADC
Up to 200 ksps
Built-in analog multiplexer with single-ended and differential mode
VREF from external pin, internal reference, or VDD
www.mitwpu.edu.in
Interfacing Diagram:
Hardware Connections: Connect single lead wire between P2.5 (Pin15 of PL3 connector) of
EPBF340 board and Pin1 of PL10 connector of ASK25. To provide the ground also connect 20pin
flat cable between PL6 connector of EBF340 board and PL8 connector of ASK25.
Connect USB cable between PL8 connector of EPBF340 board and PC.
F340 Reference Device ASK25
P2.5 (Pin15 of PL3 connector) Pin 1 of PL10 connector (Pot RV2)
P0.4 TXD
P0.5 RXD
Result:
Digital output should be observed on the Hyperterminal.
www.mitwpu.edu.in
Conclusion:
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
Study Question:
1. Give the main factor affecting the step size of ADC in C8051F340.
2. Give the formats for control registers associated with C8051F340 ADC.
Additional link:
https://www.silabs.com/documents/public/data-sheets/C8051F34x.pdf
www.mitwpu.edu.in
S. Y. B. Tech (ECE)
Trimester: VI Subject: MICROCONTROLLERS
Name: Class:
Roll No: Batch:
Experiment No: 06
Name of the Experiment: Interfacing of 8-bit DAC with C8051F340
Submitted on:
Aim: Write C program for interfacing of 8 bit DAC with C8051F340 to generate
i) Square wave
ii) Triangular wave
Theory:
The digital to analog converter involves translating digital information to equivalent analog
information. DAC 0808 is R-2R ladder DAC giving output analog current so need to convert in
voltage. I to V converter is used using LF351.DAC and LF351 require dual power supply of +15V
&-15V.
DAC 0808 features:
1. 8 bit digital to analog converter
2. Low power consumption 33mW with 5V.
3. Power supply voltage range 4.5V to 18V.
4. Non-inverting digital inputs are TTL and CMOS compatible.
5. 16 pin DIP.
6. High speed multiplying input slew rate: 8mA/s.
7. Relative accuracy - 0.19 % error maximum.
8. Fast settling time: 150 ns typical.
9. Full-scale current match: 1 LSB typical.
Applications:
1. Programmable power supply.
www.mitwpu.edu.in
2. DC motor speed control.
Speed synthesis
Interfacing Diagram:
Hardware Connections:
Connect dual power supply of 15V to DAC board. Digital data is available on P4 so Connect flat
cable between PL6 connector of EPBF340 board to DAC data lines on DAC board.
www.mitwpu.edu.in
10 P4.0 3 D0
11 P4.1 4 D1
12 P4.2 5 D2
13 P4.3 6 D3
14 P4.4 7 D4
15 P4.5 8 D5
16 P4.6 9 D6
17 P4.7 10 D7
18 3.3 V NC
19 5.0 V 1 5.0 V
20 GND 2 GND
Result:
Observe square and triangular wave on DSO.
Conclusion:
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
Study Questions:
5. Write a program to generate trapezoidal wave using DAC
6. Explain different types of DAC
Additional Links:
https://nptel.ac.in/courses/112103174/module2/lec8/1.html
www.mitwpu.edu.in
S. Y. B. Tech (ECE)
Trimester: VI Subject: MICROCONTROLLERS
Name: Class:
Roll No: Batch:
Experiment No: 07
Name of the Experiment: Generation of PWM using C8051F340 to control speed of DC motor
Performed on: Marks Teacher’s Signature with date
Submitted on:
Aim: Write C program to generation PWM using C8051F340 to control speed of DC motor
Theory:
DC Motors: A direct current (DC) motor is widely used device that translate electrical pulses into
mechanical movement. In the DC motor we have only + and _ leads. Connecting them to a DC
voltage source moves the motor in one direction . By reversing the polarity, the DC motor will
move in the opposite direction.
Unidirectional control:
www.mitwpu.edu.in
or decrease the amount of power provided to the motor , thereby increasing or decreasing the motor
speed. Notice that although the voltage has a fixed amplitude, it has a variable duty cycle.
PWM generation in C8051F340:
The Programmable Counter Array (PCA0) provides enhanced timer functionality. The PCA
consists of a dedicated 16-bit counter/timer and five 16-bit capture/compare modules. Each
module can be used independently to generate a pulse width modulated (PWM) output on its
associated CEXn pin. The frequency of the output is dependent on the timebase for the PCA
counter/timer. The duty cycle of the PWM output signal is varied using the module's PCA0CPLn
capture/compare register.
Interfacing Diagram:
Hardware Connections: Output is available on Port pin P1.4. Observe waveform at pin no. 5
of PL3 connector of EPBF340 board with respect to ground on DSO/CRO. After this, connect
DC motor between the same pin.
www.mitwpu.edu.in
Result:
The duty cycle of the PWM waveform should be observed on DSO/CRO.
OR
DC Motor should run with speed varying w.r.t the change in value of PWM.
Conclusion:
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
Study Question:
1. Define duty cycle.
2. Write the steps to program PCA to generate PWM
3. Write down the equations for the frequency and duty cycle of PWM in C8051F340
Additional links:
1. https://www.silabs.com/documents/public/data-sheets/C8051F34x.pdf
2. https://www.microcontroller-project.com/dc-motor-speed-control-using-8051-
microcontroller.html
www.mitwpu.edu.in
S. Y. B. Tech (ECE)
Trimester: VI Subject: MICROCONTROLLERS
Name: Class:
Roll No: Batch:
Experiment No: 08
Name of the Experiment: Interfacing of Stepper motor with C8051F340.
Submitted on:
Aim: Write C program for interfacing of Stepper motor with C8051F340 to rotate in clockwise
and anticlockwise direction.
Theory:
A stepper motor is known by its important property to convert a train of pulses into a
precisely defined increment in the shaft position. A stepper motor is a widely used a device that
translates electrical pulses into mechanical movement. In applications such as disk drivers, dot
matrix printers, and robotics, the stepper motor is used for position control. Every stepper motor
has a permanent magnet rotor ( also called as shaft ) surrounded by a stator the most common
stator motors have four stator windings that are paired with a centre-tapped common as shown in
the figure. This type of stator motor is commonly referred to as four phase stepper motor. The
centre tap allows a change of current direction in each of two coils, when a winding is grounded,
thereby resulting in polarity change of the stator. Notice that while a conventional motor shaft runs
freely, the stepper motor shaft moves in a fixed repeatable increment which allows one to move it
to a precise position.
www.mitwpu.edu.in
Figure 8.1 Stepper motor windings
This repeatable fixed movement is possible as a result of basic magnetic theory where poles
of same polarity repel and opposite attract. The direction of rotation is indicated by the stator poles.
The stator poles are determined by the current sent through the wire coils A, B,C and D as shown
in Figure 8.1. As the direction of current is changed, the polarity is also changed causing the reverse
motion of the rotor. The stepper motor discussed here has a total of six leads: four leads
representing the four stator windings and two commons for the centre tapped leads. As the
sequence of power is applied to each stator winding, the rotor will rotate. There are several widely
used sequences where each has a different degree of precision. The stepping sequence of
excitations is as shown in Table 8.1.
Table 8.1 The stepping sequence
Windings D C B A
Sequence in hex on P4.7 P4.6 P4.5 P4.4 P4.3 P4.2 P4.1 P4.0
Port 4
0A 0 0 0 0 1 0 1 0
88 1 0 0 0 1 0 0 0
A0 1 0 1 0 0 0 0 0
22 0 0 1 0 0 0 1 0
www.mitwpu.edu.in
Types of Stepper Motor:
Permanent Magnet Stepper Motor: Permanent magnet motors use a permanent magnet (PM) in
the rotor and operate on the attraction or repulsion between the rotor PM and the stator
electromagnets.
Variable Reluctance Stepper Motor: Variable reluctance (VR) motors have a plain iron rotor
and operate based on the principle that minimum reluctance occurs with minimum gap, hence the
rotor points are attracted toward the stator magnet poles.
Hybrid Synchronous Stepper Motor: Hybrid stepper motors are named because they use a
combination of permanent magnet (PM) and variable reluctance (VR) techniques to achieve
maximum power in a small package size.
Applications:
1. Industrial Machines – Stepper motors are used in automotive gauges and machine tooling
automated production equipments.
2. Security – new surveillance products for the security industry.
www.mitwpu.edu.in
3. Medical – Stepper motors are used inside medical scanners, samplers, and also found
inside digital dental photography, fluid pumps, respirators and blood analysis machinery.
4. Consumer Electronics – Stepper motors in cameras for automatic digital camera focus
and zoom functions.
Interfacing Diagram:
Hardware Connections:
Connect flat cable between PL3 connector of ASK25 and PL6 connector of EPBF340 board.
Connect stepper motor at PL4 connector of ASK25. Connect 9V power supply at PL9 connector
of ASK25 before connecting the stepper motor. Press DIP switch SW9 on ASK25 to run the motor.
Pin PL3 Connector PL6 Connector of
Connection of ASK25 EPBF340
11 Input 1 P4.1
13 Input 2 P4.3
15 Input 3 P4.5
17 Input 4 P4.7
19 5V 5.0 V
20 GROUND GND
www.mitwpu.edu.in
Program: Attach printout of the tested code.
Expected Result:
Stepper Motor will rotate in the clockwise and anticlockwise direction
Conclusion:
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
Study Questions:
3. Explain different types of stepper motors and its applications.
4. Explain full stepping & half stepping concept of stepper motor.
5. List specifications of stepper motor and explain need of diver.
Additional Links:
https://nptel.ac.in/courses/112103174/16
www.mitwpu.edu.in