Dimiter Kendri
Published © GPL3+

Getting Started with the MiniZed FPGA SoC

Learn how to pulse width modulate an LED from the FPGA side of a Zynq SoC.

AdvancedProtip1 hour9,860
Getting Started with the MiniZed FPGA SoC

Things used in this project

Hardware components

MiniZed
Avnet MiniZed
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1

Software apps and online services

Vivado 2017.4

Story

Read more

Schematics

PL LED on MiniZED

Shows the connections of the PL LED's

Code

PWM control for LED

Verilog
Control the PL Green LED via fabric logic (Verilog)
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: NA
// Engineer: dhq
// 
// Create Date: 04/13/2018 
// Design Name: 
// Module Name: pwmled
// Project Name: ZYNQ_PWM_LED
// Target Devices: 
// Tool Versions: 
// Description: Use a PWM circuit to control the PL led on MicroZED.
// 
// Dependencies: 
// 
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
// 
//////////////////////////////////////////////////////////////////////////////////


module pwmLED(
		input clk, 
		input reset_n,
		output PL_LED_G
		);

reg [25:0] count;
reg [7:0] pwm;

always @(posedge clk or negedge reset_n)
	begin
	if(!reset_n) begin
			 count<=0;
			end else begin
    		  count<=count+1;
    		end
	end

wire [6:0] pwm_input = count[25] ? count[24:18] : ~count[24:18];


always @(posedge clk)
begin
    pwm <= pwm[6:0]+pwm_input;
end

assign PL_LED_G = pwm[7];


endmodule

Credits

Dimiter Kendri

Dimiter Kendri

22 projects • 151 followers
Working with AI, software, HDL, PCB design , robotics and electro-optics.

Comments