'$sim
$regfile = "m8def.dat"
$crystal = 8000000
Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.1 , Rs = Portd.0
Config Lcd = 16 * 2
Cursor Off
Config Timer0 = Timer , Prescale = 1
Timer0 = 5
Enable Interrupts
Enable Timer0
On Timer0 Sarriz
Stop Timer0
Config Pind.2 = Input
Config Pind.3 = Output
Dim B As Long
Dim D As Single
Dim Z As String * 5
Main:
D = 0
B = 0
'Waitms 50
Stop Timer0
Timer0 = 5
'M:
Bitwait Pind.2 , Set 'Then Goto M
Start Timer0
'End If
'M2:
Bitwait Pind.2 , Reset 'Then Goto M2
Stop Timer0
'End If
Waitms 50
D = B * 3125
D = D / 100000
If B = 32000 Then
B = 0
End If
Cls
Home
Lcd "B= " ; B
Z = Fusing(d , "#.##")
waitms 50
Lowerline
Lcd "Ton=" ; Z ; " ms "
Goto Main
End 'end program
Sarriz:
'B = 319
Incr B
Return