Question: module Rover ( input clk , input [ 3 : 0 ] SW , input [ 2 : 0 ] IPS, input sw _ ON
module Rover
input clk
input : SW
input : IPS,
input swON
input FREQ,
output : IN
output : EN
;
wire : speed; For rover use. Sent to mainstateMachine
reg : motorduty; For rover use. PWM
wire pwmpulse; Pulse signal from PWM
assign speed SW; Map switches directly to speed
always @
begin
casespeed
b: motorduty b; duty cycle
b: motorduty b; duty cycle approx
b: motorduty b; duty cycle approx
b: motorduty b; duty cycle approx
b: motorduty b; duty cycle full
default: motorduty b; Default to duty cycle
endcase
end
PWM for rover motors use. Has a freq of kHz
PWM #
motors
clk clk
width motorduty
pulse pwmpulse Connect pulse to pwmpulse
;
Keeps rover on alum tape track
IPSsensor pathfinding
clkclk
IPSIPS
ININ
;
Main state machine
mainStateMachine mainstateMachine
clkclk
swONswON
pulsepwmpulse Pass PWM pulse to main state machine
ENEN
stateMSMstate
;
endmodule
module PWM #parameter SIZE PERIOD
input clk
input SIZE: width,
output reg pulse;
reg SIZE: count;
initial
begin
count ;
pulse ;
end
always @ posedge clk
begin
count count PERIOD count : ;
pulse count width : ;
end
endmodule
timescale ns ps
Company:
Engineer:
Create Date: :: AM
Design Name:
Module Name: IPSsensor
Project Name:
Target Devices:
Tool Versions:
Description:
Dependencies:
Revision:
Revision File Created
Additional Comments:
module IPSsensor
input clk
input : IPS,
output : IN motor inputs
;
reg : INLast;
assign IN:
~IPS & ~IPS & ~IPSb : If all IPS lit turnoff
~IPSb : go straight
~IPSb : go right
~IPSb : Go left.
IPS & IPS & IPSb : If all IPS not lit
INLast; If right IPS lit, go right. If none lit stop.
Latch to retain last value.
always @ posedge clk
INLast IN;
endmodule
why are my switches not activating the pwm for the motor control to slow the motors down.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
