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

BASCOM-AVR Old versions : Timer : REPLY

$
0
0
some problem in the following code $regfile = "m32def.dat" $crystal = 8000000 '14.745600 $hwstack = 40 $swstack = 40 $framesize = 40 Set Mcucsr.7 'JTAG disable Set Mcucsr.7 Ddrd = &B00011110 ' cnfig pins as IN (0) OUT (1) Portd = 0 Dim Flag As Byte , My_value As Long ,Count As Long Config Timer1 = Timer , Prescale = 1024 ' setup timer1 prescaler value Timer1 = 1200 'setup timer1 valur for you XXX Us tick On Ovf1 Timer1_isr Enable Timer1 Start Timer1 Enable Interrupts Portd = 0 My_value = 300 'times xxxUs you like Do If Flag = 1 Then 'TIMER1 Have result from My_value (we do this) Flag = 0 Toggle Portd.4 ' test make PortD.1 blink every 1 sec (timer1 = 51136) End If Loop If Portc.1 = 1 Then Incr My_value End If If Portc.2 = 1 Then Decr My_value ' ADD the UP DOWN for buttons and make it Incr/Decr My_value for how many 100Us you like End Timer1_isr: Timer1 = 1200 'setup timer1 valur for you XXX Us tick Incr Count ' count UP xxxx Us from timer1 value If Count => My_value Then 'My_value is how many times xxxx Us you like' Flag = 1 Count = 0 End If Return

Viewing all articles
Browse latest Browse all 20639

Trending Articles



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