📄 io_display.frm
字号:
Width = 195
End
Begin VB.Label Label1
BackColor = &H0080FFFF&
Caption = "Zero Fault"
Height = 195
Index = 29
Left = 3750
TabIndex = 6
Top = 825
Width = 1350
End
Begin VB.Shape Shape3
BackColor = &H00000000&
BackStyle = 1 'Opaque
Height = 195
Index = 4
Left = 5130
Shape = 3 'Circle
Top = 1065
Width = 195
End
Begin VB.Label Label1
BackColor = &H0080FFFF&
Caption = "Window Fault"
Height = 195
Index = 30
Left = 3750
TabIndex = 5
Top = 1065
Width = 1350
End
Begin VB.Shape Shape3
BackColor = &H00000000&
BackStyle = 1 'Opaque
Height = 195
Index = 5
Left = 5130
Shape = 3 'Circle
Top = 1305
Width = 195
End
Begin VB.Label Label1
BackColor = &H0080FFFF&
Caption = "Gain Fault"
Height = 195
Index = 31
Left = 3750
TabIndex = 4
Top = 1305
Width = 1350
End
Begin VB.Shape Shape3
BackColor = &H00000000&
BackStyle = 1 'Opaque
Height = 195
Index = 6
Left = 5130
Shape = 3 'Circle
Top = 1545
Width = 195
End
Begin VB.Label Label1
BackColor = &H0080FFFF&
Caption = "Invalid Command"
Height = 195
Index = 32
Left = 3750
TabIndex = 3
Top = 1545
Width = 1350
End
Begin VB.Shape Shape3
BackColor = &H00000000&
BackStyle = 1 'Opaque
Height = 195
Index = 7
Left = 5130
Shape = 3 'Circle
Top = 1785
Width = 195
End
Begin VB.Label Label1
BackColor = &H0000C0C0&
Caption = "N/A (Reserved)"
Height = 195
Index = 33
Left = 3750
TabIndex = 2
Top = 1785
Width = 1350
End
End
Begin VB.Label Label2
Caption = "Input W1"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2160
TabIndex = 63
Top = 2040
Width = 810
End
Begin VB.Label lblSBA
Caption = "SBA - (Remote Node)"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 0
TabIndex = 62
Top = 2040
Width = 2010
End
Begin VB.Label Label1
BackColor = &H0080FFFF&
Caption = "Binary W4 (Data2)"
Height = 195
Index = 35
Left = 3120
TabIndex = 22
Top = 2370
Width = 1350
End
Begin VB.Label Label1
BackColor = &H0080FFFF&
Caption = "Binary W3 (Data1)"
Height = 195
Index = 34
Left = 3120
TabIndex = 21
Top = 2100
Width = 1350
End
End
Attribute VB_Name = "IO_Display"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private BoardCount As Integer
Private LineCount(1) As Integer
Private bTemp(1) As Byte
Private cTemp(1) As Byte
Private dTemp(16) As Integer
Private eTemp(16) As Integer
Private fTemp(16) As Single
Private gTemp(16) As Single
Private HandShakeByteIN As String
Private HandShakeByteOUT As String
Private COMMAND As String
Private Data_1_IN As String
Private Data_1_OUT As String
Private Data_2_OUT As String
Private Latch As Boolean
Private X As Integer
Private CurrentSBA As Integer
Private StatusByte As String
Private Const T1 As String = "["
Private Const T2 As String = "]"
Private Sub Form_Resize()
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
End Sub
Private Sub Timer1_Timer()
UpdateGeniusBus
End Sub
Public Sub UpdateGeniusBus()
CurrentSBA = Val(Text4.Text)
'This is setup for 16 Bytes In and 16 Bytes Out
For X = 0 To 1
'Write 2 Bytes to Broadcast Control Output Table
cTemp(X) = Val(GBOutput(X).Text)
SetVar MemoryBaseAddress + SRI_BROADCAST_CONTROL_OUTPUT_TABLE_OFFSET + X, cTemp(X), 1
'Read 2 Bytes from SRI Device I/O Table (at Current Node)
bTemp(X) = GetVar(MemoryBaseAddress + SRI_Device_IO_Table_Offset(CurrentSBA) + X, 1)
GBInput(X).Text = bTemp(X)
Next X
For X = 2 To 6 Step 2
'Write 2 Words (2 Bytes each) to Broadcast Control Output Table
eTemp(X) = Val(GBOutput(X).Text)
SetVar MemoryBaseAddress + SRI_BROADCAST_CONTROL_OUTPUT_TABLE_OFFSET + X, eTemp(X), 2
'Read 2 Words (2 Bytes each) from SRI Device I/O Table (at Current Node)
dTemp(X) = GetVar(MemoryBaseAddress + SRI_Device_IO_Table_Offset(CurrentSBA) + X, 2)
GBInput(X).Text = dTemp(X)
Next X
For X = 8 To 12 Step 4
'Write 2 Singles (4 Bytes each) to Broadcast Control Output Table
gTemp(X) = CSng(GBOutput(X).Text)
SetVar MemoryBaseAddress + SRI_BROADCAST_CONTROL_OUTPUT_TABLE_OFFSET + X, gTemp(X), 4
'Read 2 Singles (4 Bytes each) from SRI Device I/O Table (at Current Node)
fTemp(X) = GetVar(MemoryBaseAddress + SRI_Device_IO_Table_Offset(CurrentSBA) + X, 4)
GBInput(X).Text = fTemp(X)
Next X
'Display the integer value of these two bytes
Text2.Text = GetVar(MemoryBaseAddress + SRI_Device_IO_Table_Offset(CurrentSBA), 2)
HandShakeByteIN = ByteFormat(DecimalToBinary(GBInput(0).Text))
COMMAND = GBInput(1).Text
Data_1_IN = GBInput(4).Text
'Heartbeat
If Right$(HandShakeByteIN, 1) = "1" Then
HandShakeByteOUT = Left$(ByteFormat(HandShakeByteOUT), 7) & "1"
Shape1(0).BackColor = &HFF00&
ElseIf Right$(HandShakeByteIN, 1) = "0" Then
HandShakeByteOUT = Left$(ByteFormat(HandShakeByteOUT), 7) & "0"
Shape1(0).BackColor = &H0&
ElseIf Right$(HandShakeByteIN, 1) = vbNullString Then
'ByteFormat(HandShakeByteOUT) = Left$(ByteFormat(HandShakeByteOUT), 7) & "1"
End If
'New Data IN
If Mid$(HandShakeByteIN, 7, 1) = "1" Then
Shape1(1).BackColor = &HFF00&
'Execute selected command sample code
Select Case COMMAND
Case "1" 'Text command 1
Label6.Caption = "This is command 1"
If Not Latch Then
'Data retrieved OUT
HandShakeByteOUT = Left$(ByteFormat(HandShakeByteOUT), 5) & "1" & Mid$(ByteFormat(HandShakeByteOUT), 7, 1) & Mid$(ByteFormat(HandShakeByteOUT), 8, 1)
'DO SOMETHING HERE
'New Data OUT
HandShakeByteOUT = Left$(ByteFormat(HandShakeByteOUT), 6) & "1" & Mid$(ByteFormat(HandShakeByteOUT), 8, 1)
Latch = True
End If
Case "2" 'Auto window command - a
Label6.Caption = "This would be command 2"
If Not Latch Then
'Data retrieved OUT
HandShakeByteOUT = Left$(ByteFormat(HandShakeByteOUT), 5) & "1" & Mid$(ByteFormat(HandShakeByteOUT), 7, 1) & Mid$(ByteFormat(HandShakeByteOUT), 8, 1)
'DO SOMETHING ELSE HERE
'New Data OUT
HandShakeByteOUT = Left$(ByteFormat(HandShakeByteOUT), 6) & "1" & Mid$(ByteFormat(HandShakeByteOUT), 8, 1)
Latch = True
End If
Case Else
Label6.Caption = "Bad GeniusBus Command"
End Select
ElseIf Mid$(HandShakeByteIN, 7, 1) = "0" Then
Latch = False
HandShakeByteOUT = Left$(ByteFormat(HandShakeByteOUT), 5) & "0" & Mid$(ByteFormat(HandShakeByteOUT), 7, 1) & Mid$(ByteFormat(HandShakeByteOUT), 8, 1)
Shape1(1).BackColor = &H0&
Else
'If Mid$(HandShakeByteIN, 7, 1) = vbNullString Then
'ByteFormat(HandShakeByteOUT) = Left$(ByteFormat(HandShakeByteOUT), 7) & "1"
End If
'Data Retrieved
If Mid$(HandShakeByteIN, 6, 1) = "1" Then
HandShakeByteOUT = Left$(ByteFormat(HandShakeByteOUT), 6) & "0" & Mid$(ByteFormat(HandShakeByteOUT), 8, 1)
Shape1(2).BackColor = &HFF00&
ElseIf Mid$(HandShakeByteIN, 6, 1) = "0" Then
Shape1(2).BackColor = &H0&
'HandShakeByteOUT = Left$(ByteFormat(HandShakeByteOUT), 5) & "000"
ElseIf Mid$(HandShakeByteIN, 6, 1) = vbNullString Then
'ByteFormat(HandShakeByteOUT) = Left$(ByteFormat(HandShakeByteOUT), 7) & "1"
End If
'Heartbeat Out
If Right$(HandShakeByteOUT, 1) = "1" Then
Shape2(0).BackColor = &HFF00&
ElseIf Right$(HandShakeByteOUT, 1) = "0" Then
Shape2(0).BackColor = &H0&
End If
'New Data Ready Out
If Mid$(HandShakeByteOUT, 7, 1) = "1" Then
Shape2(1).BackColor = &HFF00&
ElseIf Mid$(HandShakeByteOUT, 7, 1) = "0" Then
Shape2(1).BackColor = &H0&
End If
If Mid$(HandShakeByteOUT, 6, 1) = "1" Then
Shape2(2).BackColor = &HFF00&
ElseIf Mid$(HandShakeByteOUT, 6, 1) = "0" Then
Shape2(2).BackColor = &H0&
End If
'Status Byte Out
If Mid$(StatusByte, 8, 1) = "1" Then
Shape3(0).BackColor = &HFF00&
ElseIf Mid$(StatusByte, 8, 1) = "0" Then
Shape3(0).BackColor = &H0&
End If
If Mid$(StatusByte, 7, 1) = "1" Then
Shape3(1).BackColor = &HFF00&
ElseIf Mid$(StatusByte, 7, 1) = "0" Then
Shape3(1).BackColor = &H0&
End If
If Mid$(StatusByte, 6, 1) = "1" Then
Shape3(2).BackColor = &HFF00&
ElseIf Mid$(StatusByte, 6, 1) = "0" Then
Shape3(2).BackColor = &H0&
End If
If Mid$(StatusByte, 5, 1) = "1" Then
Shape3(3).BackColor = &HFF00&
ElseIf Mid$(StatusByte, 5, 1) = "0" Then
Shape3(3).BackColor = &H0&
End If
If Mid$(StatusByte, 4, 1) = "1" Then
Shape3(4).BackColor = &HFF00&
ElseIf Mid$(StatusByte, 4, 1) = "0" Then
Shape3(4).BackColor = &H0&
End If
If Mid$(StatusByte, 3, 1) = "1" Then
Shape3(5).BackColor = &HFF00&
ElseIf Mid$(StatusByte, 3, 1) = "0" Then
Shape3(5).BackColor = &H0&
End If
If Mid$(StatusByte, 2, 1) = "1" Then
Shape3(6).BackColor = &HFF00&
ElseIf Mid$(StatusByte, 2, 1) = "0" Then
Shape3(6).BackColor = &H0&
End If
If Mid$(StatusByte, 1, 1) = "1" Then
Shape3(7).BackColor = &HFF00&
ElseIf Mid$(StatusByte, 1, 1) = "0" Then
Shape3(7).BackColor = &H0&
End If
Text6(0).Text = HandShakeByteIN
Text6(1).Text = HandShakeByteOUT
Text6(2).Text = COMMAND
Text6(3).Text = StatusByte
Text8(0).Text = DecimalToBinary(GBOutput(4).Text)
Text8(1).Text = DecimalToBinary(GBOutput(6).Text)
GBOutput(0).Text = BinaryToDecimal(HandShakeByteOUT)
GBOutput(1).Text = BinaryToDecimal(StatusByte)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -