1.Buatlah tampilan VB6.0 seperti pada gabar dibawah ini:
source code VB:
Dim data 'General Declaration
Private Sub kirim()Dat$ = data
DatTX$ = Dat$ + Chr$(13)
MSComm1.Output = DatTX$
End Sub
Private Sub Command1_Click()
data = 1
kirim
Text1.Text = ""
End Sub
Private Sub Command2_Click()
data = 0
kirim
Text1.Text = ""
End Sub
Private Sub Form_Load()
MSComm1.CommPort = 1 '(port PC comm1,tapi tergantung PC anda)
MSComm1.Settings = "9600,N,8,1" '(harus sama PC dan AVR)
MSComm1.PortOpen = True
End Sub
Private Sub MSComm1_oncom()
Dim masukan As String
masukan = MSComm1.Input
If masukan <> "" Then
With Text1
.SelStart = Len(.Text)
.SelText = masukan
End With
Text2.Text = Mid(Text1, 4, 8)
End If
End Sub
Private Sub Timer1_Timer()
MSComm1_oncom
End Sub
SOURCE CODE BASCOM AVR untuk avr 8535:
$crystal = 11059200
$baud = 9600
Dim Data1 As Byte
Declare Sub Nyala()
Declare Sub Mati()
Config Portc.0 = Output
Do
Input Data1
Select Case Data1
Case 1 : Call Nyala()
Case 0 : Call Mati()
End Select
Loop
End
Sub Nyala()
Portc.0 = 1
Print "relay on"
End Sub
Sub Mati()
Portc.0 = 0
Print "relay off"
End Sub
untuk pertanyaan silahkan kirim email ke mhdyasseen@yahoo.com