三a级做爰片免费观看玉蒲团,伊人久久亚洲综合av影院,午夜永久免费爽爽爽影院,西川唯久久久久久久综合

tangfeng
學(xué)海無涯
級別: 探索解密
精華主題: 0
發(fā)帖數(shù)量: 44 個
工控威望: 143 點(diǎn)
下載積分: 922 分
在線時間: 97(小時)
注冊時間: 2010-01-24
最后登錄: 2025-05-26
查看tangfeng的 主題 / 回貼
樓主  發(fā)表于: 2017-09-02 16:50
'在窗體的Load事件中加入下列代碼對串口進(jìn)行初始化:
Private Sub Form_Load()
  MSComm1.CommPort = 1                  ' 設(shè)置通信端口號為COM1
  MSComm1.InputMode = 1                 ' 接收二進(jìn)制型數(shù)據(jù)
  MSComm1.RThreshold = 1                ' 設(shè)置并返回要接收的字符數(shù)
  MSComm1.SThreshold = 1                ' 設(shè)置并返回發(fā)送緩沖區(qū)中允許的最小字符數(shù)
  MSComm1.Settings = "9600,E,7,1"       ' 設(shè)置串口1通信參數(shù)
  MSComm1.PortOpen = True               ' 打開通信端口1
  Timer1.Enabled = False
End Sub
'向PLC發(fā)送指令:02 30 31 30 30 30 32 30 03 35 36,功能是從D0開始讀取32個字節(jié)數(shù)據(jù)
Private Sub Cmdsend_Click()
  MSComm1.Output = Chr(&H2) & Chr(&H30) & Chr(&H31) & Chr(&H30) & Chr(&H30) & Chr(&H30) & Chr(&H32) & Chr(&H30) & Chr(&H3) & Chr(&H35) & Chr(&H38)
  Timer1.Enabled = True
End Sub
'獲得各輸入端口狀態(tài)
Private Sub Timer1_Timer()
  Dim Inbyte() As Byte
  Dim buffer As String
  ReDim Inbyte(100)
  Inbyte = MSComm1.Input                         '返回的數(shù)據(jù)串
  For i = LBound(Inbyte) To UBound(Inbyte)
     buffer = buffer + Hex(Inbyte(i)) + Chr(32)
  Next i
  'Text1.Text = buffer                            '顯示返回的數(shù)據(jù)串,需自己添加TextBox
  If Hex(Inbyte(2)) = "31" Then                  '31表示觸點(diǎn)閉合
    Shape1(0).FillColor = QBColor(12)
  Else                                           '30表示觸點(diǎn)斷開
    Shape1(0).FillColor = QBColor(10)
  End If
  If Hex(Inbyte(6)) = "31" Then
    Shape1(1).FillColor = QBColor(12)
  Else
    Shape1(1).FillColor = QBColor(10)
  End If
  If Hex(Inbyte(10)) = "31" Then
    Shape1(2).FillColor = QBColor(12)
  Else
    Shape1(2).FillColor = QBColor(10)
  End If
  If Hex(Inbyte(14)) = "31" Then
    Shape1(3).FillColor = QBColor(12)
  Else
    Shape1(3).FillColor = QBColor(10)
  End If
  If Hex(Inbyte(18)) = "31" Then
    Shape1(4).FillColor = QBColor(12)
  Else
    Shape1(4).FillColor = QBColor(10)
  End If
  If Hex(Inbyte(22)) = "31" Then
    Shape1(5).FillColor = QBColor(12)
  Else
    Shape1(5).FillColor = QBColor(10)
  End If
  If Hex(Inbyte(26)) = "31" Then
    Shape1(6).FillColor = QBColor(12)
  Else
    Shape1(6).FillColor = QBColor(10)
  End If
  If Hex(Inbyte(30)) = "31" Then
    Shape1(7).FillColor = QBColor(12)
  Else
    Shape1(7).FillColor = QBColor(10)
  End If
  If Hex(Inbyte(34)) = "31" Then
    Shape1(8).FillColor = QBColor(12)
  Else
    Shape1(8).FillColor = QBColor(10)
  End If
  If Hex(Inbyte(38)) = "31" Then
    Shape1(9).FillColor = QBColor(12)
  Else
    Shape1(9).FillColor = QBColor(10)
  End If
  If Hex(Inbyte(42)) = "31" Then
    Shape1(10).FillColor = QBColor(12)
  Else
    Shape1(10).FillColor = QBColor(10)
  End If
  If Hex(Inbyte(46)) = "31" Then
    Shape1(11).FillColor = QBColor(12)
  Else
    Shape1(11).FillColor = QBColor(10)
  End If
  If Hex(Inbyte(50)) = "31" Then
    Shape1(12).FillColor = QBColor(12)
  Else
    Shape1(12).FillColor = QBColor(10)
  End If
  If Hex(Inbyte(54)) = "31" Then
    Shape1(13).FillColor = QBColor(12)
  Else
    Shape1(13).FillColor = QBColor(10)
  End If
  If Hex(Inbyte(58)) = "31" Then
    Shape1(14).FillColor = QBColor(12)
  Else
    Shape1(14).FillColor = QBColor(10)
  End If
  If Hex(Inbyte(62)) = "31" Then
    Shape1(15).FillColor = QBColor(12)
  Else
    Shape1(15).FillColor = QBColor(10)
  End If
  Timer1.Enabled = False
End Sub
'當(dāng)退出程序時,關(guān)閉串行口
Private Sub Cmdquit_Click()
  MSComm1.PortOpen = False           '關(guān)閉串口
  Unload Me
End Sub
// 讀不到PLC 輸入點(diǎn),下標(biāo)越界,望高手指點(diǎn)修改
yhtxiao
級別: 探索解密
精華主題: 0
發(fā)帖數(shù)量: 36 個
工控威望: 145 點(diǎn)
下載積分: 496 分
在線時間: 69(小時)
注冊時間: 2011-05-19
最后登錄: 2025-05-24
查看yhtxiao的 主題 / 回貼
1樓  發(fā)表于: 2017-09-07 21:33
反饋數(shù)據(jù)是8位數(shù)據(jù)  用串口監(jiān)測軟件看一下數(shù)據(jù)結(jié)構(gòu)應(yīng)該很好理解

欧美成人性色xxxxx| 天堂网2014另类天堂| 粉嫩的极品女神尤物在线| 在线观看又污又黄的网站| 欧美另类亚洲另类国产精品| 日本人大鸡巴操大逼逼吧| 好想被大鸡巴猛插的视频| 一本到亚洲中文字幕av| 亚洲色逼逼视频| 性感美女被大鸡巴操视频| 国产成人综合| 把极品动漫黑丝美女操了| 欧美日本久久久久久久久久| aa级女人大片喷水视频| 韩国妈妈的朋友| caoporn超碰91| 国产精品青青在线观看爽| 亚洲欧美精品久久久久久| 美女小鸡鸡软件| 老太婆操逼日B| 欧美日韩理论片免费观看| 一本大道亚洲最全精品嫩| 好逼天天操天天色综合网| 重庆南岸南岸区| 欧美与黑人午夜猛交久久久| 悠悠资源av男人免费站| 无码一区二区三区乱子伦| 国产精品久久99热福利| 粗大的内捧猛烈进出视频| 免费AAA毛片视频色欲| www750ocm肏屄| 日韩精品一区二区三区激情| 成人黄色免费网站app| 囯产精品久久久性色Av| 亚洲区日韩精品中文字幕| 日本一区二区三区高清免费 | 真人做爰48姿势性视频| 裸体美女色黄污天堂久久| 大鸡吧操逼无套内射强迫| 丁香五月六月啪| 高清v欧美v亚洲v精品|