Programming Reaction Timer Report
Programming Reaction Timer Report
Reaction timer is embedded system that works by measuring the user reaction to signal and
display LEDS in the time interval. This program uses the following function
/*
* Interrupt processing... (Note 1000interrupts = 1 second from previous defined function)
*/
if (++hertz == 1000) /* Increases the interrupt (hertz) count and sets the thousandth interrupt
back to 0 */
{
hertz = 0;
if (++seconds == 10) /* Increases the second count and sets the tenth second back
to 0 */
seconds = 0;
}
}
2. Initialization and program start
This is entry point of the program; it works by assigning of an initial value for the data object 7
segments Display before making call flash –lead () function
int main()
{
Configure7SegmentDisplay (); /* Initializes the 7 Segment Display */
return 0;
}
3. LEDs reset and blinking of LED1
The program function helps to display the last recorder timer values on the 7 Segment
Display (shows 0.000 the first time it runs)
void flash_LED( ){
/* Displays the last recorded timer values on the 7 Segment Display (shows 0.000 the
first time it runs) */
Set7SegmentDisplayValue(M_SECONDS, Digit[m_seconds]);
Set7SegmentDisplayValue(H_SECONDS, Digit[h_seconds]);
Set7SegmentDisplayValue(T_SECONDS, Digit[t_seconds]);
Set7SegmentDisplayValue(SECONDS, secDigit[seconds]);
/* Prevents auto-initialization when the random green LED in reaction () was LED1 */
delay_ms(250);