Va, basice parasytas daznomatis. Aiskiai matosi skaiciavimo pricipas: du counteriai- vienas sukasi 1s, kitas nuo isorinio signalo. O toliau paprasta matematika. ' ATTiny 2313 ' ' Frequency Counter ' ' $regfile = "ATtiny2313.dat" $crystal = 20000000 '20MHz clock Config Pind.4 = Output 'LED Pin 'Config LCD Config Lcdpin = Pin , Db4 = Portb.2 , Db5 = Portb.1 , Db6 = Portb.0 , Db7 = Portd.6 , E = Portb.3 , Rs = Portb.4 Config Lcd = 16 * 2 Config Lcdbus = 4 Config Lcdmode = Port 'Config Timers Config Timer0 = Timer , Prescale = 1024 'Loop Timer Config Timer1 = Counter , Edge = Rising 'Frequency Counter 'Config Variables Dim Temp As Long Dim Ovf0 As Long Dim Ovf1 As Long Dim Freq As Long Dim Freq1 As String * 7 Dim Freq2 As String * 3 Dim Freq3 As String * 4 Dim Position As Byte 'Config Interrupts Enable Interrupts Enable Timer0 'Timer interrupt On Timer0 Incr_ovf0 'Overflow Routine Enable Timer1 'Counter interrrupt On Timer1 Incr_ovfl 'Overflow routine 'Main Cls Upperline 'Clear LCD Display Lcd " nuxieshop.com" Lowerline Lcd " Fun Count" Cursor Off Wait 2 'Loop Do Portd.4 = 0 'LED On Timer0 = 0 'Reset counts Counter1 = 0 Ovf0 = 0 'Reset overflows Ovf1 = 0 While Ovf0 <= 75 'One second loop @ 20 MHz nop Wend Waitus 3900 Portd.4 = 1 'LED Off Disable Timer0 'Stop Timers Disable Timer1 Temp = Ovf1 * 65536 'Calc frequency Freq = Temp + Counter1 Cls 'Clear display Locate 1 , 1 Freq1 = Str(freq) Select Case Freq 'Choose Frequency Range Case Is >= 1000000 : Goto Mhz Case Is >= 100000 : Goto Khzxxx Case Is >= 10000 : Goto Khzxx Case Is > 1000 : Goto Khzx End Select '1-999 Hz Position = 7 - Len(freq1) Locate 1 , Position Lcd Freq ; " Hz" Goto Outputdisplay Mhz: Freq2 = Left(freq1 , 1) Freq3 = Mid(freq1 , 2 , 4) Lcd Freq2 ; "." ; Freq3 ; " MHz" Goto Outputdisplay Khzxxx: Freq2 = Left(freq1 , 3) Freq3 = Mid(freq1 , 4 , 2) Lcd Freq2 ; "." ; Freq3 ; " KHz" Goto Outputdisplay Khzxx: Freq2 = Left(freq1 , 2 ) Freq3 = Mid(freq1 , 3 , 3) Lcd Freq2 ; "." ; Freq3 ; " KHz" Goto Outputdisplay Khzx: Freq2 = Left(freq1 , 1 ) Freq3 = Mid(freq1 , 2 , 4) Lcd " " ; Freq2 ; "." ; Freq3 ; " KHz" Goto Outputdisplay Outputdisplay: Locate 2 , 1 'Setup LCD cursor Cursor Off 'Restart timers Enable Timer0 Enable Timer1 Loop 'Interrupt routines '***************************************** Incr_ovfl: Incr Ovf1 Return '***************************************** Incr_ovf0: Incr Ovf0 Return End -- Bye, Levas -- http://www.vabolis.lt - elektronika ir siaip "KaroliS" <1@1.com> wrote in message news:gmmmmm$p9n$1@trimpas.omnitel.net... > mazdaug ribose 1khz-100khz darau iki 1mhz nes turiu kvacini generatoriu su > kurio galiu pasitikrint kas gaunasi > "Levas" <bla@sss.com> wrote in message > news:gmmmhf$p48$1@trimpas.omnitel.net... >>o koki dazni tau reikia skaiciuoti? >> >> -- >> Bye, Levas >> -- >> http://www.vabolis.lt - elektronika ir siaip >> "KaroliS" <1@1.com> wrote in message >> news:gmm7ua$agu$1@trimpas.omnitel.net... >>> jauciu kad sitas algoritmas FAIL, reiks ant popierio pasipaisyt >>> "KaroliS" <1@1.com> wrote in message >>> news:gml0fv$lsh$1@trimpas.omnitel.net... >>>> nu va padariau daznio matavima kiek kitaip nei pradzioj planavau nzn ar >>>> geras sprendimas bet algoritmas gavosi toks: >>>> counter0start >>>> __delay_cycles //~1sec >>>> counter0stop >>>> daznis=(counter0_overflow*256)+counter0 >>>> >>>> pazaidus su delay_cycles atrodo kad gavosi pakankamai tikslus matavimas, >>>> reiktu pabandyt su geru generatorium ir daznomaciu pereit per visa >>>> diapazona ir pazet kokios paklaidos gaunasi >>>> >>>> >>>> >>>> "Levas" <bla@sss.com> wrote in message >>>> news:gmkq5u$gfm$1@trimpas.omnitel.net... >>>>> >>>>> "KaroliS" <1@1.com> wrote in message >>>>> news:gmkpe5$fkp$1@trimpas.omnitel.net... >>>>>> radau klaida, >>>>>> neteisingai nurodytas interrupt vector adresas >>>>>> >>>>> >>>>> Pats kaltas, kad rankutemis ivedineji tuos adresus. Tam skirti >>>>> standartiniai include. >>>>> >>>> >>>> >>> >>> > >