Quantcast
Viewing all articles
Browse latest Browse all 20577

BASCOM-AVR : Atmega8 and external oscilator : REPLY

MWS and Arera thanks for replay. As you find out, I'm programing just for hoby. Temperature read, analog inputs, turn on/off outputs is not so difficult. Timers are more complicated and obviously I will have to read more specifically datasheets and examples. And this is my code for simple clock and if I compare it to stopwatch on my phone is a little bit faster. Any comments expected. [quote:10fc206a1b] $regfile = "m8def.dat " $crystal = 11059200 $swstack = 8 ' default use 10 for the SW stack $framesize = 20 '40 Dim Hour As Byte , Minute As Byte , Secu As Byte , Stot As Integer Config Lcd = 16 * 2 Config Lcdpin = Pin , Db4 = Portb.2 , Db5 = Portb.3 , Db6 = Portb.4 , Db7 = Portb.5 , E = Portb.1 , Rs = Portb.0 const Timer0Reload = 108 config timer0=timer,prescale = 1024 load timer0 , Timer0Reload on ovf0 Timer0_isr enable ovf0 start timer0 enable interrupts 'Add your code here Cursor Off Noblink Cls Hour = 0 Minute = 0 Secu = 0 Stot = 0 Do Locate 1 , 2 : Lcd Hour ; ":" ; Minute ; ":" ; Secu ; ":" ; Stot ; " " If Stot >= 99 Then Stot = 0 Incr Secu End If If Secu = 60 Then Secu = 0 Incr Minute End If If Minute = 60 Then Minute = 0 Incr Hour End If If Hour = 24 Then Hour = 0 End If Loop Timer0_isr: Load Timer0 , Timer0reload 'Add your ISR code here Incr Stot Return End 'end program [/quote:10fc206a1b]

Viewing all articles
Browse latest Browse all 20577

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>