Lex 3I170DW Manual page 53

Table of Contents

Advertisement

Function CheckDIValue
Function CheckDIValue()
Dim GPIO1X
As Integer
Dim GPIO3X
As Integer
Dim DI1Xhex
As String
Dim DI3Xhex
As String
Dim Data As Long
Data = 0
Call ReadI2CByte(&H12, GPIO1X)
Call ReadI2CByte(&H42, GPIO3X)
GPIO1X = GPIO1X And &HF0
GPIO3X = GPIO3X And &HF
If (GPIO1X And &H10) <> 0 Then
Data = Data + &H1
End If
If (GPIO1X And &H80) <> 0 Then
Data = Data + &H2
End If
If (GPIO1X And &H40) <> 0 Then
Data = Data + &H4
End If
If (GPIO3X And &H1) <> 0 Then
Data = Data + &H8
End If
If (GPIO3X And &H2) <> 0 Then
Data = Data + &H10
End If
If (GPIO3X And &H4) <> 0 Then
Data = Data + &H20
End If
If (GPIO3X And &H8) <> 0 Then
Data = Data + &H40
End If
If (GPIO1X And &H20) <> 0 Then
Data = Data + &H80
End If
DI1Xhex = Hex(Data)
Text3.Text = "0x" + DI1Xhex
End Function
48

Advertisement

Table of Contents
loading

Table of Contents