標(biāo)題: 關(guān)于VB上位機(jī)的問題,求幫助 [打印本頁]

作者: Titor    時間: 2018-5-7 22:54
標(biāo)題: 關(guān)于VB上位機(jī)的問題,求幫助
我用VB做了一個上位機(jī)想用來控制51單片機(jī),模擬了數(shù)值增加,減少和復(fù)位鍵,但是上位機(jī)上的數(shù)值增加鍵和減少鍵按一次,單片機(jī)的數(shù)值會不斷增加,再按別的也沒反應(yīng),復(fù)位鍵也只能按一次,按別的也都沒反應(yīng)請問是什么問題?
作者: 小貓貓愛吃魚    時間: 2018-5-7 23:41
問題出在程序
作者: Titor    時間: 2018-5-8 09:59
小貓貓愛吃魚 發(fā)表于 2018-5-7 23:41
問題出在程序

那請問是上位機(jī)的程序還是單片機(jī)的程序呢
下面是我上位機(jī)的程序
Private Sub Command1_Click()
strBuff = "1"
MSComm1.Output = strBuff
End Sub

Private Sub Command2_Click()
strBuff = "2"
MSComm1.Output = strBuff
End Sub

Private Sub Command3_Click()
strBuff = "3"
MSComm1.Output = strBuff
End Sub

Private Sub Command4_Click()
End
End Sub

Private Sub Form_Load()
Label1.Caption = "-----"
Label2.Caption = "-----"
Command1.Caption = "增加"
Command2.Caption = "減少"
Form1.WindowState = 2 '界面設(shè)置為最大
MSComm1.Settings = "9600,n,8,1"
MSComm1.OutBufferSize = 2   '設(shè)置MSComm1發(fā)送緩沖區(qū)為2字節(jié)
MSComm1.OutBufferCount = 0 '清除發(fā)送緩沖區(qū)
MSComm1.CommPort = 3  '指定使用com4
MSComm1.PortOpen = True '打開接口
End Sub

Private Sub MSComm1_OnComm()
Text1.Text = MSComm1.Input
Text2.Text = MSComm1.Input
End Sub




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1