C# and socket to Opto 22 - old forum post



Joined on 04-18-2008
Posts 2
About write program using socktet and opto command via tcp

I wann’a a sample program.The program is written using C#,and using socket protocol and opto command way to communicate with opto device ,and get opto device information .Thanks A lot.

By the way ,my english is not good.

my Email: cqttom@tom.com

Thanks Again.
04-20-2008, 8:17 PM

Joined on 04-18-2008
Posts 2
Re: About write program using socktet and opto command via tcp

No reply?
04-21-2008, 1:33 PM

Joined on 12-01-2003
Optomation Systems, Madrid, Spain
Posts 153
Re: About write program using socktet and opto command via tcp

A good place to start is to read the OptoMMP_Protocol_Guide… This guide is for programmers who are writing custom applications to communicate with Opto 22 memory-mapped devices. These devices include SNAP PAC controllers and SNAP PAC EB and SB brains; SNAP Ultimate, SNAP Ethernet, and SNAP Simple I/O; E1 and E2 brain boards, and SNAP-LCE controllers. The guide describes how to use the OptoMMP Communication Toolkit or the IEEE 1394-based OptoMMP memory-mapped protocol for programming. The guide also contains the complete memory map for all Opto 22 memory-mapped devices.


As for examples you could start by downloading the OptoMMP Communications Toolkit

The OptoMMP Communication Toolkit includes ActiveX components and C++ classes for communicating with Opto 22 Ethernet-based brains and controllers which are memory-mapped devices using the OptoMMP protocol. The toolkit hides the details of the memory map protocol, so you can use programming tools such as Visual Basic or Visual C++ to easily communicate with these Ethernet devices.

All source code is included, along with examples using Visual Basic 6.0, Visual C++ 6.0, Word, Access, and Delphi.


Note that the MMP protocol is for accessing the brain side of the processor and not the internal control engine used by PACControl. Thats another story!

10-22-2008, 4:54 PM


Joined on 10-23-2008
Posts 1
Re: About write program using socktet and opto command via tcp

I use the OptoSnapIoMemMapX.dll and VB.Net to communicate with Opto SNAP PAC brains. First thing to do is to create an interop assembly so the unmanaged code in the DLL is available to the VB.Net managed code. Start reading here …

and here…


Once you have the interop assemble then you can add it as a refernce to your .net project in Visual Studio.

Then you can write some code to reference the functions in the DLL to connect to your brain and read and set IO points.

It’s pretty easy to do, once you get setup.