14.08.2013 Views

snap ethernet-based i/o units protocols and programming guide

snap ethernet-based i/o units protocols and programming guide

snap ethernet-based i/o units protocols and programming guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 3: USING THE SNAP ETHERNET I/O DRIVER TOOLKIT<br />

Also, please note these are ActiveX components, not controls. They do not have any user<br />

interface elements or design-time properties. They use methods <strong>and</strong> events but not properties.<br />

OptoSnapIoMemMapX General Instructions<br />

Each <strong>programming</strong> environment has a different way of using ActiveX components. Also,<br />

environments use different <strong>and</strong> conflicting terminology. See the environment’s documentation for<br />

more information on how to use ActiveX components. In general, however, you will need to do<br />

the following:<br />

1. Add the component to the project, so the project knows about it.<br />

In some environements, you must add a reference to the type library, class, or<br />

interface.<br />

In others, you must import the type library, class, or interface into a native format. For<br />

example, if you are using the component in Visual C++, it will build a C++ wrapper class<br />

for accessing the component.<br />

2. Create an instance of the component.<br />

3. Open a connection to a brain.<br />

4. Use the methods of the component to communicate with the connected brain <strong>and</strong> check for<br />

errors.<br />

5. When done, disconnect from the brain.<br />

6. If needed, destroy the instance that was created in step 2.<br />

See “MemMap Example Code” on page 55 for examples of these procedures in Visual Basic.<br />

OptoSnapIoStreamX General Instructions<br />

Common procedures for using the OptoSnapIoStreamX ActiveX component in a program are:<br />

1. Add the component to the project, so the project knows about it.<br />

In some environements, you must add a reference to the type library, class, or<br />

interface.<br />

In others, you must import the type library, class, or interface into a native format. For<br />

example, if you are using the component in Visual C++, it will build a C++ wrapper class<br />

for accessing the component.<br />

2. Create an instance of the component.<br />

3. Call OpenStreaming() to initialize the stream type, length, <strong>and</strong> port.<br />

4. Call StartStreamListening() for each I/O unit.<br />

48 SNAP Ethernet-Based I/O Units Protocols <strong>and</strong> Programming Guide

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!