Code:
$regfile "M48def.dat"
$crystal = 1000000
$hwstack = 100
$swstack = 100
$framesize = 100
$baud = 2400
Dim Endtime As Long
Dim Countperoverflow As Integer
Dim Struser As String * 10
Dim Countperiodes As Byte
Dim Timerstand As Byte
Config Timer0 = Timer , Prescale = 1
On Timer0 Isrtimer
Enable Timer0
Stop Timer0
Config Int0 = Rising
Enable Int0
On Int0 Isr_interrupt
Config Portd.3 = Output
Portd.3 = 1
Do
Input Struser
If Struser = "" Then
'################# den Sendebrust generieren +++++++++
Countperiodes = 0
Do
Portd.3 = 0
Countperiodes = Countperiodes + 2
Portd.3 = 1
Countperiodes = Countperiodes - 1
Loop Until Countperiodes > 20
Countperiodes = 0
Portd.3 = 1
'######################################################
Enable Interrupts
Start Timer0
Timer0 = 0
Struser = "sd"
End If
Loop
'###############TimerIsR##################
Isrtimer:
Countperoverflow = Countperoverflow + 1
Return
'#########################################
'#########ACI isr################
Isr_interrupt:
Stop Timer0
Timerstand = Timer0
If Tifr0.tov0 = 1 Then
Endtime = Endtime + 256
Set Tifr0.tov0
End If
Endtime = Countperoverflow * 256
Endtime = Endtime + Timerstand
Disable Interrupts
Print Endtime
Timer0 = 0
Timerstand = 0
Endtime = 0
Countperoverflow = 0
Return#
Lesezeichen