91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

上位機與PLC通訊軟件(C#),里面包含所需要的三菱DLL,引用后直接使用,已經經過調試,接口可用,需要用MX_Component 軟件進行鏈接配置

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
using?System.Threading;




namespace?PLCconnect
{
????public??class?ConnectPLC?
????{

????????public?bool?isPLCConnected?=?false;
????????System.String[]?arrData?=?new?string[32];???????//Array?for?‘Data‘
????????public?short[]?arrDeviceValue?=?new?short[32];?????????//Data?for?‘DeviceValue‘????
????????public?int?iReturnCode?=?0;
????????object?plcLock?=?new?object();


????????/*The?declaration?of?instance?value?for?ACT?controls************************/
????????//?When?you?use?Dot?controls?by?‘References‘?you?should?program?as?follows;
????????public?ActUtlTypeLib.ActUtlType?lpcom_ReferencesUtlType?=?new?ActUtlTypeLib.ActUtlType();

????????//public?ConnectPLC()
????????//{
????????//????/*?Create?instance?for?ACT?Controls*************************************/
????????//????lpcom_ReferencesUtlType?=?new?ActUtlTypeLib.ActUtlType();
????????//????/*?Set?EventHandler?for?ACT?Controls************************************/
????????//????//?Create?EventHandler(ActUtlType)
???????????
????????//????/**************************************************************************/
????????//}


????????///?
????????///?斷開PLC連接
????????///?

????????public?void?ClosePLC()
????????{
????????????int?iReturnCode;????//Return?code

????????????//Displayed?output?data?is?cleared.

????????????//
????????????//Processing?of?Close?method
????????????//
????????????try
????????????{
????????????????//When?ActProgType?is?selected?by?the?radio?button

????????????????//The?Close?method?is?executed.
????????????????iReturnCode?=?lpcom_ReferencesUtlType.Close();

????????????????//When?The?Close?method?is?succeeded?enable?the?TextBox?of?‘LogocalStationNumber‘.
????????????????if?(iReturnCode?==?0)
????????????????{
????????????????????isPLCConnected?=?false;
????????????????}
????????????????lpcom_ReferencesUtlType?=?null;
????????????????//The?return?code?of?the?method?is?displayed?by?the?hexadecimal.

????????????}

????????????//Exception?processing
????????????catch?(Exception?exception)
????????????{
????????????????MessageBox.Show(exception.Message?““?MessageBoxButtons.OK?MessageBoxIcon.Error);
????????????????return;
????????????}
????????}


????????#region??“PLC連接“
????????public?void?connectPLC()
????????{
????????????int?iReturnCode;?????????????????????//Return?code
????????????int?iLogicalStationNumber?=?0;??????//LogicalStationNumber?for?ActUtlType?????
???????????
????????????//
????????????//Processing?of?Open?method
????????????//
????????????try
????????????{
????????????????//Set?the?value?of?‘LogicalStationNumber‘?to?the?property.
????????????????lpcom_ReferencesUtlType.ActLogicalStationNumber?=?iLogicalStationNumber;

??????

評論

共有 條評論