Visual Basic example for using the RS422 device
2 Public Class Rs422_Example
4 Public Shared Sub RsS422()
7 Dim pVIBSystem As VIB_NET.VIBSystem = New VIB_NET.VIBSystem()
9 If (pVIBSystem IsNot Nothing) Then
12 Dim pRs422 As VIB_NET.Rs422 = DirectCast(pVIBSystem.OpenDevice(VIB_NET.eDEVICE_TYPE.RS422, 0), VIB_NET.Rs422)
13 If (pRs422 IsNot Nothing) Then
16 Console.WriteLine(pRs422.GetType().ToString())
18 ' Get number of inputs
19 Console.WriteLine("Number of inputs: " + pRs422.NumberOfInputs.ToString())
21 ' Get number of outputs
22 Console.WriteLine("Number of outputs: " + pRs422.NumberOfOutputs.ToString())
24 ' Get state of all inputs
25 Console.WriteLine("Input state: " + pRs422.Input.ToString())
27 ' Get state of input 0
28 Console.WriteLine("State of bit 0: " + pRs422.GetBit(0).ToString())
30 ' Set output 1 and 2 simultaneously
33 pRs422.SetBit(0, True)
35 ' Turn off all outputs
37 Catch e As System.Exception
38 Console.WriteLine(e.Message)
41 pVIBSystem.CloseDevice(pRs422)
45 Catch e As System.Exception
46 Console.WriteLine(e.Message)
52 Console.WriteLine(vbNewLine + "Press enter to proceed...")