VisionBox .NET Library
Rs422_Example.cs

C# example for using the RS422 device

1 
2 using System;
3 using VIB_NET;
4 
5 namespace CSharp
6 {
7  class Rs422_Example
8  {
9  public static void RsS422()
10  {
11  Console.Clear();
12 
13  try
14  {
15  // Create device objects with the 'using' statement so they get closed automatically:
16  using (VIB_NET.RS422 rs422 = new VIB_NET.RS422())
17  {
18  // open the RS422 device
19  rs422.Open(0);
20 
21  // Get type of RS422
22  Console.WriteLine(rs422.GetType().ToString());
23 
24  // Get number of inputs
25  Console.WriteLine("Number of inputs: " + rs422.NumberOfInputs.ToString());
26 
27  // Get number of outputs
28  Console.WriteLine("Number of outputs: " + rs422.NumberOfOutputs.ToString());
29 
30  // Get state of all inputs
31  Console.WriteLine("Input state: 0x" + rs422.Input.ToString("x"));
32 
33  // Get state of input 0
34  Console.WriteLine("State of bit 0: " + rs422.GetBit(0).ToString());
35 
36  // Set output 1 and 2 simultaneously
37  rs422.Output = 6;
38  // Set output 0
39  rs422.SetBit(0, true);
40 
41  // Turn off all outputs
42  rs422.Output = 0;
43 
44  } // Close all devices
45  }
46  catch (System.Exception e)
47  {
48  Console.WriteLine(e.Message);
49  }
50 
51  Console.WriteLine("\nPress enter to proceed...");
52  Console.ReadLine();
53  }
54  }
55 }
VIB_NET
All relevant classes and functions are residing in this namespace.
Definition: CameraLinkIn.cpp:6
VIB_NET::RS422
This class controls the RS-422 interface.
Definition: VIB_NET.h:943