Dim Count_units As Byte , Times As Byte , Flag As Bit
Dim W As Word
Times = 5
Const Timer1reload = 7 '1 ms
Config Timer1 = Timer , Prescale = 1024
'Load Timer1 , Timer1reload
Timer1 = 65536 - Timer1reload
On Ovf1 Timer1_isr
Enable Timer1
Stop Timer1
Enable Interrupts
Start Timer1
'
'
Do
If Flag = 1 Then
Print " end of Timer1 "
End If
W = Timer1
Loop
Timer1_isr:
Incr Count_units
Print " Hello Timer1"
Timer1 = 65536 - Timer1reload
'Load Timer1 , Timer1reload
Start Timer1
'
If Count_units >= Times Then
Stop Timer1
Count_units = 0
Flag = 1
End If
Return
I have problems with the 16 Bit Timers on the Atmega640
On the Simulator
The Timer1 works
The 8 bit Timer2 works with max 64 prescaler
and the Timer3, Timer4 and Timer5 donīt work
I have found this code from you but that donīt work too on the Bascom Simulator.
Have you a explanation why this happens?
$regfile = "m1281def.dat" 'register file for MEGA128-16
$crystal = 16000000 '16MHz crystal
$baud = 9600
$baud1 = 9600
$hwstack = 80 '64 ' default use 32 for the hardware stack
$swstack = 80 ' default use 10 for the SW stack
$framesize = 80 ' default use 40 for the frame space
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum