下面一段為用指示燈表示PLC的運行狀態 Private Sub Timer5_Timer() Dim s1 As String Dim s2 As String Dim s22 Dim s3 As String Dim s4 As String s2 = "01010C300001" s22 = LRC(s2) s1 = ":" + s2 + s22 + Chr$(13) + Chr$(10) MSComm1.Output = s1 s3 = MSComm1.Input s4 = Mid$(s3, 8, 2) If s4 = "31" Then