Here's the code that makes my program works~!
Imports System.IO
Imports System.IO.Ports
Imports System.Threading
Public Class Form1
Dim incomingByte As String = ""
Dim sec As Integer
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
With SerialPort1
.Close()
.PortName = "COM3"
.BaudRate = 9600
.Parity = Parity.None
.DataBits = 8
.StopBits = StopBits.One
.DtrEnable = True
.RtsEnable = True
.ReceivedBytesThreshold = 1
End With
SerialPort1.Open()
Label1.Text = SerialPort1.ReadExisting()
Timer1.Interval = 1000
Timer1.Enabled = True
sec = 0
End Sub
Private Sub readport()
Label1.Text = SerialPort1.ReadExisting()
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Call readport()
sec = sec + 1
Label2.Text = sec
End Sub
End Class
i wanna thank those people who help me!
discussion about this problem can view here:
http://www.dreamincode.net/forums/topic/370788-need-help-about-weighing-software-using-rs232-in-vbnet/[
^]