You are on page 1of 7

Department of Electrical Engineering, IIEST, Shibpur

Embedded Systems Laboratory Expt. on Control of PWM IC by AT89S52

DEPARTMENT OF ELECTRICAL ENGINEERING


INDIAN INSTITUTE OF ENGINEERING SCIENCE AND TECHNOLOGY,
SHIBPUR

Embedded Systems Laboratory 7th Semester EE


Experiment No.: 1

Study of Microcontroller Based Operation and Control of a PWM IC

A. Preparatory Notes:
i. Equip yourself with (a) the basic essence of pulse-width-modulation (PWM), (b) the
operating principle and basic characteristic features of the PWM IC SG2524 and (c) the
features and principles of operation of the microcontroller AT89S52 from the suggested
readings as given in iii below.

ii. A particular student will be allowed to conduct the experiments only after she/he has
made a detailed survey of the working of the circuits and made investigations on certain
pertinent points. As an example, the following points should be clear:
(a) What is „pulse-width-modulation‟? Why and where is it used?
(b) What is meant by „PWM-resolution‟? Why is it important?
(c) Why is it often preferred to use a PWM IC (e.g. SG2524) for PWM control instead of
fabricating an OPAMP-based circuit?
(d) What are the principle features of the IC SG2524? Where is it primarily used?
(e) Describe the various peripherals, available in the controller AT89S52.
(f) What are the various types of memories, available in AT89S52?
(g) What is meant by „assembly language programming‟? What is its advantages with
reference to AT89S52?

iii. Suggested Readings:


(a) Power Electronics: Converters, Applications and Design by N. Mohan, T. M.
Undeland and W. P. Robbins.
(b) Elements of Power Electronics by P. T. Krein
(c) Datasheet of SG2524: http://www.ti.com/lit/ds/symlink/sg2524.pdf
(d) Datasheet of AT89S52: http://www.atmel.com/images/doc1919.pdf
(e) Instruction Sheet of AT89S52:
http://ww1.microchip.com/downloads/en/DeviceDoc/doc0509.pdf
(f) Kenneth J. Ayala, “The 8051 Microcontroller,” 3rd Edition, 2007.
Dr. S. Dalapati, Asst. Prof., Dept. of EE, IIEST Shibpur Page 1 of 7
Department of Electrical Engineering, IIEST, Shibpur
Embedded Systems Laboratory Expt. on Control of PWM IC by AT89S52

B. Objective:
i. To study and understand the working principle of the AT89S52 controller, as used in
this experiment.
ii. To study and understand the working principle of the PWM IC SG2524, as used in this
experiment.
iii. To observe and understand how a digital controller (AT89S52) may be used a „master-
IC‟ to control a PWM IC (SG2524), acting as a „slave IC‟.
iv. To understand the principle of (a) starting/stopping and (b) Controlling of Pulse-width of
the PWM IC (SG2524) by the master-controller (AT89S52).
v. To find out the relationship between the control signal from the „master-IC‟ (AT89S52)
and the output of the „slave-IC‟ (SG2524).
vi. To alter parameters of the „master-IC‟ output like (a) switching frequency, (b) duty cycle
etc.

C. Set Under Test:


A laboratory built circuit, which employs AT89S52 acting as a „mater‟ to the PWM controller
IC SG2524 (which acts as a „slave‟).

D. Apparatus:
(a) Digital Storage Oscilloscope
(b) Digital Multi-meter
(c) Windows based PC (for changing the source code)

Present the apparatus list in the format below:


Sl. Description of Quantity Range and Maker‟s Maker‟s
No. Apparatus used rating name number

E. Circuit Diagram:
Kindly refer to Fig. 1 for the microcontroller-section, Fig. 2 for the analogue-section and to
Fig. 3 for the power-supply-section of the set up.

Dr. S. Dalapati, Asst. Prof., Dept. of EE, IIEST Shibpur Page 2 of 7


Department of Electrical Engineering, IIEST, Shibpur
Embedded Systems Laboratory Expt. on Control of PWM IC by AT89S52

Fig. 1. Microcontroller section for the set up

Dr. S. Dalapati, Asst. Prof., Dept. of EE, IIEST Shibpur Page 3 of 7


Department of Electrical Engineering, IIEST, Shibpur
Embedded Systems Laboratory Expt. on Control of PWM IC by AT89S52

Fig. 2. Analogue section

Fig. 3. Power-supply-section

Dr. S. Dalapati, Asst. Prof., Dept. of EE, IIEST Shibpur Page 4 of 7


Department of Electrical Engineering, IIEST, Shibpur
Embedded Systems Laboratory Expt. on Control of PWM IC by AT89S52

F. Procedure and Results:


DO NOT TURN ON THE SET UP WITHOUT CONSULTING YOUR TEACHER.

Plug in the input wires of the power supply section to a 230 V, 50 Hz, 1-ph socket.

RUN-1:- STARTING/STOPPING THE PWM IC WITH THE MASTER CONTROLLER


(a) After powering ON the set, note the voltage waveform of pin no. 39 of AT89S52 (w. r. t.
ground) with the help of a DSO. Similarly, check the voltage waveforms at pin nos. 11
and 14 of the IC SG2524. Note down your observation in Table-I.
(b) Press push-button PB1 once. Repeat the measurements of step (a) of RUN-1 and note
down the observations in Table-I.
(c) Press push-button PB0 once. Repeat the measurements of step (a) of RUN-1 and note
down the observations in Table-I.

(d) Press push-button PB1 once again. Repeat the measurements of step (a) of RUN-1 and
note down the observations in Table-I.

Table-I

Obs. Actions Voltage at Pin Voltage at Pin Voltage at Pin Conclusion


No. Taken no. 39 of no. 11 of no. 14 of (SG2524 is
AT89S52 SG2524 SG2524 ON/OFF)
(HIGH / LOW) (Pulses are (Pulses are
Present / Present /
Absent) Absent)
1. Power-Up
Condition
2. PB-1
pressed
3. PB-0
pressed
4. PB-1
pressed

RUN-2: CONTROLLING THE OUTPUT PULSE WIDTH OF THE PWM IC WITH THE
MASTER CONTROLLER
(a) With the set-up in powered ON condition, press the appropriate push-button (PB0 or
PB1), connected to the master-controller, to ensure that the PWM IC has started
(b) Note the waveforms at the following locations/pins (all w. r. t GROUND): (i) pin no. 38 of
AT89S52, (ii) pin no. 2 of SG2524, and (iii) pin nos. 11 & 14 of SG2524 (together in one
screen-shot – one below the other).
(c) Measure the following:- (i) pulse-width and time-period of the pulses at pin no. 38 of
AT89S52, (ii) DC value of the voltage at pin no. 2 of SG2524, and (iii) pulse width and
time-period of the pulses at pin nos. 11 and 14 of SG2524. Fill up the data in the
relevant columns of Table-II.
Dr. S. Dalapati, Asst. Prof., Dept. of EE, IIEST Shibpur Page 5 of 7
Department of Electrical Engineering, IIEST, Shibpur
Embedded Systems Laboratory Expt. on Control of PWM IC by AT89S52

(d) Press PB2 (PW+) push-button, connected to AT89S52 once and repeat step (c) once
again.

(e) Keep repeating steps (c) and (d) for around 10 - 12 sets of observations. Take the
relevant waveforms (as noted in step-b of RUN-2) for one intermediate step and the final
step.

Table-II
Obs. AT89S52 pin no. 38 SG2524
No. Pulse Time Computed Pin no. Pin no. 11 Pin no. 14
width Period Duty 2
(μ- (μ- Cycle (%) DC Pulse Time Computed Pulse Time Computed
sec) sec) (x) voltage width Period Duty width Period Duty
(V) (μ- (μ- Cycle (%) (μ- (μ- Cycle (%)
(y1) sec) sec) (y2) sec) sec) (y3)
1.
2.
3.
4.

RUN-3: STUDYING AND MODIFYING THE SOURCE CODE OF THE MASTER-


CONTROLLER
(a) Study the source code, as will be supplied by the teacher-in-charge. Try to understand
the same.
(b) As per the instruction of the teacher in charge, try to make suitable modifications to the
source code to change parameters, as given by the teacher (for example, you may be
asked to modify the pulse frequency of the master controller of the maximum or
minimum pulse-widths of the master-controller, or may be asked to render the push-
buttons PW+ and PW- ineffective etc.).
(c) Generate the hex code for your modified program by running the assembler.
(d) Load your code on to the controller using the programmer (to be supplied from the lab)
and test whether your modification has worked or not (success of this exercise has the
maximum credit).

G. Report:
i. Explain the working of the pulse generator circuit (slave-IC), as used in this experiment.
Explain how the on-time and switching frequency are being controlled in this IC (without
using a master-controller).
ii. Explain how the master controller is achieving control over the PWM IC in terms of (a)
turning the controller ON/OFF and (b) controlling the pulse-width of the same.
iii. Can you state any other method, by which a digital controller can control the pulse-width
of an analogue IC? State the advantage/disadvantage of your method as compared to
the technique used here.
iv. Can you justify the values of resistances and capacitances, connected between pin nos.
7 and 9 of LM224 (Fig. 2)?

Dr. S. Dalapati, Asst. Prof., Dept. of EE, IIEST Shibpur Page 6 of 7


Department of Electrical Engineering, IIEST, Shibpur
Embedded Systems Laboratory Expt. on Control of PWM IC by AT89S52

v. Using plane graph-paper(s), draw the graphs between the following quantities (i) y1, (ii)
y2 and (iii) y3 – all on the y-axis, with the variable „x‟ on the x-axis (ref. Table-II).
vi. Comment on the nature of variations, as observed in the graphs, drawn in art. (v) and
thereby state the importance of the 5 k-ohm potentiometer (Fig. 2) for this experiment.

Probable Questions which may be asked:


(a) Critically explain the working of the (a) master-controller, (b) slave-controller, (c) power-
supply section and (d) OPAMPs , used in this experiment.
(b) The master-IC works at which supply voltage-level? What is the corresponding figure for
the slave-IC? Are they equal? If NO, then how can they be interfaced together?
(c) Apart from the technique for interfacing, as used in this case, is there any other way, by
which two ICs, working at different voltage levels, can be interfaced? Explain.
(d) If the shutdown pin for the „slave-IC‟ is kept OPEN, will the IC start or remain in shut-
down state? Explain from the internal block diagram of the slave-IC.

Dr. S. Dalapati, Asst. Prof., Dept. of EE, IIEST Shibpur Page 7 of 7

You might also like