boutrate 9600 stopbit 1, data bit 8, parity none, flow control none MOV

advertisement
LAMPIRAN 1
PROGRAM DI MIKROKONTROLER
MOV TMOD,#20H ; boutrate 9600 stopbit 1, data bit 8, parity none, flow control
none
MOV SCON,#50H
MOV TH1,#-3
SETB TR1
kec_angin:
mov 68h,#0
mov r7,#35
loop1:
mov r6,#255
loop2:
mov r5,#255
loop3:
jb p3.7,lanjut
jnb p3.7,anti_error
lanjut:
djnz r5,loop3
djnz r6,loop2
djnz r7,loop1
sjmp hitung
anti_error:
mov r4,#255
loop_AE:
jnb p3.7,kurangi
inc 68h
sjmp lanjut
kurangi:
mov r3,#100
djnz r3,$
djnz r4,loop_AE
sjmp kec_angin
hitung:
mov a,68h
mov b,#100
div ab
mov 72h,a
mov a,b
mov b,#10
div ab
mov 71h,a
Universitas Sumatera Utara
mov 70h,b
mov r0,70h
acall konversi
mov 73h,r1
;73h nilai satuan des
mov r0,71h
acall konversi
mov 74h,r1
;74h nilai puluhan des
mov r0,72h
acall konversi
mov 75h,r1
;75h nilai ratusan des
kirim:
acall kirim_disp1
acall tunda
acall arah_angin
ljmp kec_angin
arah_angin:
mov a,p1
mov b,#100
div ab
mov 72h,a
mov a,b
mov b,#10
div ab
mov 71h,a
mov 70h,b
mov r0,70h
acall konversi
mov 73h,r1
;73h nilai satuan des
mov r0,71h
acall konversi
mov 74h,r1
;74h nilai puluhan des
mov r0,72h
acall konversi
mov 75h,r1
;75h nilai ratusan des
acall kirim_disp2
acall tunda
ret
konversi:
cjne r0,#0,satu
mov r1,#'0'
ret
satu:
cjne r0,#1,dua
mov r1,#'1'
ret
dua:
cjne r0,#2,tiga
Universitas Sumatera Utara
mov r1,#'2'
ret
tiga:
cjne r0,#3,empat
mov r1,#'3'
ret
empat:
cjne r0,#4,lima
mov r1,#'4'
ret
lima:
cjne r0,#5,enam
mov r1,#'5'
ret
enam:
cjne r0,#6,tujuh
mov r1,#'6'
ret
tujuh:
cjne r0,#7,delapan
mov r1,#'7'
ret
delapan:
cjne r0,#8,sembilan
mov r1,#'8'
ret
sembilan:
cjne r0,#9,konversi
mov r1,#'9'
ret
kirim_disp1:
mov sbuf,#'K'
jnb ti,$
clr ti
mov sbuf,75h
jnb ti,$
clr ti
mov sbuf,74h
jnb ti,$
clr ti
mov sbuf,73h
jnb ti,$
clr ti
acall tunda
ret
kirim_disp2:
mov sbuf,#'A'
Universitas Sumatera Utara
jnb ti,$
clr ti
mov sbuf,75h
jnb ti,$
clr ti
mov sbuf,74h
jnb ti,$
clr ti
mov sbuf,73h
jnb ti,$
clr ti
acall tunda
ret
tunda:
mov r7,#255
tnd:
mov r6,#255
djnz r6,$
djnz r7,tnd
ret
Universitas Sumatera Utara
LAMPIRAN 3
TAMPILAN DATA
Universitas Sumatera Utara
Universitas Sumatera Utara
LAMPIRAN 4
PROGRAM VISUAL BASIC 6.0
Private Sub cmd_clear_Click()
End Sub
Private Sub cmd_close_Click()
Unload Me
End Sub
Private Sub cmd_start_Click()
Timer2.Enabled = True
End Sub
Private Sub cmd_stop_Click()
Timer2.Enabled = False
End Sub
Private Sub Form_Load()
Frame1.BackColor = &HFFFFFF
Timer2.Enabled = False
Timer1.Enabled = True
MSComm1.PortOpen = True
MSComm1.DTREnable = True
MSComm1.RTSEnable = True
Adodc1.Refresh
utara.ForeColor = &H0&
timur_laut.ForeColor = &H0&
timur.ForeColor = &H0&
tenggara.ForeColor = &H0&
selatan.ForeColor = &H0&
barat_daya.ForeColor = &H0&
barat.ForeColor = &H0&
barat_laut.ForeColor = &H0&
End Sub
Private Sub Label1_Change()
If Label1.Caption <> "" Then
Label2.Caption = Label1.Caption
End If
End Sub
Private Sub Label2_Change()
Universitas Sumatera Utara
a = Left(Label2.Caption, 1)
If a = "A" Then
Label3.Caption = Right(Label2.Caption, 3)
n = Val(Label3.Caption) * 5.625
Label6 = n
If n = 0 Then
utara.ForeColor = &HFF&
timur_laut.ForeColor = &H0&
timur.ForeColor = &H0&
tenggara.ForeColor = &H0&
selatan.ForeColor = &H0&
barat_daya.ForeColor = &H0&
barat.ForeColor = &H0&
barat_laut.ForeColor = &H0&
End If
If (n > 0) And (n < 45) Then
utara.ForeColor = &HFF&
timur_laut.ForeColor = &HFF&
timur.ForeColor = &H0&
tenggara.ForeColor = &H0&
selatan.ForeColor = &H0&
barat_daya.ForeColor = &H0&
barat.ForeColor = &H0&
barat_laut.ForeColor = &H0&
End If
If n = 45 Then
utara.ForeColor = &H0&
timur_laut.ForeColor = &HFF&
timur.ForeColor = &H0&
tenggara.ForeColor = &H0&
selatan.ForeColor = &H0&
barat_daya.ForeColor = &H0&
barat.ForeColor = &H0&
barat_laut.ForeColor = &H0&
End If
If (n > 45) And (n < 90) Then
utara.ForeColor = &H0&
timur_laut.ForeColor = &HFF&
timur.ForeColor = &HFF&
tenggara.ForeColor = &H0&
selatan.ForeColor = &H0&
barat_daya.ForeColor = &H0&
barat.ForeColor = &H0&
barat_laut.ForeColor = &H0&
End If
Universitas Sumatera Utara
If n = 90 Then
utara.ForeColor = &H0&
timur_laut.ForeColor = &O0&
timur.ForeColor = &HFF&
tenggara.ForeColor = &H0&
selatan.ForeColor = &H0&
barat_daya.ForeColor = &H0&
barat.ForeColor = &H0&
barat_laut.ForeColor = &H0&
End If
If (n > 90) And (n < 135) Then
utara.ForeColor = &H0&
timur_laut.ForeColor = &H0&
timur.ForeColor = &HFF&
tenggara.ForeColor = &HFF&
selatan.ForeColor = &H0&
barat_daya.ForeColor = &H0&
barat.ForeColor = &H0&
barat_laut.ForeColor = &H0&
End If
If n = 135 Then
utara.ForeColor = &H0&
timur_laut.ForeColor = &H0&
timur.ForeColor = &O0&
tenggara.ForeColor = &HFF&
selatan.ForeColor = &H0&
barat_daya.ForeColor = &H0&
barat.ForeColor = &H0&
barat_laut.ForeColor = &H0&
End If
If (n > 135) And (n < 180) Then
utara.ForeColor = &H0&
timur_laut.ForeColor = &H0&
timur.ForeColor = &H0&
tenggara.ForeColor = &HFF&
selatan.ForeColor = &HFF&
barat_daya.ForeColor = &H0&
barat.ForeColor = &H0&
barat_laut.ForeColor = &H0&
End If
If n = 180 Then
utara.ForeColor = &H0&
timur_laut.ForeColor = &H0&
timur.ForeColor = &H0&
tenggara.ForeColor = &O0&
Universitas Sumatera Utara
selatan.ForeColor = &HFF&
barat_daya.ForeColor = &H0&
barat.ForeColor = &H0&
barat_laut.ForeColor = &H0&
End If
If (n > 180) And (n < 225) Then
utara.ForeColor = &H0&
timur_laut.ForeColor = &H0&
timur.ForeColor = &H0&
tenggara.ForeColor = &H0&
selatan.ForeColor = &HFF&
barat_daya.ForeColor = &HFF&
barat.ForeColor = &H0&
barat_laut.ForeColor = &H0&
End If
If n = 225 Then
utara.ForeColor = &H0&
timur_laut.ForeColor = &H0&
timur.ForeColor = &H0&
tenggara.ForeColor = &H0&
selatan.ForeColor = &O0&
barat_daya.ForeColor = &HFF&
barat.ForeColor = &H0&
barat_laut.ForeColor = &H0&
End If
If (n > 225) And (n < 270) Then
utara.ForeColor = &H0&
timur_laut.ForeColor = &H0&
timur.ForeColor = &H0&
tenggara.ForeColor = &H0&
selatan.ForeColor = &H0&
barat_daya.ForeColor = &HFF&
barat.ForeColor = &HFF&
barat_laut.ForeColor = &H0&
End If
If n = 270 Then
utara.ForeColor = &H0&
timur_laut.ForeColor = &H0&
timur.ForeColor = &H0&
tenggara.ForeColor = &H0&
selatan.ForeColor = &H0&
barat_daya.ForeColor = &O0&
barat.ForeColor = &HFF&
barat_laut.ForeColor = &H0&
End If
Universitas Sumatera Utara
If (n > 270) And (n < 315) Then
utara.ForeColor = &H0&
timur_laut.ForeColor = &H0&
timur.ForeColor = &H0&
tenggara.ForeColor = &H0&
selatan.ForeColor = &H0&
barat_daya.ForeColor = &H0&
barat.ForeColor = &HFF&
barat_laut.ForeColor = &HFF&
End If
If n = 315 Then
utara.ForeColor = &H0&
timur_laut.ForeColor = &H0&
timur.ForeColor = &H0&
tenggara.ForeColor = &H0&
selatan.ForeColor = &H0&
barat_daya.ForeColor = &H0&
barat.ForeColor = &O0&
barat_laut.ForeColor = &HFF&
End If
If (n > 315) And (n < 360) Then
utara.ForeColor = &HFF&
timur_laut.ForeColor = &H0&
timur.ForeColor = &H0&
tenggara.ForeColor = &H0&
selatan.ForeColor = &H0&
barat_daya.ForeColor = &H0&
barat.ForeColor = &H0&
barat_laut.ForeColor = &HFF&
End If
End If
If a = "K" Then
Label4.Caption = Right(Label2.Caption, 3)
w = Val(Label4.Caption) / 80
v = w * 0.37 * 7.34
Label7 = v
End If
End Sub
Private Sub Timer2_Timer()
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("waktu").Value = Label5.Caption
Adodc1.Recordset.Fields("arah").Value = Label6.Caption
Adodc1.Recordset.Fields("kecepatan").Value = Label7.Caption
Adodc1.Recordset.Update
Universitas Sumatera Utara
Adodc1.Refresh
End Sub
Universitas Sumatera Utara
LAMPIRAN GAMBAR RANGKAIAN LENGKAP
Universitas Sumatera Utara
Download