Dim khoiluong As Double _______________________________________________________________________ Private Sub Command1_Click() Timer3.Enabled = True Timer4.Enabled = True End Sub ________________________________________________________________ Private Sub Command2_Click() End End Sub __________________________________________________________________ Private Sub Form_Load() MSComm1.CommPort = 1 MSComm1.Settings = "9600,N,8,1" MSComm1.InputLen = 0 MSComm1.InputMode = comInputModeText MSComm1.InBufferSize = 1 MSComm1.PortOpen = True Timer3.Enabled = False Timer4.Enabled = False End Sub _________________________________________________________________ Private Sub Form_Unload(Cancel As Integer) If MSComm1.PortOpen = True Then MSComm1.PortOpen = False End If End Sub _________________________________________________________________ Private Sub Picture1_Click() MsgBox " giao dien phan mem ket noi voi modem can dinh luong hien thi tren may tinh.dung loadcell.phien ban v1.0 demo. voi giao thuc truyen la com1. buad 900,n,8,1.", vbOKOnly, "gioi thieu so bo ve phan mem! " End Sub Private Sub Picture2_Click() MsgBox " do an tot nghiep dai hoc su pham ki thuat nam dinh. de tai can dinh luong dung loadcell va vdk 89c51 ket noi voi may tinh", vbOKOnly, "gioi thieu so bo ve phan mem! " End Sub ___________________________________________________________________ Private Sub Timer1_Timer() Text2.Text = "com1 9600,N,8,1 " End Sub Private Sub Timer2_Timer() Text2.Text = "" End Sub ___________________________________________________________________ Private Sub Timer3_Timer() Dim klTest As String 'Tao mot bien de luu du lieu tam thoi tu com truyen ve klTest = MSComm1.Input On Error Resume Next 'Co gang convert du lieu thanh kieu Int klTest = Trim$(klTest) 'Cat khoang trang 2 dau khoiluong = Asc(klTest) 'Convert to Interger MSComm1.InputLen = 0 'Xoa bo dem End Sub ___________________________________________________________________ Private Sub Timer4_Timer() Text1.Text = khoiluong & "Kg" End Sub . noi voi modem can dinh luong hien thi tren may tinh.dung loadcell.phien ban v1.0 demo. voi giao thuc truyen la com1. buad 900,n,8,1.", vbOKOnly, "gioi thieu so bo ve phan mem! " End. pham ki thuat nam dinh. de tai can dinh luong dung loadcell va vdk 89c51 ket noi voi may tinh", vbOKOnly, "gioi thieu so bo ve phan mem! " End Sub ___________________________________________________________________ Private