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

BASCOM-AVR : Newbie Help please : NEWTOPIC

$
0
0
Please help, Im a newbie I have purchased a Microcontroller Tutorial kit, and I am working through the manual. I have reached page 97 , and have tried Frequency counter.bas I get a readout of 0Hz instead of 3 Mhz It is not clear, but seems to indicate that the clock signal comes in through Config Pind4 (counter input TO) I presume this is generating a pulse but dont see how. if i remove the cnt = 0 then the freq displayed goes up , but I asume thats because its adding &HFF each time . is this somthing im doing or is my Hardware faulty? many thanks scuba compiler 2.0.7.1 demo is what comes with the kit. 'Bascom 3-MHz frequency counter $regfile = "m88def.dat" $crystal = 8000000 Dim Cnt As Long Dim Result As Long Config Timer0 = Counter , Edge = Falling Config Timer1 = Timer , Prescale = 64 'counter input T0 Config Pind.5 = Input On Timer0 Cnt_sub On Timer1 Timer_irq Enable Timer0 Enable Timer1 Enable Interrupts Load Timer1 , 62750 Do Print Result ; " Hz" Wait 1 Loop Cnt_sub: Incr Cnt Return Timer_irq: Load Timer1 , 62750 Cnt = Cnt * &HFF Cnt = Timer0 + Cnt Result = Cnt Timer0 = 0 Cnt = 0 Return End [b:4c6178e567][color=red:4c6178e567](BASCOM-AVR version : 2.0.7.1 , Latest : 2.0.7.6 )[/b:4c6178e567][/color:4c6178e567]

Viewing all articles
Browse latest Browse all 20563

Trending Articles



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