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

BASCOM-AVR : call sub in interrupt : NEWTOPIC

$
0
0
$regfile = "xm256A3def.dat" $crystal = 32000000 $hwstack = 1024 $swstack = 1024 $framesize = 1024 Const Pda_pcb_ver = 2 Config Submode = New 'first enable the osc of your choice Config Osc = Enabled , Pllosc = Disabled , Extosc = Disabled , 32khzosc = Disabled , 32mhzosc = Enabled '32MHz 'configure the systemclock Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1 '32MHz Declare Sub Func_1(byval Byte_ctr As Word , Byval Byte_ctr1 As Word , Byval Byte_ctr2 As Word , Byval Byte_ctr3 As Word) Declare Sub Func_2(byval Byte_ctr As Word , Byval Byte_ctr1 As Word , Byval Byte_ctr2 As Word , Byval Byte_ctr3 As Word) Declare Sub Pilik() 'INIT 'Buzz init #if Pda_pcb_ver = 2 Buzz Alias Portc.1 Config Buzz = Output Const Buzz_on = 1 Const Buzz_off = 0 Buzz = Buzz_off #endif 'End Buzz init 'TC Config Tcf0 = Normal , Prescale = 64 Tcf0_per = 1000 ' 500Hz On Tcf0_ovf Tcf0_isr Enable Tcf0_ovf , Lo 'Enable this Interrupt as Lo Level Interrupt 'End TC '=============MAIN============== Config Priority = Roundrobin , Vector = Application , Lo = Enabled 'Enable Lo Level Interrupts Enable Interrupts Call Pilik() Call Pilik() Do Call Func_1(1 , 2 , 3 , 4 ) Waitus 500 Loop Tcf0_isr: Call Func_2(1 , 2 , 3 , 4 ) Return Sub Func_1(byval Byte_ctr As Word , Byval Byte_ctr1 As Word , Byval Byte_ctr2 As Word , Byval Byte_ctr3 As Word) If Byte_ctr <> 1 Then Call Pilik() End If If Byte_ctr1 <> 2 Then Call Pilik() End If If Byte_ctr2 <> 3 Then Call Pilik() End If If Byte_ctr3 <> 4 Then Call Pilik() End If End Sub Sub Func_2(byval Byte_ctr As Word , Byval Byte_ctr1 As Word , Byval Byte_ctr2 As Word , Byval Byte_ctr3 As Word) nop End Sub Sub Pilik() Sound Buzz , 90 , 1000 Sound Buzz , 90 , 500 Sound Buzz , 90 , 700 End Sub Some time hear "pilik" [b:ca7bc1a3af][color=red:ca7bc1a3af](BASCOM-AVR version : 2.0.7.6 )[/b:ca7bc1a3af][/color:ca7bc1a3af]

Viewing all articles
Browse latest Browse all 20688

Trending Articles



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