C# and socket to Opto 22 - old forum post

cqttom@tom.com

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.
Report
04-20-2008, 8:17 PM
cqttom@tom.com

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

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

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.

http://www.opto22.com/site/downloads/drilldown.aspx?aid=2889

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!

Report 
10-22-2008, 4:54 PM

mjhillman

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 …
http://msdn.microsoft.com/en-us/library/kew41ycz(VS.71).aspx

and here…

http://msdn.microsoft.com/en-us/library/cwys3b23(VS.71).aspx

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.