Sie sind auf Seite 1von 14

1. Explain the application of microcontroller in stepper motor control system.

(MAY 2016),
(Nov 2015), (Apr 2015), (Nov 2014)
Stepper Motor Interfacing:
Stepper motor is a widely used device that translates electrical pulses into
mechanical movement. Stepper motor is used in applications such as; disk
drives, dot matrix printer, robotics etc,. The construction of the motor is as
shown in figure 1 below.

Figure 1: Structure of stepper motor


It has a permanent magnet rotor called the shaft which is surrounded by a stator. Commonly used
stepper motors have four stator windings that are paired with a center tapped common. Such
motors are called as four-phase or unipolar stepper motor.
The stator is a magnet over which the electric coil is wound. One end of the coil are connected
commonly either to ground or +5V. The other end is provided with a fixed sequence such that the
motor rotates in a particular direction. Stepper motor shaft moves in a fixed repeatable
increment, which allows one to move it to a precise position. Direction of the rotation is dictated
by the stator poles. Stator poles are determined by the current sent through the wire coils.
Stepangle:
Step angle is defined as the minimum degree of rotation with a
single step. No of steps per revolution = 360 / step angle
Steps per second = (rpm x steps per revolution) / 60 Example: step angle = 2
No of steps per revolution = 180
SwitchingSequenceofMotor:
As discussed earlier the coils need to be energized for the rotation. This can be done by sending a
bits sequence to one end of the coil while the other end is commonly connected. The bit
sequence sent can make either one phase ON or two phase ON for a full step sequence or it can
be a combination of one and two phase ON for half step sequence. Both are tabulated below.

8051ConnectiontoStepperMotor:(explanationofthediagramcanbedone)

Figure 2: 8051 interface to stepper motor


FullStep:
TwoPhaseON

OnePhaseON

2. Explain in detail about RTC interfacing using I2C standard. (MAY 2016), (Nov 2015)
RTC is an electronic device which plays an essential role in realtime embedded system design. It
provides a precise time and date in various applications such as system clock, student attendance
system and alarm etc, that keep track on current time and provides consistent result to the
respective task. This article presents RTC interfacing with 8051microcotrollerand basic accessing of
internal registers.
The various kinds of RTC chips are available in the real time embedded world, which are classified
based on various criteria such as package type, supply voltage and pin configuration etc. A few
types of RTC devices are;
o

Two-Wire Serial Interface (I2C Bus)

Three-Wire Serial Interface (USB BUS)

Four-wire Serial interface (SPI BUS)


Let us consider two-wire interfacing RTC with 8051 microcontroller
RTC stands for real time clock which provides years, months, weeks, days, hours, minutes and
seconds based on crystal frequency. RTC consists of inbuilt RAM memory for data storage. A battery
backup will be provided in case of failure of main power supply by connecting a battery to RTC
device.
RTC DB1307 Configuration:

A0, A1, A2: are address pins of RTC DB1307 chip, which can be used to communicate with the
master device. We can control eight devices with RTC interfacing with 8051 microcontroller by A0,
A1, A2 bits using I2C protocol.
VCC and GND: VCC and GND are power supply and ground pins respectively. This device operated
with 1.8V to 5.5V range.
VBT: VBT is a battery power supply pin. Battery power source must be held between 2V to 3.5V.
SCL: SCL is a serial clock pin and it is used to synchronize data on serial interface.
SDL: It is a serial input and output pin. It is used to transmit and receive the data on serial interface.
Clock Out: It is an optional square wave output pin.
OSC0 and OSC1: These are crystal oscillator pins which are used to provide the clock signals to the
RTC device. The standard quartz crystal frequency is 22.768KHzs.
Device Addressing:
I2C bus protocol allows many slave devices at a time. Every slave device must consist of own
address to represent on it. The master device communicates with particular slave device by an
address. RTC device address is 0xA2 wherein 1010 is given by manufacturer and A0, A1, A2
are user define address, which is used to communicate eight RTC devices on the I2C bus protocol.

R/W bit is used to perform read and write operations in RTC. If R/W=0, write operation is performed
and R/W=1 for read operation.
Memory Registers and Address:
RTC registers are located in address locations from 00h to 0Fh and RAM memory registers are
located in address locations from 08h to3Fh as shown in figure. RTC registers are used to provide
calendar functionality and drive time of day and to display the weekends.

Control/Status Registers:
DB1307 consists of two additional registers such as control/status1 and control/status2 which are
used to control real time clock and interrupts.
Control/Status Register1:

Control/Status Register2:

Interfacing RTC ds1307 with 8051


RTC can be interfaced to microcontroller by using different serial bus protocols such as I2C and SPI
protocols that provide communication link between them. The figure shows, real time clock
interfacing with 8051 microcontroller using I2C bus protocol. I2C is a bi-directional serial protocol,
which consist of two wires such as SCL and SDA to transfer data between devices connected to bus.
8051 microcontroller has no inbuilt RTC device therefore we have connected externally through
a serial communication for ensuring the consisting data.

RTC Data Framing Format


Since RTC interfacing with8051 microcontroller uses I2C bus therefore the data transfer is in the
form of bytes or packets and each byte is followed by an acknowledgement.
Transmitting Data Frame:
In transmitting mode, the master release the start condition after selecting slave device by address
bit. The address bit contains 7-bit, which indicate the slave devices as ds1307 address. Serial data
and serial clock are transmitted on SCL and SDL lines. START and STOP conditions are recognized
as beginning and ending of a serial transfer. Receive and transmit operations are followed by the
R/W bit.

Start: Primarily, the data transfer sequence initiated by the master generating the start condition.

7-bit Address: After that the master sends slave address in two 8-bit formats instead of a single 16bit address.
Control/Status Register Address: The control/status register address is to allow control status
registers.
Control/Status Register1: The control status register1 used to enable the RTC device
Control/Status Register2: It is used to enable and disable interrupts.
R/W: If read and write bit is high, then the read operation is performed.
ACK: If write operation is performed in the slave device, then the receiver sends 1-bit ACK to
microcontroller.
Stop: After completion of write operation in the slave device, microcontroller sends stop condition to
the slave device.

3. Explain the principle of speed control of DC motor. Draw the interface diagram for the
speed control of DC motor using 8051 microcontroller and explain its operation (NOV
2015), (Apr 2014)

DCMotorInterfacingwith8051
The DC motor is another widely used device that translates electrical pulses into mechanical
movement. Motor has 2 leads +ve and ve , connecting them to a DC voltage supply moves
the motor in one direction. On reversing the polarity rotates the motor in the reverse
direction. Basic difference between Stepper and DC motor is stepper motor moves in steps
while DC motor moves continuously. Another difference is with stepper motor the number of
steps can be counted while it is not possible in DC motor. Maximum speed of a DC motor is
indicated in rpm. The rpm is either with no load it is few thousands to tens of thousands or
with load rpm decreases with increase in load.
As load increases, rpm increases, unless voltage or current increases implies
torque increases. With fixed voltage, as load increases, power consumption of a DC motor is
increased.
UnidirectionalControl:
Figure 3 shows the rotation of the DC motor in clockwise and anticlockwise direction

Figure 3: DC motor rotation


BidirectionalControl:

(a) Motor not running

(c) Counter clockwise direction

(b) Clockwise direction

(d) Invalid state (short circuit)

Figure 4 shows the H-Bridge motor configuration. It consists of four switches and based on the
closing and opening of these switches the motor either rotates in clockwise or anti-clockwise
direction.
As seen in figure 4a, all the switches are open hence the motor is not running. In b, turning of
the motor is in one direction when the switches 1 and 4 are closed that is clockwise direction.

Similarly, in c the switches 2 and 3 are closed so the motor rotates in anticlockwise direction,
while in figure 4d all the switches are closed which indicates a invalid state or a short circuit.
4. Explain the interfacing of ADC and DAC chips with 8051 microcontroller. (NOV 2015),
(Apr 2014)
Interfacing of ADC 0804 to 8051 Microcontroller:
ADC 0804 is a single channel analog to digital converter i.e., it can take only one
analog signal. ADC 0804 has 8 bit resolution.
The higher resolution ADC gives smaller step size. Step size is smallest change that
can be measured by an ADC.
The time taken by the ADC to convert analog data into digital form depends on the
frequency of clock source The 8051 Microcontroller is used to provide the control
signals to the ADC. CS (chip select) pin of ADC is directly connected to ground. The
pin P1.1, P1.0 and P1.2 are connected to the pin WR, RD and INTR of the ADC
respectively. When the input voltage from the preset is varied the output of ADC
varies also varies.

From the circuit it is clear that the ADC interfaced directly to the microcontroller. The
Port1 is used as an input port which receives the digital data from the ADC. Port pins P2.5 and
P2.6 are used for SOC and EOC operation. When the conversion is over the ADC will send an
interrupt signal to the microcontroller through the pin P2.7 .Now the Microcontroller receives
digital data through the Port1.This data af ter conversion to decimal data is displayed on the LCD
module.

DAC
Digital to Analog converters can be classified as current output, voltage output and
multiplying type. The current output DAC provides current as the output signal. The voltage
output DAC internally converts the current signal into the voltage signal. The voltage output
DAC is slower than the current output DAC because of the delay in converting the current signal
into the voltage signal. The multiplying DAC is similar to the other 2 types except its output
represents the product of input signal and the reference source and the product is linear over a
broad range.
Typical applications of DACs include digital voltmeters, peak detectors, panel meters,
programmable gain and attenuation and st epping motor drive.
Following figure shows a simple 3 bit D/A converter. It has a 3 digital input lines (D2,
D1 and D0) and one output line for the analog signal. The 3 input signals can assume
combinations from 000 to 111. If the input ranges from 0 to 1 V it can be divided into 8 equal
parts (1/8V) and each successive input is 1/8V higher than the previous combination. Thus if the
full scale analog voltage is 1V, the smaller unit (LSB) or 001 is equivalent to 1/8 of 1V. The 100
(MSB) represents half of the full scale value. For the maximum input signal 111, the output
signal is equal to the value of the full -scale input signal minus the value of the 1 LSB. So for a
fullscale voltage 1V, it will be 7/8V in the above example.

The basic microprocessor board, VBMB-002, incorporates two 8-bit Digital to Analog
converters, DAC 0800.
DAC 0800 is a monolithic, high speed, current output Digital to Analog converter. Its
unique features are:
Typical settling time of 100 Nanoseconds.
Complementary current outputs .
Differential output voltages of 20V peak to peak with simple resistor loads.
2-quadrant wide range multiplying capability.

The DAC interface section comprises of


I/O decoding
D/A conversion circuit
I/O DECODING:
The ICs 74LS138 and 74LS00 form the ad dress decoding logic in this interface board.
The address lines A3, A4 and A5 are tied to pin1, pin2 and pin3 of 74LS138 respectively. The
address lines A6 and A7 are NANDed together and the NAND gate output is connected to pin5
of 74LS138. Similarly IOW a nd IOR signals are NANDed and the NAND gate output is
connected to pin6 of 74LS138. Pin4 is grounded.
Thus with
A7
A6
A5
1
1
0
= C0 (Hex)
DAC1 is selected, and with

A4
0

A3
0

A2
x

A1
x

A0
x

A7
A6
1
1
= C8 (Hex)
DAC2 is selected.

A4
0

A3
1

A2
x

A1
x

A0
x

A5
0

The DAC outputs are available at the 5 pin connector (P2). DAC 1 and DAC 2 outputs
are terminated at pin 5 and pin4 respectively. Pin1 is connected to the ground.
The DAC 0800 is a simple monolithic 8 -bit D/A converter. It has fast settling time of 100ns.
It can be directly interfaced to TTL, CMOS, PMOS and others. It operates at 4.5V to +18V

supply. The number of data bit inputs decides the resolution of the DAC since the number of
analog output levels is equal to 2 , where n is the number of data bit inputs. Therefore, an 8
-input
DAC such as the DAC0808 provides 256 discrete voltage (or current) levels of output.
Port 1(8 bits of the microcontroller is connected to the input data lines of DAC -08.The
reference current is determined by the resistor R1 and the reference voltage V ref. The resistor R2
is generally equal to R1 to match the input impedance of reference source. The output (taken
from pin number 4 is observed either on a digital multimeter or on a cathode ray oscilloscope.
The output current Io is calculated as follows:
Io = Vref/R1[Ao/2 + A1/4 + A2/8 + +A7/256]
The output voltage Vo is obtained as follows: V o =Io * R1
5. Describe the LCD interfacing for a microcontroller based system design (NOV 2015)
There are basically two types of LCDs as far as the interfacing technique is concerned:
parallel LCDs and serial LCDs. Parallel LCDs (e.g. Hitachi HD44780 series) are connected
to the microcontroller circuitry such that the data is transferred to the LCD unit using more
than one data line, and four or eight data lines are very common. Serial LCDs are connected
to a microcontroller using only one data line and data is usually transferred to the LCD using
the standard RS-232 asynchronous data communication protocol. Serial LCDs are much
easier to usebut they usually cost more than the parallel ones. Parallel LCDs are used in the
temperature projects in this book to show the value of the measured temperature.
HD44780 LCD module
HD44780 is one of the most popular LCD modules used in industry and also by
hobbyists. This module is monochrome and comes in different shapes and sizes. Modules with
line lengths of 8, 16, 20, 24, 32, and 40 characters can be selected. Depending upon the model
chosen, the display width can be selected as 1, 2, or 4 lines. The display provides a 14 -pin
connector to interface to the external world.
Pin No.
1

Name
Vss

Function
Ground

Vdd

Positive Supply

VEE
RS
R/W
E
D0
D1
D2
D3
D4
D5
D6

Contrast

4
5
6
7
8
9
10
11
12
13

Register Select
Read/Write
Enable
Data Bit 0
Data Bit 1
Data Bit 2
Data Bit 3
Data Bit 4
Data Bit 5
Data Bit 6

14

D7

Data Bit 7

Vss is the 0 V supply or ground. The VDD pin should be connected to the positive
supply. Although the manufacturers specify a 5 V d.c. supply, the module s willusually work with
as low as 3 V or as high as 6 V.
Pin 3 is named as VEE and this is the contrast control pin. This pin is used to adjust the
contrast of the device and it should be connected to a variable voltage supply. A potentiometer is
usually connected between the power supply lines with its wiper arm connected to this pin so
that the contrast can be adjusted. This pin can be connected to ground for most applications.
Pin 4 is the Register Select (RS) and when this pin is LOW, data transferred to the
display is treated as commands. When RS is HIGH, character data can be transferred to and from
the module.
Pin 5 is the Read/Write (R/W) line. This pin is pulled LOW in order to write commands
or character data to the LCD module. When this pin is HIGH, character data or status
information can be read from the module.
Pin 6 is the Enable (E) pin which is used to initiate the transfer of commands or data
between the module and the microcontroller. When writing to the display, data is transferred
only on the HIGH to LOW transition of this line. When reading from the display, data becomes
available after the LOW to HIGH transition of the enable pin and this data remains valid as long
as the enable pin is at logic HIGH.
Pins 7 to 14 are the eight data bus lines (DO to D7). Data can be transferred between the
microcontroller and the LCD unit using either a single 8 -bit byte, or as two 4-bit nibbles. In the
latter case, only the upper four data lines (D4 to D7) are used. The 4-bit mode has the advantage
that fewer I/O lines are required to communicate with the LCD.
Connecting the LCD to the microcontroller
The LCD module is assumed by default to be connected to Port B of a PIC microcontroller. The
pin connections are as follows:
LCD module Port B pins
RS
B1
R/W B2
E
B3
D4
B4
D5
B5
D6
B6
D7
B7

The functions used to send data and control to the LCD module are LCD and LCDString.
Function LCD sends a control function to the module as given below:
LCD statement Function
LCD(-1) Initialize the display to 1 line
LCD(-2) Initialize the display to 2 lines
LCD(257) Clear display and home the cursor
LCD(258) Return the cursor to home position
LCD(256+128+N) Return cursor to position N on line 1, where N = 0 is the first character
position on line 1
LCD(256+192+N) Return cursor to position N on line 2, where N = 0 is the first
character
position on line 2

Das könnte Ihnen auch gefallen