The Stopwatch Project

Thread Starter

jey11

Joined Jun 7, 2010
21
I need some assistance on the following project and coding should be in C.

We have six seven-segment displays, so we will organize them as: MM:SS:HH. That is to say, the leftmost two digits display the number of minutes counted, the middle two digits display the number of seconds counted and the rightmost two digits display the count in hundredths of a second. The seven segment displays have decimal points, but unfortunately the decimal points have not been wired to the Cyclone V, so we’ll have to imagine it.


The DE-10 has four push-button switches. They are debounced in hardware, so even in hardware you don’t have to worry about debouncing them. (In simulation, of course you don’t.) They are mapped into the ARM’s memory at address 0xFF200050 (called KEY_BASE in address_map_arm.h) For the purposes of this lab, we will identify them as follows: Switch Bit Position Function PB1 Bit 0 Start PB2 Bit 1 Stop PB3 Bit 2 Lap PB4 Bit 3 Clear The operation of a stopwatch is as follows: • Clear returns the stopwatch to its default status.

The clock time, the lap time and the output should all clear to 00:00.00 • Start starts the timer counting up. • Stop stops the timer counting but does not reset it. The clock can be restarted and will pick up from the same point. • Lap captures the time currently stored. The lap time DOES NOT appear on the display unless selected (see below). Only one lap time can be stored. A second click on Lap overwrites the previous time. The stopwatch also has one mode switch. Bit 0 of the slide switch bank (our old friend from Lab 1) toggles between displaying the current time OR the lap time. Useful Information For the purposes of this lab, we will use the Interval Timer. There are two Interval Timers on the board. The first Interval Timer is mapped into the ARM’s memory space at TIMER_BASE, while the second one is mapped at TIMER_2_BASE.

The simulator implements both of them. The timer has the following register map: Address Register Function
TIMER_BASE+0 Status
TIMER_BASE+1 Control
TIMER_BASE+2 Load Value
Low TIMER_BASE+3
Load Value High The function of the timer is documented in the user manual DE10-Standard_Computer_ARM (available at OWL) on page 12 (Interval Timers). The timer runs at 100MHz. For the purposes of creating the stopwatch, you will probably want to program it to count 0.01 second intervals. Note that since we are stuck in the simulator, the actual performance of the timer element could be unpredictable and slower than real time, although on my computer I get very close to accurate resul
 
Top