Contoh Sederhana Pemrograman serial port vb6 |
kali kita akan membahas pemrograma serial yang pertama harus di siapkan adalah virtual serial port nya anda bisa download di sini http://www.eterlogic.com/downloads/SetupVSPE.zip
setelah download silahkan add device serial port nya , terserah mau com1 , com2 ,dst
Codingan pada form kirim serial sebagai berikut
Private Sub Command1_Click()
MSComm1.Output = Text1.Text
End Sub
Private Sub Form_Load()
MSComm1.CommPort = 3 'tergantung COM port yang tersedia
MSComm1.Settings = "9600,N,8,1" 'contoh setting serial port
MSComm1.InputLen = 0
MSComm1.RThreshold = 1
MSComm1.PortOpen = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
MSComm1.PortOpen = False
End Sub
Private Sub MSComm1_OnComm()
Select Case MSComm1.CommEvent
' Errors
Case comEventRxParity ' Parity Error.
MsgBox "Parity"
' Events
Case comEvReceive ' Received RThreshold # of chars.
Text2.Text = MSComm1.Input
End Select
End Sub
Codingan pada form menerima serial sebagai berikut
Private Sub Form_Load()
MSComm1.CommPort = 3 'tergantung COM port yang tersedia
MSComm1.Settings = "9600,N,8,1" 'contoh setting serial port
MSComm1.InputLen = 0
MSComm1.RThreshold = 1
MSComm1.PortOpen = True
Form2.Show
End Sub
Private Sub Form_Unload(Cancel As Integer)
MSComm1.PortOpen = False
End Sub
Private Sub MSComm1_OnComm()
Select Case MSComm1.CommEvent
' Errors
Case comEventRxParity ' Parity Error.
MsgBox "Parity"
' Events
Case comEvReceive ' Received RThreshold # of chars.
Text1.Text = MSComm1.Input
End Select
End Sub
sekian
anda bisa mendownload prjoect nya disini :
http://www.4shared.com/rar/7GNC_IwKce/serial_port_upload.html
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :