有谁做过信息系统集成资质查询,对OPC接口了解的,小弟请教大佬一个问题?

当前位置: >>
c# OPC操作实例
using System.C
using System.Runtime.InteropS
using System.D
using System.ComponentM
using System.Windows.F
using System.D
using System.R
using System.Runtime.CompilerS
using OpcRcw.Da;
using OpcRcw.C
namespace OPC
{
public partial class Form1 : Form, IOPCDataCallback
public Form1()
InitializeComponent();
internal const string NODE_NAME = &home-7f692c6457&;
//internal const string NODE_NAME = &6e228ad0c99645d&;
// node name结点名
internal const string SERVER_NAME = &OPCServer.WinCC&;
// server name服务器名
internal const string ITEM1_NAME = &TankLevel1&;
// First item name第一个项的名字
internal const string ITEM2_NAME = &TankLevel2&;
// First item name第一个项的名字
internal const string ITEM3_NAME = &temp1&;
// First item name第一个项的名字
internal const string ITEM4_NAME = &temp2&;
// First item name第一个项的名字
internal const string ITEM5_NAME = &press1&;
// First item name第一个项的名字
internal const string GROUP_NAME = &Internal tags&;
// Group name 组名
internal const int LOCALE_ID = 0;
// LOCALE ID FOR ENGLISH.
/* Global variables */
IOPCServer pIOPCS
IOPCAsyncIO2 pIOPCAsyncIO2 =
// instance pointer for asynchronous IO.
IOPCGroupStateMgt pIOPCGroupStateMgt =
IConnectionPointContainer pIConnectionPointContainer =
IConnectionPoint pIConnectionPoint =
Object pobjGroup1 =
int pSvrGroupHandle = 0;
// server group handle for the added group
int nTransactionID = 0;
int[] ItemSvrHandleA
Int32 dwCookie = 0;
/* Global variables */
//IOPCServer pIOPCS
// OPC server interface pointer &
opc服务器接口指针
//Object pobjGroup1;
// Pointer to group object 指向组对象的指针
int nSvrGroupID;
// server group handle for the added group 为添加的组的服务器组的句柄
IOPCSyncIO pIOPCSyncIO;
// instance pointer for synchronous IO.
为同步输入输出事例化指针
//int[] nItemSvrID;
// array for server handles for
服务器句柄数组
private Guid iidRequiredInterface = Guid.E
private void button2_Click(object sender, EventArgs e)//连接服务器
// Local variables局部变量
//服务器类型
svrN     //服务器的名字
OPCITEMDEF[] ItemDefA
// Initialise Group properties初始化组属性
int bActive = 0;
int dwRequestedUpdateRate = 0;
int hClientGroup = 0;
//int dwLCID = LOCALE_ID;
int pRevUpdateR
float deadband = 0;
// Access unmanaged COM memory
GCHandle hD
IntPtr pTimeBias = IntPtr.Z
hDeadband = GCHandle.Alloc(deadband,GCHandleType.Normal);
//commonInterface.GetLocaleID(out LOCALE_ID);
// 1. Connect to the local server.连接到服务器
// Get the Type from the progID and create instance of the OPC Server COM 得到服务器名并事例化com 组件
// component
//GUID Guid = new Guid(&{75D00BBB-DDA5-11D1-B944-9E614D000000}&);
iidRequiredInterface = typeof(IOPCItemMgt ).GUID; //返回一个用于标识表达式的数据类型的字符串
//iidRequiredInterface = new Guid(&{63D5F432-CFE4-11d1-B2C8-FB}&);//typeof(IOPCItemMgt).GUID;
svrComponenttyp = System.Type.GetTypeFromProgID(SERVER_NAME);
pIOPCServer =(IOPCServer)System.Activator.CreateInstance(svrComponenttyp);//创建服务器对象
/* 2. Add a new group 添加一个新组
Add a group object and querry for interface IOPCItemMgt
Parameter as following:
[in] not active, so no OnDataChange callback //不活动,不引发数据改变事件
[in] Request this Update Rate from Server  服务器的刷新频率
[in] Client Handle, not necessary in this sample   客户端的句柄,在本例子中不必要
[in] No time interval to system UTC time   无系统时间的时间间隔 
[in] No Deadband, so all data changes are reported   无死区,所以所有数据的改变被报告
[in] Server uses english language to for text values 服务器用英文的文本值
[out] Server handle to identify this group in later calls 服务器的句柄为了确保该组之后被访问
[out] The answer from Server to the requested Update Rate 服务器的应答刷新率
[in] requested interface type of the group object  组对象的接口类型
[out] pointer to the requested interface   指向接口的指针
pIOPCServer.AddGroup(GROUP_NAME,
dwRequestedUpdateRate,
hClientGroup,
pTimeBias,
(IntPtr)hDeadband,
LOCALE_ID,
out nSvrGroupID,
out pRevUpdateRate,
ref iidRequiredInterface,
out pobjGroup1);
// Initialize all IO interface pointers. 初始化所有输入输出接口指针
InitReqIOInterfaces();
// Get the IOPOCSyncIO interface pointer from the group pointer.
//从组指针得到输入输出接口的指针
// pIOPCSyncIO also needs to be released when not in use.不用时要释放
pIOPCSyncIO =(IOPCSyncIO)pobjGroup1;
/* 3. Add items to the group 添加项到组*/
// This example shows adding of only one item in the group本例子只添加一个项到该组
ItemDefArray = new OPCITEMDEF[5];
ItemDefArray[0].szAccessPath
// Accesspath not needed for this sample本例不需要路径
ItemDefArray[0].szItemID
= ITEM1_NAME;
// ItemID, see above
ItemDefArray[0].bActive
// item is active项是活动的
ItemDefArray[0].hClient
// client handle 客户端句柄
ItemDefArray[0].dwBlobSize
// blob size
ItemDefArray[0].pBlob
= IntPtr.Z
// pointer to blob
ItemDefArray[0].vtRequestedDataType = 2;
// return values in native (cannonical) datatype
ItemDefArray[1].szAccessPath = &&;
// Accesspath not needed for this sample本例不需要路径
ItemDefArray[1].szItemID = ITEM2_NAME;
// ItemID, see above
ItemDefArray[1].bActive = 1;
// item is active项是活动的
ItemDefArray[1].hClient = 2;
// client handle 客户端句柄
ItemDefArray[1].dwBlobSize = 0;
// blob size
ItemDefArray[1].pBlob = IntPtr.Z
// pointer to blob
ItemDefArray[1].vtRequestedDataType = 2;
// return values in native (cannonical) datatype
ItemDefArray[2].szAccessPath = &&;
// Accesspath not needed for this sample本例不需要路径
ItemDefArray[2].szItemID = ITEM3_NAME;
// ItemID, see above
ItemDefArray[2].bActive = 1;
// item is active项是活动的
ItemDefArray[2].hClient = 3;
// client handle 客户端句柄
ItemDefArray[2].dwBlobSize = 0;
// blob size
ItemDefArray[2].pBlob = IntPtr.Z
// pointer to blob
ItemDefArray[2].vtRequestedDataType = 2;
// return values in native (cannonical) datatype
ItemDefArray[3].szAccessPath = &&;
// Accesspath not needed for this sample本例不需要路径
ItemDefArray[3].szItemID = ITEM4_NAME;
// ItemID, see above
ItemDefArray[3].bActive = 1;
// item is active项是活动的
ItemDefArray[3].hClient = 4;
// client handle 客户端句柄
ItemDefArray[3].dwBlobSize = 0;
// blob size
ItemDefArray[3].pBlob = IntPtr.Z
// pointer to blob
ItemDefArray[3].vtRequestedDataType = 2;
// return values in native (cannonical) datatype
ItemDefArray[4].szAccessPath = &&;
// Accesspath not needed for this sample本例不需要路径
ItemDefArray[4].szItemID = ITEM5_NAME;
// ItemID, see above
ItemDefArray[4].bActive = 1;
// item is active项是活动的
ItemDefArray[4].hClient = 5;
// client handle 客户端句柄
ItemDefArray[4].dwBlobSize = 0;
// blob size
ItemDefArray[4].pBlob = IntPtr.Z
// pointer to blob
ItemDefArray[4].vtRequestedDataType = 2;
// return values in native (cannonical) datatype
// initialize output parameters.初始化输出参数
IntPtr pResults = IntPtr.Z
IntPtr pErrors
= IntPtr.Z
// Add items to group添加项到组
((IOPCItemMgt)pobjGroup1).AddItems(5,ItemDefArray,out pResults,out pErrors);
// Unmarshal to get the server handles out fom the m_pItemResult 得到服务器的句柄
// after checking the errors
int[] errors = new int[5];
IntPtr pos = pR
ItemSvrHandleArray = new int[5];
Marshal.Copy(pErrors, errors, 0,5);
if (errors[0] == 0)
OPCITEMRESULT result = (OPCITEMRESULT)Marshal.PtrToStructure(pos, typeof(OPCITEMRESULT));
ItemSvrHandleArray[0] = result.hS
String strE
pIOPCServer.GetErrorString(errors[0], LOCALE_ID, out strError);
MessageBox.Show(strError, &Result - Adding Item 0&, MessageBoxButtons.OK, MessageBoxIcon.Error);
if (errors[1] == 0)
pos = new IntPtr(pos.ToInt32() + Marshal.SizeOf(typeof(OPCITEMRESULT)));
OPCITEMRESULT result = (OPCITEMRESULT)Marshal.PtrToStructure(pos, typeof(OPCITEMRESULT));
ItemSvrHandleArray[1] = result.hS
String strE
pIOPCServer.GetErrorString(errors[1], LOCALE_ID, out strError);
MessageBox.Show(strError, &Result - Adding Item 1&, MessageBoxButtons.OK, MessageBoxIcon.Error);
if (errors[2] == 0)
pos = new IntPtr(pos.ToInt32() + Marshal.SizeOf(typeof(OPCITEMRESULT)));
OPCITEMRESULT result = (OPCITEMRESULT)Marshal.PtrToStructure(pos, typeof(OPCITEMRESULT));
ItemSvrHandleArray[2] = result.hS
String strE
pIOPCServer.GetErrorString(errors[2], LOCALE_ID, out strError);
MessageBox.Show(strError, &Result - Adding Item 1&, MessageBoxButtons.OK, MessageBoxIcon.Error);
if (errors[3] == 0)
pos = new IntPtr(pos.ToInt32() + Marshal.SizeOf(typeof(OPCITEMRESULT)));
OPCITEMRESULT result = (OPCITEMRESULT)Marshal.PtrToStructure(pos, typeof(OPCITEMRESULT));
ItemSvrHandleArray[3] = result.hS
String strE
pIOPCServer.GetErrorString(errors[3], LOCALE_ID, out strError);
MessageBox.Show(strError, &Result - Adding Item 1&, MessageBoxButtons.OK, MessageBoxIcon.Error);
if (errors[4] == 0)
pos = new IntPtr(pos.ToInt32() + Marshal.SizeOf(typeof(OPCITEMRESULT)));
OPCITEMRESULT result = (OPCITEMRESULT)Marshal.PtrToStructure(pos, typeof(OPCITEMRESULT));
ItemSvrHandleArray[4] = result.hS
String strE
pIOPCServer.GetErrorString(errors[4], LOCALE_ID, out strError);
MessageBox.Show(strError, &Result - Adding Item 1&, MessageBoxButtons.OK, MessageBoxIcon.Error);
catch (System.Exception error) // catch for error in adding items.
MessageBox.Show(error.Message,&Result - Adding Items&,MessageBoxButtons.OK,MessageBoxIcon.Error);
// Free the unmanaged memory
if(pResults != IntPtr.Zero)
Marshal.FreeCoTaskMem(pResults);
pResults = IntPtr.Z
if(pErrors != IntPtr.Zero)
Marshal.FreeCoTaskMem(pErrors);
pErrors = IntPtr.Z
catch (System.ArgumentException error) // catch for error in creation group
MessageBox.Show(String.Format(&Error while creating group object:-{0}& ,
error.ParamName),&Result-Add Group&,MessageBoxButtons.OK,
MessageBoxIcon.Error);
if (hDeadband.IsAllocated) hDeadband.Free();
catch (System.Exception error) // catch for error in creating server
MessageBox.Show(String.Format(&Error while creating server object:-{0}& ,error.Message),
&Result - Create Server Instance&,MessageBoxButtons.OK,MessageBoxIcon.Error);
MessageBox.Show(&连接已建立!&);
button1.Enabled =
button2.Enabled =
button3.Enabled =
button4.Enabled =
chkGroupActive.Enabled =
private void button1_Click(object sender, EventArgs e)//写
IntPtr pErrors = IntPtr.Z
object[] values = new object[5];
values[0] = textbox1.T
values[1] = textBox2.T
values[2] = textBox3.T
values[3] = textBox4.T
values[4] = textBox5.T
//pIOPCSyncIO.Write(5, ItemSvrHandleArray, values, out pErrors);
pIOPCAsyncIO2.Write(5, ItemSvrHandleArray, values, nTransactionID + 1, out nCancelid, out pErrors);
int[] errors = new int[5];
Marshal.Copy(pErrors, errors, 0, 5);
String pstrE
pIOPCServer.GetErrorString(errors[0], LOCALE_ID, out pstrError);
//strSyncWriteStatus.Text = pstrE
catch (System.Exception error)
MessageBox.Show(error.Message, &Result - WriteItem&, MessageBoxButtons.OK, MessageBoxIcon.Error);
if (pErrors != IntPtr.Zero)
Marshal.FreeCoTaskMem(pErrors);
pErrors = IntPtr.Z
private void button4_Click(object sender, EventArgs e)//读
IntPtr pItemValues = IntPtr.Z
IntPtr pErrors = IntPtr.Z
// Sync read from device
pIOPCSyncIO.Read(OPCDATASOURCE.OPC_DS_DEVICE, 5, ItemSvrHandleArray, out pItemValues, out pErrors);
// Unmarshal the returned memory to get the item state out fom the ppItemValues
// after checking errors
int[] errors = new int[5];
IntPtr posr = pItemV
Marshal.Copy(pErrors, errors, 0, 5);
if (errors[0] == 0)
OPCITEMSTATE pItemState = (OPCITEMSTATE)Marshal.PtrToStructure(posr, typeof(OPCITEMSTATE));
// update the UI
textBox12.Text = String.Format(&{0}&, pItemState.vDataValue);
// quality
//strSncQuality.Text = GetQuality(pItemState.wQuality);
// Time stamp - Date and time
//DateTime dt = ToDateTime(pItemState.ftTimeStamp);
//strSycTimeStamp.Text = dt.ToString();
String pstrE
pIOPCServer.GetErrorString(errors[0], LOCALE_ID, out pstrError);
MessageBox.Show(pstrError, &Result - Read Items&, MessageBoxButtons.OK, MessageBoxIcon.Error);
if (errors[1] == 0)
posr = new IntPtr(posr.ToInt32() + Marshal.SizeOf(typeof(OPCITEMSTATE)));
OPCITEMSTATE pItemState = (OPCITEMSTATE)Marshal.PtrToStructure(posr, typeof(OPCITEMSTATE));
// update the UI
textBox11.Text = String.Format(&{0}&, pItemState.vDataValue);
// quality
//strSncQuality.Text = GetQuality(pItemState.wQuality);
// Time stamp - Date and time
//DateTime dt = ToDateTime(pItemState.ftTimeStamp);
//strSycTimeStamp.Text = dt.ToString();
String pstrE
pIOPCServer.GetErrorString(errors[1], LOCALE_ID, out pstrError);
MessageBox.Show(pstrError, &Result - Read Items&, MessageBoxButtons.OK, MessageBoxIcon.Error);
if (errors[2] == 0)
posr = new IntPtr(posr.ToInt32() + Marshal.SizeOf(typeof(OPCITEMSTATE)));
OPCITEMSTATE pItemState = (OPCITEMSTATE)Marshal.PtrToStructure(posr, typeof(OPCITEMSTATE));
// update the UI
textBox10.Text = String.Format(&{0}&, pItemState.vDataValue);
// quality
//strSncQuality.Text = GetQuality(pItemState.wQuality);
// Time stamp - Date and time
//DateTime dt = ToDateTime(pItemState.ftTimeStamp);
//strSycTimeStamp.Text = dt.ToString();
String pstrE
pIOPCServer.GetErrorString(errors[2], LOCALE_ID, out pstrError);
MessageBox.Show(pstrError, &Result - Read Items&, MessageBoxButtons.OK, MessageBoxIcon.Error);
if (errors[3] == 0)
posr = new IntPtr(posr.ToInt32() + Marshal.SizeOf(typeof(OPCITEMSTATE)));
OPCITEMSTATE pItemState = (OPCITEMSTATE)Marshal.PtrToStructure(posr, typeof(OPCITEMSTATE));
// update the UI
textBox9.Text = String.Format(&{0}&, pItemState.vDataValue);
// quality
//strSncQuality.Text = GetQuality(pItemState.wQuality);
// Time stamp - Date and time
//DateTime dt = ToDateTime(pItemState.ftTimeStamp);
//strSycTimeStamp.Text = dt.ToString();
String pstrE
pIOPCServer.GetErrorString(errors[3], LOCALE_ID, out pstrError);
MessageBox.Show(pstrError, &Result - Read Items&, MessageBoxButtons.OK, MessageBoxIcon.Error);
if (errors[4] == 0)
posr = new IntPtr(posr.ToInt32() + Marshal.SizeOf(typeof(OPCITEMSTATE)));
OPCITEMSTATE pItemState = (OPCITEMSTATE)Marshal.PtrToStructure(posr, typeof(OPCITEMSTATE));
// update the UI
textBox8.Text = String.Format(&{0}&, pItemState.vDataValue);
// quality
//strSncQuality.Text = GetQuality(pItemState.wQuality);
// Time stamp - Date and time
//DateTime dt = ToDateTime(pItemState.ftTimeStamp);
//strSycTimeStamp.Text = dt.ToString();
String pstrE
pIOPCServer.GetErrorString(errors[4], LOCALE_ID, out pstrError);
MessageBox.Show(pstrError, &Result - Read Items&, MessageBoxButtons.OK, MessageBoxIcon.Error);
catch (System.Exception error)
MessageBox.Show(error.Message, &Result - Read Items&, MessageBoxButtons.OK, MessageBoxIcon.Error);
// Free the unmanaged memory
if (pItemValues != IntPtr.Zero)
Marshal.FreeCoTaskMem(pItemValues);
pItemValues = IntPtr.Z
if (pErrors != IntPtr.Zero)
Marshal.FreeCoTaskMem(pErrors);
pErrors = IntPtr.Z
private void button3_Click(object sender, EventArgs e)//断开连接
chkGroupActive.Checked =
if (dwCookie != 0)
pIConnectionPoint.Unadvise(dwCookie);
dwCookie = 0;
// Free unmanaged code
Marshal.ReleaseComObject(pIConnectionPoint);
pIConnectionPoint =
Marshal.ReleaseComObject(pIConnectionPointContainer);
pIConnectionPointContainer =
if (pIOPCSyncIO != null)
Marshal.ReleaseComObject(pIOPCSyncIO);
pIOPCSyncIO =
if (pIOPCGroupStateMgt != null)
Marshal.ReleaseComObject(pIOPCGroupStateMgt);
pIOPCGroupStateMgt =
if (pobjGroup1 != null)
Marshal.ReleaseComObject(pobjGroup1);
pobjGroup1 =
if (pIOPCServer != null)
Marshal.ReleaseComObject(pIOPCServer);
pIOPCServer =
MessageBox.Show(&连接已断开!&);
button1.Enabled =
button2.Enabled =
button3.Enabled =
button4.Enabled =
chkGroupActive.Enabled =
private void InitReqIOInterfaces()
//Query interface for async calls on group object
pIOPCAsyncIO2 = (IOPCAsyncIO2)pobjGroup1;
pIOPCGroupStateMgt = (IOPCGroupStateMgt)pobjGroup1;
// Query interface for callbacks on group object
pIConnectionPointContainer = (IConnectionPointContainer)pobjGroup1;
// Establish Callback for all async operations
Guid iid = typeof(IOPCDataCallback).GUID;
pIConnectionPointContainer.FindConnectionPoint(ref iid, out pIConnectionPoint);
// Creates a connection between the OPC servers's connection point and
// this client's sink (the callback object).
pIConnectionPoint.Advise(this, out dwCookie);
public virtual void OnDataChange(Int32 dwTransid,
Int32 hGroup,
Int32 hrMasterquality,
Int32 hrMastererror,
Int32 dwCount,
int[] phClientItems,
object[] pvValues,
short[] pwQualities,
OpcRcw.Da.FILETIME[] pftTimeStamps,
int[] pErrors)
for (int nCount = 0; nCount & dwC nCount++)
//get the values of item 0
if (pErrors[nCount] == 0)
if (phClientItems[nCount] == 1)// if client handel is 1 i.e. for item 0
textBox12.Text = Convert.ToString(pvValues[nCount]);
// Quality
//strOnDataQu_1.Text =
GetQuality(pwQualities[nCount]);
// Timestamp
//DateTime dt = ToDateTime(pftTimeStamps[nCount]);
//strOnDataTS_1.Text = dt.ToString();
//get the values of item 1
if (phClientItems[nCount] == 2) // if client handel is 2 i.e. for item 0
textBox11.Text = Convert.ToString(pvValues[nCount]);
if (phClientItems[nCount] == 3) // if client handel is 3 i.e. for item 0
textBox10.Text = Convert.ToString(pvValues[nCount]);
if (phClientItems[nCount] == 4) // if client handel is 4 i.e. for item 0
textBox9.Text = Convert.ToString(pvValues[nCount]);
if (phClientItems[nCount] == 5) // if client handel is 5 i.e. for item 0
textBox8.Text = Convert.ToString(pvValues[nCount]);
String strItemE
pIOPCServer.GetErrorString(pErrors[0], LOCALE_ID, out strItemErr);
MessageBox.Show(strItemErr, &OnDataChange-Error&, MessageBoxButtons.OK, MessageBoxIcon.Error);
catch (System.Exception exp)
MessageBox.Show(exp.Message, &OnDataChange-Runtime Error&, MessageBoxButtons.OK, MessageBoxIcon.Error);
public virtual void OnReadComplete(System.Int32 dwTransid,
System.Int32 hGroup,
System.Int32 hrMasterquality,
System.Int32 hrMastererror,
System.Int32 dwCount,
int[] phClientItems,
object[] pvValues,
short[] pwQualities,
OpcRcw.Da.FILETIME[] pftTimeStamps,
int[] pErrors)
if (pErrors[0] == 0)
//strAReadVal.Text = String.Format(&{0}&, pvValues[0]);
// Quality
//strAReadQuality.Text = GetQuality(pwQualities[0]);
// Timestamp
//DateTime dt = ToDateTime(pftTimeStamps[0]);
//strAReadTimeStp.Text = dt.ToString();
String strResult = &&;
pIOPCServer.GetErrorString(pErrors[0], LOCALE_ID, out strResult);
MessageBox.Show(strResult, &Result - OnReadCOmpleate&, MessageBoxButtons.OK, MessageBoxIcon.Error);
public virtual void OnWriteComplete(System.Int32 dwTransid,
System.Int32 hGroup,
System.Int32 hrMastererr,
System.Int32 dwCount,
int[] pClienthandles,
int[] pErrors)
String strResult = &&;
pIOPCServer.GetErrorString(pErrors[0], LOCALE_ID, out strResult);
//strWriteResult.Text = strR
public virtual void OnCancelComplete(System.Int32 dwTransid, System.Int32 hGroup)
// Not implemented in this sample.
private void Form1_Load(object sender, EventArgs e)
button1.Enabled =
button2.Enabled =
button3.Enabled =
button4.Enabled =
chkGroupActive.Enabled
CheckForIllegalCrossThreadCalls =
private void checkBox1_CheckedChanged(object sender, EventArgs e)
IntPtr pRequestedUpdateRate = IntPtr.Z
int nRevUpdateRate = 0;
IntPtr hClientGroup = IntPtr.Z
IntPtr pTimeBias = IntPtr.Z
IntPtr pDeadband = IntPtr.Z
IntPtr pLCID = IntPtr.Z
int nActive = 0;
// activates or deactivates group according to checkbox status
GCHandle hActive = GCHandle.Alloc(nActive, GCHandleType.Pinned);
if (chkGroupActive.Checked != true)
hActive.Target = 0;
hActive.Target = 1;
pIOPCGroupStateMgt.SetState(pRequestedUpdateRate, out nRevUpdateRate, hActive.AddrOfPinnedObject(), pTimeBias, pDeadband, pLCID, hClientGroup);
catch (System.Exception error)
MessageBox.Show(error.Message, &Result-Change Group State&, MessageBoxButtons.OK, MessageBoxIcon.Error);
hActive.Free();
c# opc客户端开发_计算机软件及应用_IT/计算机_专业资料。c#开发的单线程OPC客户端 using S usingSystem.Collections.G usingSystem.ComponentM ...其实这个示例代码是有问题的,也就是说 DCB 结构体声明的有问题,虽然该代码可以...VC#编程不需要使用该程序,但熟悉 使用 OPC Scout 有利于了解 Simatic Net 中...基于Visual C#的OPC客户端实现 - 摘要:OPC是连接数据源(OPC服务器)和数据的使用者(OPC应用程序)之间的软件接口标准。这里以C#为开发工具,按照OPC技术的规范标准,...c# OPC_专业资料。通过OPC访问PLC 0 推荐 1、 OPC 服务介绍 西门子提供的最新...这里举例 说明,读者也可以使用 OPC Scout 创建变量,学习程序是如何生成变量名的...OPC 服务器: 开发工具: 当前环境: 源码: ///摘要 ///程式使用 C#.NET 2005...update: 1、例子代码下载地址:点击下载 2、客户端连接 OPC 服务器注意事项: a...运用VC#编程通过OPC方式实现PC机与西门子PLC通讯_计算机硬件及网络_IT/计算机_专业...这里举例说明,读者也可以使用 OPC Scout 创建变量,学习程序是如何生成变量名的。...龙源期刊网 http://www.qikan.com.cn 使用 C#开发 OPCClient 的研究和应用 作者:张晓科 来源:《科技资讯》2013 年第 02 期 摘要:本文详细介绍了 OPC 的各种...OPCDAAuto.dll 的 C#使用方法浅析 使用方法浅析作者:臭臭的大佬 来源:博客园 发布时间: 08:48 阅读:2966 次 原文链接 [收藏] 上次研究了.Net ...关键词:OPC;OPC 接口;OPC 服务器;C# 0 引言 随着计算机技术和数字信号处理...生成一个 OPC 服务器的实例 OPCServerClass.Connect(&ICONICS.SimulatorOPCDA.2&...本文举例介绍如何配置 PC 站、与主机连接等步骤,通过 OPC Server 实现 上位机...而物流系统应用程序由昆船公司采用 C#程序设计,这样就产生了一 个问题,不同的...
All rights reserved Powered by
www.tceic.com
copyright &copyright 。文档资料库内容来自网络,如有侵犯请联系客服。}

我要回帖

更多关于 系统集成管理有用吗 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信