Recently found in the archives program of the speedometer on the microcontroller. The program is written in CodeVisionAVR. Reviewing it recently, found some things I want to change so am going to redo it and to write now in WinAVR. Yes, even in hardware this device has not yet been tested, so if anything can be detected some glitches (see update below). If anyone will try this device in hardware, please write about the results. Screen a speedo I have looks like this
If desired, the appearance can slightly change. The scheme is quite simple
Binding power not shown.
To debug the model as the sensor signals used generator, which was applied pulses to the inputs of MK INT1 and ICP1. С частотой генератора можно поэкспериментировать, у меня было примерно 1-10Гц. Частота МК от внутреннего RC – 2МГц.
How it works:
- The sensor may be a reed switch or any other device that produces a pulse upon the occurrence of events of interest. For example, the magnet on the wheel passes the sensor.
- Спидометр нужно откалибровать. Для этого заходим в меню и выбираем дистанцию на которой мы хотим провести калибровку – 1000 или 100м (сразу говорю – ручной не работает). В данном случае будет работать вход INT1. By counting the number of pulses on 100m or 1000m, we define the length of the wheel (calibration factor), which can be further used to calculate speed and distance. This ratio is saved in EEPROM, so the next time you start to calibrate again is not necessary.
- To measure the speed signal is fed to the input of the microcontroller ICP1 by which we measure the time between two pulses, i.e. the time for which we will pass our calibration factor:). Now we can calculate the speed and display it on the screen.
- Settings. This speedometer has various settings for the display of information:
- Speed can be displayed in m/s or km / h. Точность в м/с – 0.1m/s. Точность в км/ч – 0.1km/h. A minimum rate of not know what. The only thing I can say, if the wheel makes one revolution for two seconds, then the instrument will show zero speed.
- Distance there are shared, there is a point. Appears in km. Можем отображать на экране только одну из этих дистанций или и ту, и другую вместе. Точность – 10m.
- The total distance is stored in EEPROM. Reset if nezdice 40000км.
- Reset the total distance from a given point. When resetting the total distance the device requires the confirmation to delete by mistake.
- Stop watch. В приборе есть секундомер, который также мы можем отображать или нет. Запускается секундомер кнопкой Right, останавливается кнопкой Left, продолжение счета – Right, сброс – повторное нажатие Left.
- All settings are saved after shutdown.
Вот наверное и все, что нужно чтобы испытать устройство. В конце статьи приведена схема в Proteus’e, файл с программой и hex файл. Посмотрите, поклацайте менюшку, установите нужные настройки. В примере прибор откалиброван чисто условно.
I want to make a watch, and this will connect any real-time clock. In the future I'll periodically to this program is to return it in detail to disassemble and to write the program now in WinAVR.