Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20613

BASCOM-AVR : Using ICP1 pin : NEWTOPIC

$
0
0
Why after one change on ICP1 pin timer stops counting? [code:1:48a35e8a8e] '$sim $regfile = "m128def.dat" $crystal = 8000000 '$baud = 9600 $hwstack = 50 $swstack = 50 $framesize = 70 $lib "glcdKS108.lbx" Config Portb = Input 'Ddrc = &B0000_0000 Portb = &B1111_1111 'Set Portc Config Graphlcd = 128 * 64sed , Dataport = Porta , Controlport = Porte , Ce = 2 , Ce2 = 3 , Cd = 4 , Rd = 5 , Reset = 7 , Enable = 6 Config Timer1 = Timer , Prescale = 8 , Capture Edge = Falling , Noise Cancel = 1 On Capture1 Isr _cap1 On Ovf1 Isr_ovf1 Enable Capture1 Enable Ovf1 Enable Interrupts Dim Clks_per_min As Long , Overflow As Long , Clks_cntd As Long , Rpm As Long Dim T1overflow_ctr As Byte , T1capture As Word , Oldcount As Word , A As Byte T1overflow_ctr = 0 Setfont Font8x8 Cls Clks_per_min = 8000000 / 8 Clks_per_min = Clks_per_min * 60 Clks_cntd = 1 Lcdat 1 , 7 , "Speed" Do If T1capture <> Oldcount Then Oldcount = T1capture Clks_cntd = Oldcount Lcdat 3 , 5 , "Ove:" Lcd Overflow ; " " Overflow = Overflow * 65536 Lcdat 4 , 5 , "Imp:" Lcd Clks_cntd ; " " Clks_cntd = Clks_cntd + Overflow Lcdat 5 , 5 , "Uim:" Lcd Clks_cntd ; " " Rpm = Clks_per_min / Clks_cntd Lcdat 6 , 5 , "RPM:" Lcd Rpm ; " " End If Lcdat 7 , 5 , "count:" Lcd T1overflow_ctr ; " " 'Incr A ' A = Tccr1b ' Lcdat 8 , 5 , A ' A = Tccr1a ' Lcd " " ; A ; " " Loop End $include "font8x8.font" Isr_cap1: T1capture = Icr1 'Capture1 Timer1 = 0 ' Tifr1.5 = 0 Overflow = T1overflow_ctr T1overflow_ctr = 0 Return Isr_ovf1: Incr T1overflow_ctr Return [/code:1:48a35e8a8e] [b:48a35e8a8e][color=red:48a35e8a8e](BASCOM-AVR version : 2.0.7.0 , Latest : 2.0.7.6 )[/b:48a35e8a8e][/color:48a35e8a8e]

Viewing all articles
Browse latest Browse all 20613

Trending Articles



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