Saya coba membuat interupt0 dan interupt 1 dari timer1.
tapi gak mau. pengenya. pas interupt0 aktif timer aktif pas interupt1 aktif data count timer1 kita masukkan ke variabel trus disimpan dan dimasukkan ke rumus. timer1pun ikut non aktif. ada yang bisa bantuin. setelah saya otal atik tetap gak mau tambah error programnya.
$regfile = "m16def.dat"
$crystal = 4000000
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portc.2 , Db5 = Portc.3 , Db6 = Portc.4 , Db7 = Portc.5 , E = Portc.1 , Rs = Portc.0
Config Portd = &B1111111
Saklar0 Alias Portd.2
Saklar1 Alias Portd.3
Const Jarak = 100
Declare Function Ticktock(byval Xx As Byte) As Byte
Dim Ttc As Word
Dim A As Byte , B1 As Byte , C As String * 16
Dim Aa As Byte , Bb As Byte
Dim Cc As Byte , Dd As Byte
Dim Ee As Byte , Ff As Byte , Gg As Byte
Dim Hh As Byte , Ii As Byte , Jj As Byte
Dim Kk As Byte , Ll As Byte , Mm As Byte
C = "Design By ikhwan"
Startup:
'Power Up Delay to stabilize the system (optional).
Waitms 250
'Set up Timer0, 8 Bit, with F = 8 MHz, PS = 64, 490.196 Intr / Sec
Config Timer0 = Timer , Prescale = 64
On Timer0 = Ticktock() 'Run ISR
Enable Interrupts
Enable Timer0
Enable Int0
Enable Int1
On Int1
On Int0
Do
If Saklar0 = 1 Then
Kk = Ticktock(3)
Ll = Ticktock(1)
Mm = Ticktock(2)
Aa = Hh
Bb = Jj
Lcd " "
Locate 2 , 1
Lcd Ii ; " : " ; Hh ; " : " ; Jj ; " ";
Locate 1 , 1
Lcd C
Cursor Off
End If
If Saklar1 = 1 Then
Aa = Ticktock(3)
Jj = Ttc
Bb = Ticktock(2)
Ii = B1
Ee = Hh - Aa
Ee = Ee * 60
Ff = Jj - Bb
Gg = Ee + Ff
Gg = Jarak / Gg
Cls
Locate 1 , 1
Lcd "Kecepatan =" ; Gg;
Locate 2 , 1
Lcd B1 ; " : " ; A ; " : " ; Ttc;
Cursor Off
End If
Loop
End
Jam:
Ttc = 0
A = 0
B1 = 0
Goto Ticktock
Return
Function Ticktock(byval Xx As Byte) As Byte
Ttc = Ttc + 1 'Increment TickTock Counter
If Ttc = 60 Then
A = A + 1
Ttc = 0
End If
If A = 60 Then
B1 = B1 + 1
A = 0
End If
If B1 > 24 Then
Goto Jam
End If
If Xx = 1 Then
Hh = A
Elseif Xx = 2 Then
Ii = B1
Elseif Xx = 3 Then
Jj = Ttc
End If
End Function
mohon bantuanya. alamat email saya:
[email protected]
maaf bro gak bisa basic. pakainya C.
sudah bisa.. mas.. makasih..
bingung ane sm bahasa basic ampun dah
trus fungsi interuptnya mana?? kok ga ada diatas??
atau emang gtu yah??
k'lo sy perhatikan program diatas itu seperti hanya mengecek logic yang ada pada pord.2 dan portd.3
k'lo udah bener, yg salahnya dimana?
coba share