Vous êtes sur la page 1sur 2

$regfile = "m8515.

dat"
$crystal = 8000000
$baud = 9200
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim

Count As Long
Slanje As String * 6
Slanjeled As Bit
Counti As Byte
Sred As Byte
Blokada As Bit
Blokadatim As Bit
Temp1 As Byte
Temp2 As Byte

Config
Config
Config
Config
Config
Set
Set
Set
Set

Pina.0
Pina.4
Pine.0
Pinc.6
Pinc.1

=
=
=
=
=

Output
Output
Output
Output
Input

Porta.0
Porta.4
Porte.0
Portc.6

Config Timer0 = Timer , Prescale = 64


Enable Timer0
Stop Timer0

Enable Interrupts
Enable Int0
On Int0 Prekid
On Ovf0 Pretrp
Count = 0
Counti = 0
Blokada = 0
Sred = 0
Blokadatim = 1
Slanjeled = 0
Tcnt0 = 0
Wait 1
Reset
Reset
Reset
Reset

Porta.0
Porta.4
Porte.0
Portc.6

Wait 1
Set
Set
Set
Set

Porta.0
Porta.4
Porte.0
Portc.6

Wait 1
Reset Porta.0
Reset Portc.6
Do
If Slanjeled = 1 Then
If Counti >= 50 Then
Set Porta.0.4
Slanjeled = 0
End If
End If
If Pinc.1 = 1 Then
Waitus 500
If Pinc.1 = 1 Then
Blokada = 0
Set Porte.0
End If
End If
Loop

End

Prekid:
If Pinc.1 = 0 Then
If Blokada = 0 Then
If Blokadatim = 1 Then
Start Timer0
Blokadatim = 0
End If
If Sred = 10 Then
Temp1 = Tcnt0
Tcnt0 = 0
Temp2 = Counti
Counti = 0
Count = Temp2 * 256
Count = Count + Temp1
Slanje = Str(count)
Slanje = Format(slanje , "00000")
Print Slanje
Sred = 0
Reset Porta.4
Slanjeled = 1
Else
Sred = Sred + 1
End If
Blokada = 1
End If
Reset Porte.0
Set Portc.6
End If
Return
Pretrp:
Incr Counti
If Counti = 252 Then
Stop Timer0
Reset Portc.6
Blokadatim = 1
Print "00000"
Counti = 0
Count = 0
Sred = 0
Tcnt0 = 0
End If
Return

Vous aimerez peut-être aussi