![]() ![]() ![]() With this statement, we have set all of the necessary registers in the AVR to allow Timer2 to work in asynchronous mode. For our use, the statement will look as follows: Config Clock = Soft This statement is thoroughly described in the Bascom-AVR Help. The main part of that short program is this statement: CONFIG CLOCK = soft /USER Mark Alberts, has already written a basic sample program Megaclock.bas that can be found in the Program Files/MCS/Bascom-AVR/Samples folder. That would make this microcontroller ideal for a low-power clock. ![]() Possibly you might use an ATmega168P, which, according to its datasheet, promises very low energy consumption during sleep mode. It should perform well in your device too, providing that you connect it up accordingly. This program will perform well on both the MegaPin and MiniPin II development boards. The sample code described here, is very practical, uses very little of the microcontroller’s resources and to top it off, generates an accurate clock. Programmers seem to love generating 1 second pulse with a timer interrupt service routine which increments the values of variables for second/hour/day etc. None of those programmers used the RTC clock that is described in this chapter. I’ve met many Bascom programmers and seen many programs, where a real time clock was used. With some help from simple Bascom code, one can make an accurate clock which will display date and time.īascom-AVR offers many “goodies”, one of which is certainly the RTC clock. These AVRs are the ATmega8, ATmega168 and ATmega16 etc. Some AVR microcontrollers have Timer2 which can operate in asynchronous mode. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |