0% found this document useful (0 votes)
95 views8 pages

CCDProject

DKIF

Uploaded by

Aryan Pund
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views8 pages

CCDProject

DKIF

Uploaded by

Aryan Pund
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Group no: 7 Date:

Communication Circuit Design (CCD) Lab Project

Experiment No: 08
Frequency Scaling and PWM Generator

● Aim: To design a Frequency Scaling and Pulse Width Modulation block which has a
50MHz clock and 4-bit Pulse width as inputs.

● Components: Quartus Software.

● Theory:
● Frequency Scaling: -
o Frequency scaling, in simple terms, is a technique used to adjust the speed at which
our system operates. Imagine our system as a diligent worker who can perform tasks.
Now, think of this worker as having the ability to work at different speeds, like walking,
jogging, or running.
o In computing, we measure the speed at which this computer operates in Hertz (Hz),
often in Gigahertz (GHz), which means billions of cycles per second. When we scale
the frequency, it's like telling the computer to work faster or slower.
o If we scale up the frequency, our computer can perform tasks more quickly, which can
make our computer feel snappier and more responsive for tasks that require a lot of
performing power, like gaming or video editing. However, this also means the computer
consumes more energy and generates more heat, so it's a trade-off.
o Conversely, if we scale down the frequency, the computer performs tasks more slowly,
which can save energy and reduce heat generation. This is handy for tasks that don't
require as much power, like checking emails or writing documents, as it extends our
device's battery life and keeps it cool.
o So, frequency scaling is a way to find the right balance between performance and
power consumption in our computing devices by adjusting the speed at which it works.
• How to implement that in Verilog?
o One common way to scale down the frequency is to use the counters. For this
example, we will scale down the frequency from 50MHz to 3.125MHz.
o Original Frequency: As we have original clock signal with a frequency of 50MHz. This
means that the clock signal completes one full cycle every 1 / 50,000,000 seconds, or
20 nanoseconds (ns).
o Desired Frequency: We want to scale down the frequency to 3.125MHz, which means
we want one cycle of the signal to last 1 / 3,125,000 seconds, or 320 ns.
o Counter Value: To achieve this, we need to create a counter that counts a certain
number of cycles before toggling the signal of the desired frequency. In this case, the
counter counts up to 7 (since it starts from 0), and when it reaches 7, it toggles the
signal i.e., one half cycle. This effectively divides the original clock signal by 8 (since 7
+ 1 = 8).
o So, the counter value of 8 is chosen because it represents the number of original clock
cycles required to create one half cycle of the scaled-down clock at the desired
frequency of 3.125MHz. Each original clock cycle corresponds to 20 ns (1 / 50MHz),
and when we count two half cycles of these cycles, we get the desired 320 ns (1 /
3.125MHz) period for the scaled-down clock signal.

o Let's take an example, If we want to generate 3.125MHz clock from 50MHz Clock, then
we can determine the counter value by using the following method.

Countervalue = actual Frequency


desired Frequency

countervalue= 50∗106 = 16
6
3.125∗10
But this value is for a complete cycle i.e both positive and negative half cycles.
With this knowledge, we will be able to write the code in Verilog.

• PWM Signals
o Pulse Width Modulation (PWM) is a clever technique used to control the speed or power
of devices like DC motors in a simple yet effective way.
o It works by rapidly turning the device on and off while varying the duration of the "on"
state, represented as a percentage of the total cycle time. This percentage, known as the
duty cycle, determines the average power delivered to the device.
o PWM is crucial because it offers a simple and efficient way to control the power delivered
to devices. Unlike traditional methods that use resistors to reduce voltage (which can
waste energy as heat), PWM reduces power by switching the device on and off. This
makes it highly energy-efficient and suitable for battery-powered devices.
o Additionally, PWM allows precise control over devices' behaviors, making it
indispensable in various applications where we need to regulate speed, intensity, or
voltage without relying on bulky and inefficient components.
o Let's say we have a DC motor, and we want to make it spin at a variable speed. By
applying PWM, we control how long the motor is powered on during each cycle.
o For instance, with a 50% duty cycle, the motor is on for half the time, resulting in roughly
half the speed. If we increase the duty cycle to 75%, the motor runs at 75% of its
maximum speed. Refer the Figure 2.
o By adjusting the duty cycle, we can smoothly vary the motor's speed, making it a versatile
tool for applications like robotics, fan speed control, and even dimming lights.
● Use of the concepts of counter?
o Using a counter to create a PWM (Pulse Width Modulation) signal is a straightforward
and commonly used method. Here's how we can implement it.
o Counter Setup: First, we need a counter that counts up from 0 to a maximum value,
typically referred to as the "period" or "cycle" value. The period value determines the
time it takes for one complete cycle of the PWM signal. For example, if we want a
PWM signal with a period of 16 clock cycles, our counter should count from 0 to 15.
o Duty Cycle Control: To control the duty cycle (the percentage of time the signal is in
the "on" state), we need another signal, often referred to as the duty_cycle value. This
value is compared to the counter value. When the counter value is less than the
duty_cycle value, the PWM output is high (on), and when it's equal to or greater than
the duty_cycle value, the PWM output is low (off).
o PWM Output: The output of the PWM signal is taken from the comparison result. When
the counter is less than the duty cycle value, the output is high (logical '1'), and when
the counter is greater or equal to the duty_cycle value, the output is low (logical '0').

• Circuit Setup:
• Applications:

1. Frequency Scaling:-.
Frequency scaling involves adjusting the clock frequency of a system or component, which
has a few practical applications:
1. Power Management: Lowering the frequency in microcontrollers or processors reduces
power consumption, which is especially useful in battery-powered devices. Many
embedded systems use dynamic frequency scaling to balance performance and power
based on workload.
2. Processor Performance Control: In systems with a variable workload, frequency scaling
allows a processor to run slower when demand is low and faster when demand is high.
3. Real-time Control Systems: In embedded systems that rely on precise timing, frequency
scaling can help meet specific timing requirements by setting a clock rate that syncs
perfectly with the required operational intervals.

2. PWM (Pulse Width Modulation) Generator: -


PWM is a technique for generating a signal where the width of the pulse (or ON time)
can be varied to control the power delivered to a load. PWM is widely used in:
1. Motor Control: PWM signals are used to control the speed of motors by varying the
average power delivered.
2. LED Dimming: By adjusting the duty cycle of a PWM signal, the brightness of LEDs can
be controlled.
3. DC-DC Converters: PWM helps in regulating output voltage in DC-DC converters by
varying the on-off ratio of switches.
4. Communication: PWM can be used in signal encoding, such as in infrared remote
controls.
● Advantages:

1. Power Savings: Reduces energy consumption, particularly in battery-operated devices,


by adjusting the clock frequency based on workload. This helps prolong battery life.
2. Heat Reduction: Lower frequencies generate less heat, which helps maintain cooler
operating conditions and prolongs component lifespan.
3. Flexible Performance: Allows systems to dynamically adjust performance levels
depending on the workload, providing a balance between speed and efficiency.
4. Efficient Power Control: PWM is highly efficient in controlling power delivered to devices
like motors, lights, and heaters, since it minimizes power loss in switches.
5. Precision Control: PWM provides precise control over devices, allowing for accurate
adjustments of speed, brightness, and power levels.
6. Versatility: PWM can be used in various applications, from motor control to signal
processing, audio applications, and even communication.

• Disadvantages:

1. Reduced Processing Power: Lowering frequency decreases the processing speed, which
may not be suitable for applications requiring high-performance or real-time responses.
2. Implementation Complexity: Requires additional circuitry or software to control frequency
scaling, adding to the complexity and potential development cost.
3. Electromagnetic Interference (EMI): Rapid switching in PWM signals can produce EMI,
which may interfere with nearby electronics, requiring additional filtering or shielding.
4. Acoustic Noise: In certain applications (e.g., motors), the rapid switching may produce
audible noise, which can be undesirable in quiet environments.
5. Increased Complexity in Filtering: PWM signals often require low-pass filtering to smooth
out the waveform, adding complexity and cost in applications needing stable DC output.

• Code: -

Frequency Scaling: -
//Inputs : clk_50MHz
//Output : clk_1MHz
module frequency_scaler (
input clk_50MHz,
output reg clk_1MHz
);
initial begin
clk_1MHz = 0;
end
reg [4:0] counter = 0;
always @ (posedge clk_50MHz) begin
if(!counter) clk_1MHz=~clk_1MHz;
counter=counter + 1'b1;
if(counter == 5'b11001) counter =0;
end
endmodule

PWM Generator: -
//Inputs : clk_1MHz, pulse_width
//Output : clk_500Hz, pwm_signal
module pwm_generator(
input clk_1MHz,
input [3:0] pulse_width,
output reg clk_500Hz, pwm_signal
);
initial begin
clk_500Hz = 0; pwm_signal = 1;
end
reg[9:0] counter=0;
reg[4:0] pwm_counter=0;
reg[6:0] counter2=0;
always @ (posedge clk_1MHz)begin
if (!counter) begin
clk_500Hz = ~clk_500Hz;
end
counter = counter + 1'b1;
if(counter==10'b1111101000) counter=0;
if(pwm_counter < pulse_width)pwm_signal =1;
else pwm_signal = 0;
counter2=counter2 +1'b1;
if(counter2 == 7'b1100100)begin
pwm_counter=pwm_counter +1'b1;
if(pwm_counter == 5'b10100)pwm_counter =0;
counter2 =0;
end
end
endmodule
● Observation:
Simulation:
● Conclusion: -
The experiment demonstrated that combining PWM generation and frequency scaling
enhances control precision and energy efficiency in electronic systems. PWM allowed
precise adjustments to power output by varying duty cycles, which was effective for
applications requiring variable speed or brightness control. Meanwhile, frequency scaling
helped lower energy consumption by adjusting operating speed based on workload,
making it especially useful for power-sensitive applications. Together, these techniques
proved complementary: frequency scaling reduced overall power demands, while PWM
provided fine control without excessive power loss. This combination is highly beneficial
in modern electronics, enabling adaptable, efficient, and responsive system designs.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy