PIC Vietnam

Go Back   PIC Vietnam > Microchip PIC > Các ngôn ngữ lập trình khác (CCS C, HT PIC,...)

Tài trợ cho PIC Vietnam
Trang chủ Đăng Kí Hỏi/Ðáp Thành Viên Lịch Tìm Kiếm Bài Trong Ngày Ðánh Dấu Ðã Ðọc Vi điều khiển

 
 
Ðiều Chỉnh Xếp Bài
Prev Previous Post   Next Post Next
Old 05-04-2009, 05:34 PM   #5
phandinh
Đệ tử 6 túi
 
Tham gia ngày: Nov 2008
Nơi Cư Ngụ: Di Linh
Bài gửi: 131
:
đây là code VB của mình . khi nào nhấn nút thì mới gửi xuống

Private Sub Command1_Click()
Dim data_send As Variant
If Text1.Text = "" Then
Exit Sub
End If
data_send = Text1.Text
MSComm1.Output = " @ " & Chr(2) & Chr(8) & data_send & Chr(255)
Text1.Text = ""
End Sub

Private Sub Command2_Click()
Text2.Text = ""
End Sub

Private Sub Form_Load()
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False
End If 'dong serial port neu no mo
' cau hinh lai cho serial port
MSComm1.CommPort = 5 ' dung port 5
MSComm1.Settings = " 9600 , n , 8 , 1" 'baud = 9600, 8 bit
MSComm1.InputLen = 0 ' doc buffer
MSComm1.RThreshold = 1 ' neu nhan 1 ki tu don se phat sinh su kien commevents
MSComm1.PortOpen = True
End Sub
Private Sub MSComm1_OnComm()

If (MSComm1.CommEvent = comEvReceive) Then
Text2.Text = Text2.Text + MSComm1.Input
End If


End Sub
phandinh vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
 

Ðiều Chỉnh
Xếp Bài

Quyền Sử Dụng Ở Diễn Ðàn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Smilies đang Mở
[IMG] đang Mở
HTML đang Tắt

Chuyển đến


Múi giờ GMT. Hiện tại là 02:02 PM.


Được sáng lập bởi Đoàn Hiệp
Powered by vBulletin®
Page copy protected against web site content infringement by Copyscape
Copyright © PIC Vietnam