Can someone help me with writing the code for microwave controller? please. I wrote like couple lines but I don’t get the idea and how to keep going
——————————-
First, I chose my buttons to be “power”, “time”, “start”, and “cancel”. And the way it will work is
The user will start the microwave when it is in the initial state, the door is closed, the user will open the door, choose what he or she needs by setting the time, power, or mode of operations ( This option will have multiple modes for example, chicken, meat, popcorn, reheat, pizza, frozen beverages) so if the user chooses any of these, the microwave will start working without having the user choose the time or the power.
Then, we will be asked to press the time needed to cock something, for example, my display for the time will look like 00:00 and any number pressed will scroll to the left on the display, for example, if I push 1, 0, 2, 2 this means set the time for 10 minutes and 22 second and after we set the time, we press “Enable”. If the user made a mistake entering the time, he or she can press the “C” key which clears the display to 00:00 and start over. After the user enter the time, the timer should start counting down till it reaches 0 seconds again, and after that the over will be back to initial state so that another user can use it, when the timer reaches 00:00, the sounds (beep) should start beeping for a half of a second and then stop.
For the Power level, I am having four power options, this will let the user change the power based on the food he or she wants to heat up, for example, my power starts at 50 W till 400 and I also made a customize power where user can choose at which level he or she wants to heat up something, for example if the user has Chicken, the power needed for chicken is 100 W and so on.
For the “cancel” button, user can press it at any time if he or she wants to cancel the cooking process, and this will bring the controller back to it’s initial state.
For the DOOR button
• a switch will give a logic ‘1’ when it is closed.
• If the user open the door by an accident or to check if the food is ready or not, the timer will stop but it will not be reset and by after that when the user closes the door again, the cooking time will start again from the point at which it stopped
This is what I am working on. I also need the testbench for it
`timescale 1ns / 1ps
module microwave (input start, clk,
[5:0] timer, [7:0] power,
[10:0] TEMPpower,
output reg Done);
integer i;
integer TEMP;
integer power;
always @ (posedge clk) begin
if (start) begin
for (i = 0; i < 60; i = i+1) begin
if ( i == 60)
Done = 1;
else begin
Done = 0;
end
end
end
end
if (power == 1)begin
output power =100;
end
else if (power == 2)begin
output power = 200;
end
else if (power == 3) begin
output power = 300;
end
else if (power == 4) begin
output power = 400;
end
else ( power == 5 ) //customize the power
TEMPpower =
endmodule
0 comments