Académique Documents
Professionnel Documents
Culture Documents
Industrial Application
Industrial application using microcontrollers involves analog data processing and
control of electrical machines. Following figure shows the basic functional blocks
may be used to automate industrial process or applications.
Feedback Signal
System Under
Control
Analog
Control Signal
Electrical/
Electro-mechanical
Drive
ADC or
Signal Convarter
Analog Signal
Analog Input
Sensor /
Transducer
Digital Input
MPU/MCU
Digital Control
Signal
DAC or
Signal Convarter
From the above figure we can see that the two main interfacing parts are-
Page 1
The analog voltage is applied to pin 6 and the result is available at pins 11
through 18. We will connect pin 1 and 2 (Chip Select and Read) to ground so that
the chip is always enabled. (If you wanted to use more than one ADC you could
use
this
pin
to
control
which
chip
is
currently
enabled).
Connect pin 7 (Vin-) to ground. The ADC0804 includes an internal oscillator
which requires an external capacitor and resistor to operate. Connect the 150 pF
capacitor from pin 4 (CLOCK IN) to ground and the 10k ohm resistor from pin 4
to pin 19 (CLOCK R). Here the ADC0804 is functioning in free-running mode. We
can also control the sampling rate by connecting the WR, INT and RD pins of the
ADC with other port pins, which is shown in the following figure.
Page 2
Here the free running mode has been implemented for simplicity both in the HW
and SW. Detail operation of ADC0804 is out of scope of this chapter, pls., refer to
the datasheet of ADC0804.
Following example code can be used for free-running operation of ADC0804.
MOV A,P0
To use the ADC in programmable mode, we need to follow the following steps,
which are implemented in the following example codes.
-
Page 3
rd equ P1.0
wr equ P1.1
cs equ P1.2
intr equ P1.3
adc_port equ P2
adc_val equ 30H
org 0H
start:
acall conv
acall read
mov P3,adc_val
sjmp start
conv:
clr cs
clr wr
nop
setb wr
setb cs
wait:
jb intr,wait
ret
read:
clr cs
clr rd
mov a,adc_port
mov adc_val,a
setb rd
setb cs
ret
;Start of Program
;Start ADC conversion
;Read converted value
;Move the value to Port 3
;Do it again
;Start of Conversion
;Make CS low
;Make WR Low
;Make WR High
;Make CS high
;Wait for INTR signal
;Conversion done
;Read ADC value
;Make CS Low
;Make RD Low
;Read the converted value
;Store it in local variable
;Make RD High
;Make CS High
;Reading done
13.2 Sensors
A sensor is a device that responds to a physical stimulus (as heat, light, sound,
pressure, magnetism, or a particular motion) and transmits a resulting impulse (a
signal relating to the quantity being measured). For example, certain sensors
convert temperature into a change in resistance. Following are some sensors-
Page 4
Following figures show how to connect LDR and LM35 with an ADC.
13.3 Transducers
A transducer is a device that converts one type of energy to another. The
conversion can be to/from electrical, electro-mechanical, electromagnetic,
photonic, photovoltaic, or any other form of energy. While the term transducer
commonly implies use as a sensor/detector, any device which converts energy
can be considered a transducer.
Page 5
data from the pulse. Following figures show some pulse and switch connected
with the 8951 interrupt pin and port pins respectively.
Page 6
Figure showing the principle to control the direction of a PM-DC, which can be
done by changing the polarity. Following figure shows a circuit that can both
control the direction and speed of a PM-DC motor. Controlling speed of a PM-DC
motor can be done by controlling the applied voltage. To control the voltage we
can use simple PWM implemented in the MCU by SW or the Timer. The principle
of controlling the voltage is same as a buck-converter, where the RMS value
depends on the duty-cycle of the switching pulse, which is-
Page 7
Vo=Vi (Ton/T)
Where, Ton is the on-time and T is the period of the switching pulse.
Following figure shows a circuit that uses a IC containing the bridge driver for the
PM-DC motor. This IC can also be used only for speed control of two PM-DC
motor.
Page 8
Controlling of Stepper motor is little bit software dependent. We can use the
same bridge driver or the IC L293 to control the speed and direction of a Stepper
Motor. Stepper motor speed depends on the frequency of the switching pulse
rather than the pulse-width. Direction of the Stepper depends on the sequence of
the excitation of the coils. By changing excitation process from half-step to fullstep, speed can be increased twice.
Page 9
The second way requires multiple converter stages which are AC-DC converter,
DC-AC inverter. In this way we can control the speed by controlling the DC
voltage output of the first stage keeping the frequency fixed of the second stage.
Or, we can vary the frequency, while keeping the DC voltage fixed. By varying
both the DC voltage and the frequency of the AC output is also possible with
more advantages and complexity in the SW.
Some basic circuits for AC motor control are shown in the following figures.
Page 10
The first part is out of the scope of this book. The second part is similar as
described in the earlier section of this chapter. The third part is mainly the SW
algorithm that is used to control the total system or functions of a Robot. For a
simple Robotic system like a locomotive, following algorithms are very common-
Other than the above control, some intelligence may also be required, which are
not in the scope of this book. Following figure shows a simple block of a Robot
implemented using 8951 MCU.
Page 11