Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

a help to write a sample timer code

Status
Not open for further replies.

MohamadStark

Newbie level 2
Joined
Jan 5, 2017
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
29
hi guys
i want your help to build this code

The system needs to accept the time interval (in seconds) from the user as an input. The system starts a count down and changes the display every second. Once it reaches the last 10 seconds
the displays start flashing. Once the count reaches 0 the system waits for 2 seconds and switches the displays off. At any time the user can reset the counter to the original value by pressing a designated button.
 

Hi,

You need someone to do your job? Without paying? Good luck.

If you really need help, then show exactely what you need, what you have done so far and where you see the difficulties.
What language, what device?

Klaus
 

You need someone to do your job? Without paying? Good luck.
More likely a student that would rather enjoy the party life than study engineering.:roll:

OP, Show the homework you've done and what specific issue is causing you problems that you can get past. Don't expect edaboard members to do your homework for you.
 

There are several ways to do this, each with different advantages. Your goal should be to place most/all of the logic inside a single "always @ (posedge clk)" block -- this makes the design practical.

You should have at least one clk counter that will count to "some value" then reset to "other value" in most of the states of a state machine. The exact "some value" could be state-dependent. There would be a second counter for seconds that decrements. There would also be an enumerated state machine.

An example would have "idle", "countdown_no_blink", "countdown_no_blink_decrement", "countdown_blink_on_start", "countdown_blink_off", "countdown_blink_on_end", "countdown_blink_on_decrement", "cooldown_one", "cooldown_one_decrement", "cooldown_two", "cooldown_two_decrement".

This choice of states was chosen to make simulation easier. In this example, I assume "flashing" (blink) to mean display value for 250ms. off for 500ms. display value for 250ms. You did not provide info on how the input is provided -- an additional state or states might be useful there.

The names of the states could also be changed. They were chosen to be very informative so I wouldn't need to write any code.

Once finished, post the code and we can explain practical issues with each decision.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top