Вы здесь

Model Railroad Speedometer

To display information will be used LCD 16x2
it's controlled by two buttons "units/mode" and "scale/options"
The speedometer has two operation modes, "Speedometer" and "Timer"
Originally it was planned to make only a speedometer, but colleagues were asked to add a circular timer mode. "Timer" mode is implemented in software and no changes require in hardware, so it added.
Switching between modes is done by hold on "units/mode" button for more than 1.5 seconds.
Once the mode is set to "Speedometer". If there are no errors on the screen shows the selected speed, scale, units and inscription "READY" 

A short press on the "units/mode" button switches the speed unit between MPH/KPH 
A short press on the "scale/options" button round-robin switch scale between HO/TT/ N (1:87/1:120/1:160)
The selected values ​​are saved in EEPROM. At startup automatically set last selected options before turning off.
When locomotive intersect the first sensor, in the bottom line shows ticker indicating the direction of movement of the locomotive

When locomotive intersect the second sensor, on LCD for 5 seconds displays the measurement result and the inscription "RESULT"

After that, the value is reset to zero and displays the start screen "READY"
If after response of the first sensor has passed a certain time and not response of the second sensor on the screen for 5 seconds appears the inscription "TIME OUT".

After that, the speedometer goes to the start screen "READY"
If there is a failure or abnormal operation, for example at the same time receives a signal from both sensors and the speed measurement is not performed (speedometer was turned on when the locomotive was behind him and blocked both sensors), the screen displays the inscription "ERROR". 

The new check produced every second, and if the cause of abnormal operation has been eliminated, the speedometer goes to working mode to the "READY" screen.
In the start "Timer" mode ("units/mode" button push on for 1.5 seconds) in the screen appears with three timers and inscription "START" .

To start the timer, press quickly the "scale/options" button. At this time instead of "START" inscription will appears inscription "WAIT", meaning that the timer waits for the first sensor response.

Upon receipt of this signal starts the countdown to the timer in the right column.
Timers in the left column are filled as the sensor response.
In the upper left corner is displayed the last lap time in the lower left - the penultimate lap.
In the upper right corner displays the current lap time and in the lower right corner the counting time from start (the first sensor response). 
Pushing on the "scale/options" button, the timer is stopped.

Next click on the "scale/options" button leads to resetting timers and display "START" screen.
When any time press "units/mode" button, the display will switch the second screen of timer.

It displays the total number of passed laps and average lap times. When button "units/mode" pressed again, will display a screen with timers. 
The timer at the time of display "LAPS/AVG" screen does not stop when you return to the screen timers, data will be relevant. To avoid accidental shutdown or reset the timers, during the "LAPS/AVG" displayed, clicking on the "scale/options" button is ignored. 
To enter the "Speedometer" mode, at any time you can hold on "units/mode" button more than 1.5 seconds.

© 2009-2104 CTPAHHuK.RU