Você está na página 1de 72

PULSE WIDTH MODULATION TECHNIQUES FOR INVERTERS

Submitted in partial fulfillment for the award of the degree


Bachelor of Technology
In
Electrical Engineering
By

AROKKIA JERALD PRAVEEN.D (11BEE0033)


KIRAN.R (11BEE0168)
Under the Guidance of

Dr.Sreejith.S
School of Electrical Engineering
(SELECT)

VIT
UNIVERSITY
(Estd. u/s 3 of UGC Act 1956)

SCHOOL OF ELECTRICAL ENGINEERING


VITUniversity
VELLORE – 632014, Tamil Nadu, India

MAY 2015

1
CERTIFICATE
This is to certify that the project work titled PULSE WIDTH MODULATION
TECHNIQUES FOR INVERTERS submitted by Kiran.R and Arokkia Jerald Praveen.D is
in partial fulfillment of the requirements for the award of BACHELOR OF TECHNOLOGY in
Electrical and Electronic Engineering , is a record of bonafide work done under my guidance.
The contents of this project work, in full or in parts, have neither been taken from any other
source nor have been submitted to any other Institute or University for award of any degree or
diploma and the same is certified.

The thesis is satisfactory / unsatisfactory

Internal Examiner External Examiner

Approved by

Dean

School Of Electrical Engineering

2
ACKNOWLEDGEMENTS

We have taken efforts in this project. However, it would not have been possible without the kind
support and help of many individuals and organizations. We would like to extend my sincere
thanks to all of them.

We are highly indebted to Dr.Sreejith.S for his guidance and constant supervision as well as for
providing necessary information regarding the project & also for his support in completing the
project.

We would like to express our gratitude to our chancellor Dr.G Visvanathan, Dr.Partha Sarathi
Malik Dean of SELECT school and Prof.Vijaya Kumar (Program Chair) and members of VIT
University for their kind co-operation and encouragement which helped us in completion of this
project

AROKKIA JERALD PRAVEEN.D(11BEE0033)

KIRAN.R(11BEE0168)

3
Table of Contents

Abstract ...........................................................................................................................................6

1.Introduction...................................................................................................................................7

1.1.Objective....................................................................................................................................8

1.2.Motivation..................................................................................................................................8

1.3.Background................................................................................................................................9

2.Project Description and Goals......................................................................................................9

3.Technical Specification...............................................................................................................11

4. Design Approach and Details....................................................................................................12

4.1.Design Approach.....................................................................................................................12

4.1.1.Rectifier circuit.........................................................................................................12

4.1.2.7805 regulator..........................................................................................................14

4.1.3.Power supply circuit.................................................................................................15

4.1.4.Microcontroller.........................................................................................................16

4.1.4.1.PIC 16F877A Microcontroller...................................................................16

4.1.4.2.PWM Mode...............................................................................................23

4.1.4.3.Analog.......................................................................................................26

4.1.4.4.Digital........................................................................................................27

4.1.4.4.1.Communication and Control...................................................................28

4.1.5.PulseWidthModulationTechiniques.........................................................................29

4.1.5.1.Single Pulse Width Modulation................................................................29

4.1.5.2.Multiple Pulse Width Modulation.............................................................31

4.1.5.3.Sinusoidal Pulse Width Modulation.........................................................33

4
4.1.5.4.Harmonic Pulse Width Modulation......................................................34

4.1.5.5.Phase displacement Pulse Width Modulation.......................................36

4.1.5.6.Modified sinusoidal Pulse Width Modulation......................................38

4.1.5.7.Stepped Pulse Width Modulation.........................................................40

4.1.5.8.Selected Harmonic Pulse Width Modulation........................................41

4.1.5.9.Trapezoidal Pulse Width Modulation...................................................42

4.1.5.10.Staircase Pulse Width Modulation......................................................43

4.2 Codes and Standards...........................................................................................................44

4.3 Constraints, Alternatives and Tradeoffs.............................................................................44

5. Schedule, Tasks and Milestones...........................................................................................45

6. Project Demonstration..........................................................................................................45

7. Marketing and Cost Analysis...............................................................................................46

7.1 Marketing Analysis............................................................................................................46

7.2 Cost Analysis.....................................................................................................................46

8.Hardware setup......................................................................................................................47

9.Summary...............................................................................................................................48

10.Conclusion..........................................................................................................................49

11.References...........................................................................................................................50

Appendix A..............................................................................................................................51

5
Abstract

In this project, we have generated ten different types of pulse width modulation
techniques for inverters. The microcontroller is the most efficient tool for generating various
pulse width modulation techniques. Microcontroller is used to produce different types of pulse
width modulation techniques and those pulses are fed to the inverter . A opto-isolator is used to
feed the pulses from the microcontroller to the inverter. The advantages of PWM based
switching power converter over linear power amplifier are Lower power dissipation, Easy to
implement and control, No temperature variation and aging-caused drifting or degradation in
linearity and Compatible with today’s digital micro-processors. In this project study and
comparison of different types of pulse width modulation controlled methods are implemented.
The different PWM techniques are Single-pulse modulation, Multiple pulse modulation and
Sinusoidal pulse width modulation, Modified sinusoidal pulse width modulation, Harmonics
Injected modulation, Phase Displacement control, stepped modulation, staircase modulation,
trapezoidal modulation and selected harmonics modulation are implemented using
microcontroller in software and hardware.

6
1. Introduction

The output voltage waveform of ideal inverters should be sinusoidal. However, the
waveform of practical inverters are non-sinusoidal and contain harmonics. The harmonic
contents of output voltage can be minimized by implementing different pulse width modulation
techniques. Inverters are widely used in industrial applications such as variable-speed ac motor
drives, induction heating, standby power supplies and uninterruptible power supplies.
The advantages of PWM based switching power converter over linear power amplifier
are Lower power dissipation, Easy to implement and control, No temperature variation and
aging-caused drifting or degradation in linearity and compatible with today’s digital micro -
processors[1][2].

The reference paper [3] discuss about inverters that transfers power from a DC source to
an AC load. Inverters are widely used in motor drives, to maintain voltage , in ups, etc. Output
voltage from an inverter can also be adjusted by exercising a control within the inverter itself.
The most efficient method of doing this is by pulse width modulation control used within an
inverter. This paper presents study of performance of Sinusoidal Pulse Width Modulation
(SPWM) technique for voltage source inverter. SPWM scheme is modeled in Pspice. This model
is used to predict harmonics under various conditions of modulation index. The performance of
technique is presented in terms of the Total Harmonic Distortion (THD) and output RMS
voltage. Basically, Total Harmonic Distortion describes the quality of the output waveform.
Effects of harmonics on output of sinusoidal pulse width modulation (PWM inverter) is
presented[4].

To control Induction motor drives, PWM inverters is very popular . Using VSI possible
to control both frequency and magnitude of the voltage and current applied to Induction motor
drive. As a result, PWM inverter-fed IM motor drives are more variable, reliable and offer a
wide range speed. Also it gives better efficiency and higher performance when compared to
fixed frequency Induction motor drives[5].

7
1.1 Objective

The main objective of the project is to study the switching techniques for dc-ac
converters known as inverters and to study the operation of inverters. The other objective is to
eliminate harmonics and obtain a near sinusoidal output waveform from the inverter by
implementing different pulse width modulation techniques.
Pulse-width modulation (PWM) is the basis for control in power electronics. The
theoretically zero rise and fall time of an ideal PWM waveform represents a preferred way of
driving modern semiconductor power devices. With the exception of some resonant converters,
the vast majority of power electronic circuits are controlled by PWM signals of various forms.
DC to AC converters are known as Inverters.
The function of inverter is to change DC input voltage to a symmetric output voltage of
desired magnitude and frequency. The output voltage could be fixed or variable at a fixed or
variable frequency. A variable output voltage can be obtained by varying the input DC supply
and maintaining the gain of the inverter constant.
On the other hand, if the DC input voltage is fixed and it is not controllable, a variable
output voltage can be obtained by varying the gain of the inverter, which is normally
accomplished by pulse width modulation control within the inverter. The inverter gain is
normally defined as the ratio of ac output voltage to dc input voltage.

1.2 Motivation

One common problem in producing the pulses in the convention way is the huge size of
the circuits with the comparator . This results in frequent faults in the circuits and boredom for
the user to fix the faults. Microcontroller has advantages of reduced faults and reduced circuit
size. Microcontroller is dumped with a special program which produces 10 different types of
input pulse width modulation waveforms. It will provide a range of pulse width modulation
techniques to enhance the inverter output waveform. It will be able to reduce harmonics of the
output waveform.

8
1.3 Background

There are numerous types of pulse width modulation techniques to trigger the inverters.
But using wave generators and comparators will result in increase in the size of the pulse
generation circuit and causes fault frequency to increase. Switching power converters are used in
industrial application to convert and deliver their required energy to the motor or lo ad because
of advances in solid state power devices and microprocessors. Pulse Width Modulation variable
speed drives are increasingly applied in many new industrial applications that require superior
performance.

2.Project Description and Goals

The goal of the Pulse Width Modulation techniques for inverters project is to generate 10
different types of pulse width modulation waveforms using microcontroller that autonomously
generates pulses itself by selecting the type of pulses to be given to the inerter. In order to do this
the program for generating pulses must be dumped into the microcontroller. The project has been
divided into five broad areas to achieve the targeted functionality:

 Writing program to generate 10 different types of pulse width modulation techniques


using PIC C compiler.

 Debugging and uploading the program into the microcontroller.

 Using a rectifier circuit to feed the microcontroller with constant 5V DC power supply.

 Relaying on opto-isolator for isolation of circuits.

 Feeding the pulses to the single phase inverter through opto-isolator .

The presently existing method for generating pulse width modulation techniques has
complex circuits and has high frequency of fault occurrence. Therefore, the targeted
microcontroller based pulse generation method has lesser complex circuits and very less
possibility of fault occurrence. The infrequency of faults would not only reflect simplicity in
the implementation of the system by non-technical customers, but it would also be reliable.

9
Fig.2.1.Block Diagram of PWM techniques for Inverters

In many industrial applications, it is often required to control the output voltage of


converters. The most efficient method of controlling the output voltage is to incorporate pulse-
width modulation (PWM) control within the inverters. In many industrial applications , to
control the output voltage of the inverters is necessary to cope with the

 Variations of various pulse width modulation techniques

 To regulate voltage of inverters

 To satisfy constant volt

 To satisfy the constant frequency control requirement

10
With the above mentioned goals in mind, the microcontroller based pulse generation system will
have the following functions:

 Autonomous generation of 10 different types of pulse width modulation techniques.

 Continual knowledge of input pulses and output of the inverters.

 Control of input pulses depending on the requirement.

 Contingency to resume generating pulses after an occurrence of any accident.

 To vary the output of the inverters.

 Microcontrollers can be operated in any environment.

In addition, the microcontroller based pulse generation system will also have the following
features:

 Ease of use and simplicity in implementation.

 Adaptability to any input by the user.

 Option to choose different pulse width modulation techniques.

 Ability to be controlled according to the human requirement.

 Possibility to select different input pulses with the use of switches.

3. Technical Specification
While the overall goals, strategies and objectives have been stated, the specifications of the
components will be determined as they are identified for their applicability in the project. The
overall system will meet the specifications stated in Table 3.1.

11
Operational Specifications Value

Microcontroller Voltage Range 5V(constant dc supply)

Performance Specifications

Output accuracy 99 %

Fault occurrence 1%

Failures 0

Frequency range 0 – 50kHz

Contingency algorithm to resume race after an accident.

Table 3.1. Technical specifications for the Microcontroller based pulse generation system.

4.Design Approach and Details


Interface Specifications

Compatibility with Track Designer.


4.1 Design Approach
Compatibility with wireless technology used.
A rectifier circuit is used to convert AC to DC supply and a voltage regulator is used to
Compatibility with microcontroller used for centralized control.
regulate the constant input power to the microcontroller.

Physical Specifications

4.1.1.Rectifier
Cost Circuit: < $100

A rectifier is an electrical device that converts alternating current (AC), which


periodically reverses direction, to direct current (DC), which flows in only one direction. The
process is known as rectification. Physically, rectifiers take a number of forms,
including vacuum tube diodes, mercury-arc valves, solid-state diodes, silicon and other silicon-
based semiconductor switches.

12
Historically, even synchronous electromechanical switches and motors have been used.
Early radio receivers, called crystal radios, used a "cat's whisker" of fine wire pressing on a
crystal of galena (lead sulfide) to serve as a point-contact rectifier or "crystal detector".

Rectifiers have many uses, but are often found serving as components of DC power
supply and high-voltage direct current power transmission systems. Rectification may serve in
roles other than to generate direct current for use as a source of power. As
noted, detectors of radio signals serve as rectifiers.

Fig. 4.1.1.Rectifier Circuit Diagram

In gas heating systems flame rectification is used to detect presence of flame. The simple
process of rectification produces a type of DC characterized by pulsating voltages and currents
(although still unidirectional). Depending upon the type of end-use, this type of DC current may
then be further modified into the type of relatively constant voltage DC characteristically
produced by such sources as batteries and solar cells

13
4.1.2.7805 REGULATOR:

7805 is a voltage regulator integrated circuit. It is a member of 78xx series of fixed


linear voltage regulator ICs. The voltage source in a circuit may have fluctuations and would not
give the fixed voltage output. The voltage regulator IC maintains the output voltage at a constant
value. The xx in 78xx indicates the fixed output voltage it is designed to provide. 7805 provides
+5V regulated power supply. Capacitors of suitable values can be connected at input and output
pins depending upon the respective voltage levels.

Fig. 4.1.2.7805 Voltage regulator

14
4.1.3.Power Supply Circuit:

The rectifier is used to convert AC to DC supply. A voltage regulator IC 7805 is used to provide
constant 5V dc supply to the microcontroller. Capacitors are used to remove the ripples.

Fig. 4.1.3.Power Supply Circuit

15
4.1.4.MICROCONTROLLER:

Micro controllers are used for more specific applications. In the micro controller family
PIC16F877A is more widely used device in the recent times. The reasons for its wide usage are it
has large memory capacity, it has adequate input /output ports etc. The following are the details
about the PIC micro controller.

4.1.4.1.PIC 16F877A Micro Controller

PIC16F874A/877A devices are available in 40-pin and 44-pin packages. All devices in
the PIC16F87XA family share common architecture with the few differences. The available
features are summarized below

Fig. 4.1.4. Pin Diagram of PIC16F877A

16
Peripheral Features

• Timer0: 8-bit timer/counter with 8-bit prescaler.

• Timer1: 16-bit timer/counter with prescaler can be incremented during SLEEP via
external crystal/clock.

• Timer2: 8-bit timer/counter with 8-bit period register, prescaler and post scaler

• Two Capture, Compare, PWM modules.

- Capture is 16-bit, maximum resolution is 12.5 ns.

- Compare is 16-bit, maximum resolution is 200 ns.

- PWM maximum resolution is 10-bit.

• Synchronous Serial Port (SSP) with SPI™ (Master mode) and I2C™

• Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) with 9-bit


address detection.

• Parallel Slave Port (PSP) 8-bits wide, with external RD, WR and CS Controls (40/44-
pin only).

Analog Features

• 10-bit, up to 8 channel Analog-to-Digital Converter (A/D)

• Brown-out Reset (BOR)

• Analog Comparator module with:

 Two analog comparators

 Programmable on-chip voltage reference (VREF) module

 Programmable input multiplexing from device inputs and

 Internal voltage reference

17
Special Microcontroller Features

• 100,000 erase/write cycle Enhanced FLASH program memory typical

• 1,000,000 erase/write cycle Data EEPROM memory typical

• Data EEPROM Retention > 40 years

• Self-reprogrammable under software control

• In-Circuit Serial Programming™ (ICSP™) via two pins

• Single supply 5V In-Circuit Serial Programming

• Watchdog Timer with its own on-chip RC oscillator for reliable operation.

MEMORY ORGANISATION

There are three memory blocks in each of the PIC16F87XA devices. The Program
Memory and Data Memory have separate buses so that concurrent access can occur.

Program Memory Organization

The PIC16F87XA devices have a 13-bit program counter capable of addressing an 8K


word x 14 bit program memory space. The PIC16F876A/877A devices have 8K words x 14 bits
of FLASH program memory. Accessing a location above the physically implemented address
will cause a wraparound. The RESET vector is at 0000h and the interrupt vector is at 0004h.

Table 4.1.1.Port A Functions

18
Table 4.1.2. Summary of Registers Associated With Port A

PORTB and the TRISB Register

PORTB is an 8-bit wide, bi-directional port. Setting a TRISB bit (= 1) will make the
corresponding PORTB pin an input three pins of PORTB are multiplexed with the In- Circuit
Debugger and Low Voltage Programming function: RB3/PGM, RB6/PGC and RB7/PGD.

Table 4.1.3.Port B Functions

Table 4.1.4.Summary of Registers Associated With Port B


19
PORTC and the TRISC Register

PORTC is an 8-bit wide, bi-directional port. The corresponding data direction register is
TRISC. Setting a TRISC bit (= 1) will make the corresponding PORTC pin an input. Clearing a
TRISC bit (= 0) will make the corresponding PORTC pin an output. PORTC is multiplexed with
several peripheral functions. PORTC pins have Schmitt Trigger input buffers. When enabling
peripheral functions, care should be taken in defining TRIS bits for each PORTC pin. Some
peripherals override the TRIS bit to make a pin an output, while other peripherals override the
TRIS bit to make a pin an input. Since the TRIS bit override is in effect while the peripheral is
enabled, read-modify-write instructions (BSF, BCF and XOR WF) with TRISC as the
destination should be avoided.

Table 4.1.5. Port C Functions

Table 4.1.6.Summary of Registers Associated With Port C

20
PORTD and TRISD Registers

PORTD is an 8-bit port with Schmitt Trigger input buffers. Each pin is individually
configurable as an input or output. PORTD can be configured as an 8-bit wide microprocessor
port (parallel slave port) by setting control bit PSPMODE. In this mode, the input buffers are
TTL.

Table 4.1.7. Port D Functions

Table 4.1.8.Summary of Registers Associated With Port D

21
PORTE and TRISE Register

PORTE has three pins (RE0/RD/AN5, RE1/WR/AN6, and RE2/CS/AN7), which are
individually configurable as inputs or outputs. These pins have Schmitt Trigger input buffers.
The PORTE pins become the I/O control inputs for the microprocessor port when bit PSPMODE
is set. In this mode, the user must make certain that the TRISE bits are set, and that the pins are
configured as digital inputs. Also ensure that ADCON1 is configured for digital I/O. In this
mode, the input buffers are TTL. The TRISE register controls the parallel slave port operation.
PORTE pins are multiplexed with analog inputs. When selected for analog input, these pins will
read as ’0’s. TRISE controls the direction of the RE pins, even when they are being used as
analog inputs. The user must make sure to keep the pins configured as inputs when using them as
analog inputs.

Table 4.1.9.Port E Functions

Table 4.1.10.Summary of Registers Associated With Port E

22
4.1.4.2.PWM mode:

These bits are the two LSbs of the PWM duty cycle. The eight MSbs are found in CCPRxL.

Bit 3-0 CCPxM3:CCPxM0: CCPx Mode Select bits

0000 = Capture/Compare/PWM disabled (resets CCPx module)

0100 = Capture mode, every falling edge

0101 = Capture mode, every rising edge

0110 = Capture mode, every 4th rising edge

0111 = Capture mode, every 16th rising edge

1000 = Compare mode, set output on match (CCPxIF bit is set)

1001 = Compare mode, clear output on match (CCPxIF bit is set)

1010 = Compare mode, generate software interrupt on match (CCPxIF bit is set, CCPx pin is
unaffected)

1011 = Compare mode, trigger special event (CCPxIF bit is set, CCPx pin is unaffected);
CCP1resets TMR1; CCP2 resets TMR1 and starts an A/D conversion (if A/D module is enabled)

11xx = PWM mode

PWM Mode (PWM)

In Pulse Width Modulation mode, the CCPx pin produces up to a 10-bit resolution PWM output.
Since the CCP1 pin is multiplexed with the PORTC data latch, the TRISC<2> bit must be
cleared to make the CCP1 pin an output. Figure 4.6.1 shows a simplified block diagram of the
CCP module in PWM mode.

23
Fig. 4.1.3.SIMPLIFIED PWM BLOCK DIAGRAM

A PWM output has a time base (period) and a time that the output stays high (duty
cycle). The frequency of the PWM is the inverse of the period(1/period)

24
Fig 4.1.4. PWM OUTPUT

PWM PERIOD

The PWM period is specified by writing to the PR2 register. The PWM period can be
calculated using the following formula:

PWM Period = [(PR2) + 1] • 4 • TOSC •(TMR2 Prescale Value)

PWM frequency is defined as 1/[PWM period].When TMR2 is equal to PR2, the following three
events occur on the next increment cycle:

• TMR2 is cleared

• The CCP1 pin is set (exception: if PWM duty cycle = 0%, the CCP1 pin will not be set)

• The PWM duty cycle is latched from CCPR1L into CCPR1H.

PWM DUTY CYCLE

The PWM duty cycle is specified by writing to the CCPR1L register and to the
CCP1CON<5:4> bits. Up to 10-bit resolution is available. The CCPR1L contains the eight MSbs
and the CCP1CON<5:4> contains the two LSbs. This 10-bit value is represented by
CCPR1L:CCP1CON<5:4>. The following equation is used to calculate the PWM duty cycle in
time:

PWM Duty Cycle =(CCPR1L:CCP1CON<5:4>) •TOSC • (TMR2 Prescale Value)

CCPR1L and CCP1CON<5:4> can be written to at any time, but the duty cycle value is not
latched into CCPR1H until after a match between PR2 and TMR2 occurs (i.e., the period is
complete). In PWM mode,CCPR1H is a read-only register.The CCPR1H register and a 2-bit
internal latch are used to double-buffer the PWM duty cycle. This double-buffering is essential
for glitch-free PWM operation.When the CCPR1H and 2-bit latch match TMR2,concatenated
with an internal 2-bit Q clock or 2 bits of the TMR2 pre scalar , the CCP1 pin is cleared.

25
PWM:

Pulse width modulation (PWM) is a powerful technique for controlling analog circuits
with a processor's digital outputs. PWM is employed in a wide variety of applications, ranging
from measurement and communications to power control and conversion.

4.1.4.3.Analog electronics:

An analog signal has a continuously varying value, with infinite resolution in both time and
magnitude. A nine-volt battery is an example of an analog device, in that its output voltage is not
precisely 9V, changes over time, and can take any real-numbered value. Similarly, the amount of
current drawn from a battery is not limited to a finite set of possible values. Analog signals are
distinguishable from digital signals because the latter always take values only from a finite set of
predetermined possibilities, such as the set {0V, 5V}.

Analog voltages and currents can be used to control things directly, like the volume of a car
radio. In a simple analog radio, a knob is connected to a variable resistor. As you turn the knob,
the resistance goes up or down. As that happens, the current flowing through the resistor
increases or decreases. This changes the amount of current driving the speakers, thus increasing
or decreasing the volume. An analog circuit is one, like the radio, whose output is linearly
proportional to its input.

As intuitive and simple as analog control may seem, it is not always economically attractive or
otherwise practical. For one thing, analog circuits tend to drift over time and can, therefore, be
very difficult to tune. Precision analog circuits, which solve that problem, can be very large,
heavy (just think of older home stereo equipment), and expensive. Analog circuits can also get
very hot; the power dissipated is proportional to the voltage across the active elements multiplied
by the current through them. Analog circuitry can also be sensitive to noise. Because of its
infinite resolution, any perturbation or noise on an analog signal necessarily changes the current
value.

26
4.1.4.4.Digital control :

By controlling analog circuits digitally, system costs and power consumption can be
drastically reduced. What's more, many microcontrollers and DSPs already include on-chip
PWM controllers, making implementation easy.

In a nutshell, PWM is a way of digitally encoding analog signal levels. Through the use of high-
resolution counters, the duty cycle of a square wave is modulated to encode a specific analog
signal level. The PWM signal is still digital because, at any given instant of time, the full DC
supply is either fully on or fully off. The voltage or current source is supplied to the analog load
by means of a repeating series of on and off pulses. The on-time is the time during which the DC
supply is applied to the load, and the off-time is the periods during which that supply is switched
off. Given a sufficient bandwidth, any analog value can be encoded with PWM.

PWM controllers:

Many microcontrollers include on-chip PWM controllers. For example, Microchip's


PIC16F877A includes two, each of which has a selectable on-time and period. The duty cycle is
the ratio of the on-time to the period; the modulating frequency is the inverse of the period. To
start PWM operation, the data sheet suggests the software should:

• Set the period in the on-chip timer/counter that provides the modulating square wave

• Set the on-time in the PWM control register

• Set the direction of the PWM output, which is one of the general-purpose I/O pins

• Start the timer

• Enable the PWM controller

Although specific PWM controllers do vary in their programmatic details, the basic idea is
generally the same.

27
4.1.4.4.1.Communication and control:

One of the advantages of PWM is that the signal remains digital all the way from the
processor to the controlled system; no digital-to-analog conversion is necessary. By keeping the
signal digital, noise effects are minimized. Noise can only affect a digital signal if it is strong
enough to change a logic-1 to a logic-0, or vice versa.

Increased noise immunity is yet another benefit of choosing PWM over analog control,
and is the principal reason PWM is sometimes used for communication. Switching from an
analog signal to PWM can increase the length of a communications channel dramatically. At the
receiving end, a suitable RC (resistor-capacitor) or LC (inductor-capacitor) network can remove
the modulating high frequency square wave and return the signal to analog form.

PWM finds application in a variety of systems. As a concrete example, consider a PWM-


controlled brake. To put it simply, a brake is a device that clamps down hard on something. In
many brakes, the amount of clamping pressure (or stopping power) is controlled with an analog
input signal. The more voltage or current that's applied to the brake, the more pressure the brake
will exert.

The output of a PWM controller could be connected to a switch between the supply and
the brake. To produce more stopping power, the software need only increase the duty cycle of
the PWM output. If a specific amount of braking pressure is desired, measurements would need
to be taken to determine the mathematical relationship between duty cycle and pressure. (And
the resulting formulae or lookup tables would be tweaked for operating temperature, surface
wear, and so on.)

To set the pressure on the brake to, say, 100 psi, the software would do a reverse lookup
to determine the duty cycle that should produce that amount of force. It would then set the PWM
duty cycle to the new value and the brake would respond accordingly. If a sensor is available in
the system, the duty cycle can be tweaked, under closed-loop control, until the desired pressure is
precisely achieved.PWM is economical, space saving, and noise immune.

28
4.1.5.Pulse Width Modulation Techniques:

4.1.5.1.Single Pulse Width Modulation:

In single pulse width modulation, only one pulse per half cycle is generated and the width
of the pulse is varied to control the inverter output voltage. The gating signals are generated by
comparing a rectangular reference signal with a triangular carrier signal. The figure 4.1.5.1
shows the generation of gating signals of single pulse width modulation.The frequency of the
reference signal determines the fundamendal frequency of the output voltage.

Fig 4.1.5.1.1.Single Pulse Width Modulation

29
The ratio of Ar to Ac is the control variable and defined as the amplitude modulation
index. The modulation index,M is given by,

M=Ar / Ac

By varying Ar from 0 to Ac , the pulse width can be modified from 00 to 1800 and the rms output
voltage V0, from 0 to Vs.

Fig 4.1.5.1.2.Single Pulse Width Modulation

30
4.1.5.2.Multiple Pulse Width modulation:
The harmonics can be reduced by using several pulses in each half cycle of output
voltage. The gating signals are generated by comparing a rectangular reference signal with a
triangular carrier signal.

Fig. 4.1.5.2.1.Multiple Pulse Width modulation

31
The carrier frequency determines number of pulses per half cycle. The frequency of the reference
signal sets the output frequency f0, and the carrier frequency fc determines the number of pulse
per half cycle p.The modulation index controls the output voltage. This type of modulation signal
is also known as uniform pulse width modulation( UPWM). The number of pulses per half cycle
is found from ,

p = fc / 2 f0 = mf /2

where,

mf = fc / f0 is defined as the frequency modulation ratio.

Fig. 4.1.5.2.2.Multiple Pulse Width modulation

32
4.1.5.3.Sinusoidal Pulse Width Modulation:
Instead of maintaining the width of the pulses same as in the case of multiple pulse width
modulation, the width of each pulses is varied in proportion to the amplitude of a sine wave . The
gating signals are generated by comparing sinusoidal reference signal with a carrier triangular
wave. The frequency of the reference signal fr determines the inverter output frequency f0 and its
peak amplitude Ar controls the modulation index,M .The number of pulses per half cycle
depends on the carrier frequency.This sinusoidal pulse width modulation is commonly used in
industrial applications.

Fig. 4.1.5.3.1.Sinusoidal Pulse Width Modulation

33
Fig. 4.1.5.3.2.Sinusoidal Pulse Width Modulation

4.1.5.4.Harmonic Injected Modulation:


The .Harmonic Injected Modulation is generated by injecting harmonics to the sine wave.
This results in flat-topped waveform and reduces the amount of overmodulation. It provides
higher fundamendal amplitude and frequency distortion of the output voltage. The modulating
signal can be generated from 2 ∏ / 3 segments of a sine wave. This is same as injecting 3n
harmonics to the sine wave.

34
The line to line voltage is sinusoidal PWM and the amplitude of the fundamendal
components in approximately 15% more than that of the normal sinusoidal PWM.

Fig. 4.1.5.4.1.Harmonic Injected Modulation

Fig. 4.1.5.4.2.Harmonic Injected Modulation

35
4.1.5.5.Phase Displacement Control:

The phase displacement modulation is used to produce pulses by channging the delay
angle. This type of modulation is highly usefull for high power applications, requiring a large
number of switching devies in parallel.

Fig. 4.1.5.5.1.Phase Displacement Control

36
Voltage control can be obtained by using multiple inverters and summing the output
voltage of individual inverters. As single phase full bridge inverter can be preceived as the sum
of two half bridge inverters.

If the gate signals g1 and g2 are delayed by a some angles α1= α and α2(=∏-α), the output
voltage V has a quaterwave symmetry at ∏ / 2.

Fig. 4.1.5.5.2.Phase Displacement Control

37
4.1.5.6.Modified Sinusoidal Modulation:

In Sinusoidal PWM ,the width of the pulses nearer to the peak of the sine wave do not
change with variation of modulation index.This is due to the charecteristics of sine wave and the
sinusoidaal Pulse width modulation can be modified so that carrier wave is applied during the
first and last 60 degree intervals per half cycle.

Fig. 4.1.5.6.1.Modified Sinusoidal Modulation

38
When the fundamendal component is increased and its harmonic components are
improved. The fundamendal component is increased and its harmonic charecteristics are
improved.This reduces the number of switching of power devices and also reduces switching
losses.

Fig. 4.1.5.6.2.Modified Sinusoidal Modulation

39
4.1.5.7.Stepped Modulation:

The modulating signal is a stepped wave. The stepped wave is not a sample
approximation to the sine wave. It is divided into specific interval say 200,each interval
controlled individually to control the magnitude of fundamendal component and eliminate
specific harmonics. This type of control gives low distortions but higher fundamendal amplitude
compared with normal PWM control.

Fig. 4.1.5.7.1.Stepped Modulation

Fig. 4.1.5.7.2.Stepped Modulation

40
4.1.5.8.Selected Harmonic Injected Modulation:

The .Harmonic Injected Modulation is generated by injecting selected harmonics to the


sine wave. This results in flat-topped waveform and reduces the amount of overmodulation. It
provides higher fundamendal amplitude and frequency distortion of the output voltage.

Fig. 4.1.5.8.1.Selected Harmonic Injected Modulation

Fig. 4.1.5.8.2.Selected Harmonic Injected Modulation

41
4.1.5.9.Trapezoidal Modulation:

The gating signal are generated by comparing a triangular carrier wave with a modulating
trapezoidal wave. The magnitude wave can be obtained from a triangular wave by limiting its
magnitude. The trapezoidal wave can be obtained from a triangular wave by limiting its
magnitude to +/- Ar, which is related to peak value Ar max, by

Ar = ζ Ar(max)

Fig. 4.1.5.9.1.Trapezoidal Modulation

Fig. 4.1.5.9.2.Trapezoidal Modulation

42
4.1.5.10.Staircase Modulation:

The staircase modulation is not a sampled approximation to the sine wave.The levels of
the stairs are calculated to eliminate specific harmonics. The number of steps are choosen to
obtain the desired quantity of output. The level of stairs are calculated to eliminate specific
harmonics. This is an optimized PWM and is not recommened for fewer than 15 pulses in one
cycle.

Fig. 4.1.5.10.1.Staircase Modulation

Fig. 4.1.5.10.2.Staircase Modulation

43
4.2 Codes and Standards:
The current choice for our pulse generation is Microcontroller. The input to the
microcontroller is a constant 5V dc supply. So the AC power supply must be converted into DC
power supply. Also, the voltage put onto the microcontroller must be compliant with the electric
standard to ensure that our pulse generator does not have an unfair advantage in terms of voltage
being delivered to it. The voltage range of the Microcontroller is 0-5 Volts. Also for safety
reasons the microcontroller cannot put out a voltage exceeding 5 volts since it could damage the
microcontroller board.

4.3 Constraints, Alternatives and Tradeoffs

Accuracy and simplicity of use are two fundamental issues for this product. Instead of
using microcontroller, an arduino could be used and it could be used for pulse generation with a
switches. However, arduino does not have enough memory to store all the program for
generating 10 different type of pulse width modulation techniques. Also, the time delay of
transmitting the data along with the instruction would make the control sluggish and
unresponsive. In addition, an arduino would be more expensive than purchasing a
microcontroller. The added weight of an arduino would also hinder the performance of the Pulse
generator.

Letting the end user select the type of information by pressing switch is preferred to
design a system where the pulse generator is user friendly. While using a series of switches saves
the user from entering into confusion, it is more accurate than having software determine the
type of input pulse to be provided. Since all types of pulses to be generated are standardized,
series of switches can determine more accurately the type of input pulse required. As an added
bonus, the microcontroller can exactly produce any pulse conceivable by the user since the
generation of pulses are standardized.

Using microcontroller is more advantageous than designing a software. A piece of


microcontroller is easier for the end user to use and is more interactive. Plus, it offers scalability
such as letting the user enter different difficulties for the pulse generation. Also, since it is just a
piece of microcontroller, program upgrades can easily be made available.

44
5. Schedule, Tasks and Milestones

There are three major milestones as well as sever smaller tasks that must be achieved in
order to reach the milestones. The three milestones are:

 Programming for producing pulse width modulation techniques using the computer with
PIC C compiler.

 Debugging and Implementing the pulse generation using microcontroller.

 Viewing the waveform results using Proteus Design Suite 8.0

 Feeding the generated pulses to the opto-isolator for isolation purposes.

 From the opto-isolator, the triggering pulses are fed to the single phase inverter.

Tasks will be split up among group members according to each member’s level of expertise
or comfort. Each task will be done by the one, who is responsible for completion of that task.
However, the other group member is expected to provide assistance if needed. This way, an
engineer can concentrate on a task but still get help if needed.

6. Project Demonstration
The most important specification that the Pulse generator has to meet is to be competitive
against an experienced user while still being accessible to a new user. Therefore the primary
project demonstration will pit the generation of pulses for inverter against two human opponents,
one with less than 3 hours of experience and the other with more than 30 hours. The track for the
demonstration will be random with the only constraints being available is the generation of
pulses and the necessity to make the two people do the same activity. If the pulse generation can
stay within half the time period of the opponent, either leading or following then it is acceptable.

The secondary design presentation will test the other features such as the best time, and
best speed, production of pulses etc. These features can be demonstrated but do not have
performance criteria to test against.

45
Due to the time required to build the system, it is probably impractical to have the
demonstration live in the classroom. Therefore a photos of the demonstration will be shown
instead.

7. Marketing and Cost Analysis

7.1 Marketing Analysis


The other way of producing pulses for inverter is the conventional method. However, it is
limited in terms of features and robustness. The microcontroller should be fed with the program
before it can start generating the pulses. Reviews state that a single circuit like microcontroller
doesnot provide enough of a challenge to address the issue of not having another competitor to
compete with [5].

Our product will have a scalable interface that can be tailored to a variety of users
ranging from technical enthusiasts to young children. The microcontroller interface allows the
user to get the desired type of pulse width modulation. In addition, our system will be much
more accurate in generating the 10 different types of pulse width modulation techniques. This
means that over many competitors, this system will still be able to generate different types of
pulses faster and accurate.

7.2 Cost Analysis


The cost of all the components used in the project are listed below:

PIC 16F877A 40% of parts ₨.650


Parts
Bridge Rectifier ₨. 20
Transformer ₨.125
Wires ₨. 50
MOSFET ₨. 35
Opto-Isolator ₨. 30

Total Parts ₨.910

Table 7.2.1. Cost analysis for the PWM techniques for inverter .

46
8.Hardware Setup:

Fig.8.1.Hardware setup

The microcontroller is used for generating ten different types of pulses. The different
types of pulses to be feded to the inverter is selected by using a resister switch. The 230V a.c.
supply is converted into 12V a.c supply by using a transformer. A rectifier is then used to
convert a.c to d.c. supply.

A constant d.c. supply to the microcontroller is fed by using a 7805 voltage regulator.
The microcontroller has input from the resistor switch to the input port. These input switches aid
in selecting the type of pulse to be given to the inverter.

The output port of the microcontroller is connected to the gate terminal of the inverter
through opto-isolator. The MOSFET is given a constant d.c. supply from a Variable Power
Supply. The output waveforms are visualized using a digital CRO.

47
9. Summary

Currently, ten different types of pulse width modulation techniques are generated using a
single circuit with PIC microcontroller. Other microcontrollers was also looked into . Once the
PIC microcontroller is chosen, it was purchased and interfaced with the inverter. Preliminary
designs for the generation of pulse waveforms was viewed using Proteus software and tested as
well.

48
10.Conclusion:
The most efficient method of controlling output voltage is to incorporate Pulse Width
Modulation control within inverters. In this method, a fixed d.c. voltage is supplied to inverter
and a controlled a.c. output voltage is obtained by adjusting the type of pulse width modulation
techniques generated using microcontroller. Pulse Width Modulation variable speed drives are
increasingly applied in many new industrial applications that require superior performance.
Switching power converters are used in industrial application to convert and deliver their
required energy to the motor or load because of advances in solid state power devices and
microprocessors . There are so many techniques which are used for controlling of induction
motor drives and PWM technique improves the quality of the current and reduce the torque
ripple in induction motor drive efficiently while maintaining the other performance
characteristics of the system.

11. References

49
[1] Sandeep Kumar Singh, Harish Kumar, Kamal Singh and Amit Patel “A SURVEY AND STUDY OF
DIFFERENT TYPES OF PWM TECHNIQUES USED IN INDUCTION MOTOR DRIVE ” International Journal of
Engineering Science & Advanced Technology,Volume-4, Issue-1, 2014.

[2] Satish Kumar Peddapelli “Recent Advances in Pulse Width Modulation Techniques and Multilevel
Inverters’’ World Academy of Science, Engineering and Technology International Journal of Electrical,
Computer, Electronics and Communication Engineering Vol:8 No:3, 2014

[3] Sangeeta Deb Barman and Tapas Roy “Different Types of PWM Techniques analysis for Z-Source
Inverter” IOSR Journal of Electrical and Electronics Engineering (IOSR-JEEE) e-ISSN: 2278-1676,p-ISSN:
2320-3331, Volume 9, Issue 3 Ver. IV (May – Jun. 2014), PP 09-17

[4] Sonal Arvind Barge & S. R. Jagtap," Harmonic Analysis of Sinusoidal Pulse Width Modulation"
International Journal of Advanced Electrical and Electronics Engineering, (IJAEEE), Volume-2, Issue-5,
2013.

[5]Mr. Sandeep N Panchal, Mr. Vishal S Sheth, Mr. Akshay A Pandya," Simulat ion Analysis of SVPWM
Inverter Fed Induction Motor Drives", International Journal of Emerging Trends in Electrical and
Electronics (IJETEE) Vol. 2, Issue. 4, April-2013.

[6]Srinivasa Rao Maturu and Avinash Vujji," SVPWM Based Speed Control of Induction Motor Drive with
Using V/F Control Based 3-Level Inverter" VSRD-IJEECE, Vol. 2 (7), 2012, 421-437.

[7]Mahesh A patel and Ankit R patel “Use of PWM techniques for Power quality Improvement”
International Journal of Recent trends in engineering,Vol.1,No 4, May 2009.

[8] A.K.Gupta and A.M.Khabadkone “ A General Space Vector PWM Algorithm for Multilevel Inverters,
Including Operation in Over modulation Range”, IEEE Transactions on Power Electronics, vol.22,No.2,
March 2007, pp517-526

[9]Muhammad H. Rashid “Power Electronics Circuits,Devices and Applications” Third Edition.

[10] “Power Electronics” by Dr. P. S. Bimbhra .

APPENDIX

50
SOFTWARE USED TO RUN THE COMPUTER PROGRAM
The software used is PIC C Compiler. It is written in embedded "C" language and compiled using
PIC C Compiler. The source program is converted into a hex file by the compiler. The program is then
loaded into the microcontroller using a USB cable.

The codes are as follows:

#if defined(__PCM__)

#include <16f877a.h>

#include <string.h>

#include <math.h>

#fuses HS,NOWDT,NOLVP

#use delay(clock=20000000)

#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7)

#include <stdlib.h>

#include <stdio.h>

#byte ADCON1=0x9f

void main(void)

int16 s=0,s1=0,s2=0,s3=0,s4=0,s5=0,s6=0,s7=0,s8=0,s9=0;

ADCON1=0x07;

set_tris_b(0Xff);

set_tris_a(0xff);

set_tris_e(0xff);

set_tris_d(0x00);

output_b(0x00);

output_a(0x00);

output_e(0x00);

51
output_low(pin_d0);

output_low(pin_d1);

while(true)

if(input(pin_A0)==0)

s=1;

s1=0;

s2=0;

s3=0;

s4=0;

s5=0;

s6=0;

s7=0;

s8=0;

s9=0;

else if(input(pin_A1)==0)

s=0;

s1=1;

s2=0;

s3=0;

s4=0;

s5=0;

s6=0;

52
s7=0;

s8=0;

s9=0;

else if(input(pin_A2)==0)

s=0;

s1=0;

s2=1;

s3=0;

s4=0;

s5=0;

s6=0;

s7=0;

s8=0;

s9=0;

else if(input(pin_A3)==0)

s=0;

s1=0;

s2=0;

s3=1;

s4=0;

s5=0;

s6=0;

53
s7=0;

s8=0;

s9=0;

else if(input(pin_A4)==0)

s=0;

s1=0;

s2=0;

s3=0;

s4=1;

s5=0;

s6=0;

s7=0;

s8=0;

s9=0;

else if(input(pin_A5)==0)

s=0;

s1=0;

s2=0;

s3=0;

s4=0;

s5=1;

s6=0;

54
s7=0;

s8=0;

s9=0;

else if(input(pin_e0)==0)

s=0;

s1=0;

s2=0;

s3=0;

s4=0;

s5=0;

s6=1;

s7=0;

s8=0;

s9=0;

else if(input(pin_e1)==0)

s=0;

s1=0;

s2=0;

s3=0;

s4=0;

s5=0;

s6=0;

55
s7=1;

s8=0;

s9=0;

else if(input(pin_e2)==0)

s=0;

s1=0;

s2=0;

s3=0;

s4=0;

s5=0;

s6=0;

s7=0;

s8=1;

s9=0;

else if(input(pin_b0)==0)

s=0;

s1=0;

s2=0;

s3=0;

s4=0;

s5=0;

s6=0;

56
s7=0;

s8=0;

s9=1;

if(s==1)

printf("single pulse width modulation \r\n");

output_low(pin_d0);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d0);

delay_ms(7);

output_low(pin_d0);

delay_ms(1);

output_low(pin_d0);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

delay_ms(7);

output_low(pin_d1);

delay_ms(1);

57
else if(s1==1)

printf("Multiple pulse width modulation \r\n");

output_low(pin_d0);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d0);

delay_ms(1);

output_low(pin_d0);

delay_ms(1);

output_high(pin_d0);

delay_ms(1);

output_low(pin_d0);

delay_ms(1);

output_high(pin_d0);

delay_ms(1);

output_low(pin_d0);

delay_ms(1);

output_high(pin_d0);

delay_ms(1);

output_low(pin_d0);

delay_ms(1);

output_high(pin_d0);

delay_ms(1);

58
output_low(pin_d0);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(1);

else if(s2==1)

59
{

printf("sinusoidal pulse width modulation \r\n");

output_high(pin_d0);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d0);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d0);

delay_ms(1);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(1);

output_low(pin_d0);

delay_ms(1);

output_high(pin_d0);

delay_ms(1);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(1);

output_low(pin_d0);

delay_ms(1);

60
output_high(pin_d0);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d0);

delay_ms(1);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

delay_ms(1);

output_high(pin_d0);

delay_ms(1);

output_low(pin_d0);

delay_ms(1);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

delay_ms(1);

output_high(pin_d0);

delay_ms(1);

output_low(pin_d0);

output_low(pin_d1);

delay_ms(1);

else if(s3==1)

61
printf("Harmonic injection modulation \r\n");

output_high(pin_d0);

output_low(pin_d1);

delay_ms(1);

output_low(pin_d0);

delay_ms(1);

output_high(pin_d0);

delay_ms(1);

output_low(pin_d0);

delay_ms(1);

output_high(pin_d0);

delay_ms(1);

output_low(pin_d0);

delay_ms(1);

output_high(pin_d0);

delay_ms(1);

output_low(pin_d0);

delay_ms(1);

output_high(pin_d0);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d0);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d0);

output_high(pin_d1);

62
delay_ms(1);

output_low(pin_d0);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(1);

else if(s4==1)

printf("Modified Sinusoidal Pulse width modulation \r\n");

output_low(pin_d1);

output_low(pin_d0);

63
delay_ms(1);

output_high(pin_d0);

delay_ms(1);

output_low(pin_d0);

delay_ms(1);

output_high(pin_d0);

delay_ms(1);

output_low(pin_d0);

delay_ms(1);

output_high(pin_d0);

delay_ms(2);

output_low(pin_d0);

delay_ms(1);

output_high(pin_d0);

delay_ms(1);

output_low(pin_d0);

delay_ms(1);

output_low(pin_d1);

output_low(pin_d0);

delay_ms(1);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

64
delay_ms(1);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

delay_ms(2);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(1);

else if(s5==1)

printf("stepped Modulation \r\n");

output_low(pin_d0);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d0);

delay_ms(2);

output_low(pin_d0);

delay_ms(1);

output_high(pin_d0);

delay_ms(2);

output_low(pin_d0);

65
delay_ms(1);

output_high(pin_d0);

delay_ms(2);

output_low(pin_d0);

delay_ms(1);

output_low(pin_d0);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

delay_ms(2);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

delay_ms(2);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

delay_ms(2);

output_low(pin_d1);

delay_ms(1);

else if(s6==1)

printf("selected harmonic injection modulation \r\n");

66
output_low(pin_d0);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d0);

delay_ms(2);

output_low(pin_d0);

delay_ms(1);

output_high(pin_d0);

delay_ms(2);

output_low(pin_d0);

delay_ms(1);

output_high(pin_d0);

delay_ms(2);

output_low(pin_d0);

delay_ms(1);

output_low(pin_d0);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(2);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

67
delay_ms(2);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(2);

else if(s7==1)

printf("trapezoidal pwm technique \r\n");

output_low(pin_d0);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d0);

delay_ms(1);

output_low(pin_d0);

delay_ms(2);

output_high(pin_d0);

delay_ms(2);

output_low(pin_d0);

delay_ms(2);

output_high(pin_d0);

delay_ms(2);

output_low(pin_d0);

delay_ms(1);

output_high(pin_d0);

output_high(pin_d1);

68
delay_ms(4);

output_low(pin_d0);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(1);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(1);

else if(s8==1)

printf("phase shifted PWM control \r\n");

output_high(pin_d0);

output_low(pin_d1);

delay_ms(10);

output_low(pin_d0);

output_high(pin_d1);

delay_ms(10);

else if(s9==1)

69
printf("staircase Modulation \r\n");

output_high(pin_d0);

output_low(pin_d1);

delay_ms(2);

output_low(pin_d0);

delay_ms(1);

output_high(pin_d0);

delay_ms(2);

output_low(pin_d0);

delay_ms(1);

output_high(pin_d0);

delay_ms(2);

output_low(pin_d0);

delay_ms(1);

output_high(pin_d0);

delay_ms(1);

output_low(pin_d0);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(2);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(2);

70
output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(2);

output_high(pin_d1);

delay_ms(1);

output_low(pin_d1);

delay_ms(1);

71
72

Você também pode gostar