资源简介
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
//引用Twincat.ads和Sustem.IO
using TwinCAT.Ads;
using System.IO;
using System.Runtime.InteropServices;
namespace writeread
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//定义所需变量
private bool writebool =false;
private bool readbool=false ;
private short writeint = 0;
private short readint = 0;
private int writelong = 0;
private int readlong = 0;
private float writereal = 0;
private float readreal = 0;
private double writelreal = 0;
private double readlreal = 0;
private string writestring = ““;
private string readstring = ““;
private int stringlen = 0;
//定义结构体类型
public struct structtype
{
public bool s1;
public bool dummy1;
public bool dummy2;
public bool dummy3;
public short s2 ;
public short dummy4;
public int s3 ;
public float s4;
public double s5 ;
}
//定义结构体类型
[StructLayout(LayoutKind.Sequential Pack = 1)]
public struct structtype1
{
[MarshalAs(UnmanagedType.I1)]
public bool s1;
// [MarshalAs(UnmanagedType.I2)]
public short s2;
// [MarshalAs(UnmanagedType.I4)]
public int s3;
// [MarshalAs(UnmanagedType.R4)]
public float s4;
// [MarshalAs(UnmanagedType.R8)]
public double s5;
}
//实例化结构体
private structtype structtest =new structtype ();
private structtype1 structtest1 = new structtype1();
//定义数组,含有五个元素
private short[] arraytest = new short[5];
//定义句柄变量
private int hvar = new int();
//通讯数据定义
private TcAdsClient tcclient;//定义通讯协议
private void Form1_Load(object sender EventArgs e)
{
//通讯协议
tcclient = new TcAdsClient();
tcclient.Connect(“192.168.1.107.1.1“851);
int i = 0;
}
//writebool
private void button1_Click(object sender EventArgs e)
{
if (writebool == true)
{
writebool = false;
}
else
{
writebool = true;
}
try
{
hvar = tcclient.CreateVariableHandle(“MAIN.BoolTest“);
tcclient.WriteAny(hvar writebool );
tcclient.DeleteVariableHandle(hvar);
}
catch (Exception er
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
..A..H. 57856 2021-01-06 15:20 c#程序\writeread\.vs\writeread\v14\.suo
..A..H. 57856 2020-12-30 17:19 c#程序\writeread\.vs\writeread\v15\.suo
文件 0 2020-12-30 17:19 c#程序\writeread\.vs\writeread\v15\Server\sqlite3\db.lock
文件 4096 2020-12-30 17:19 c#程序\writeread\.vs\writeread\v15\Server\sqlite3\storage.ide
文件 32768 2020-12-30 17:19 c#程序\writeread\.vs\writeread\v15\Server\sqlite3\storage.ide-shm
文件 593312 2020-12-30 17:19 c#程序\writeread\.vs\writeread\v15\Server\sqlite3\storage.ide-wal
文件 401408 2017-07-26 08:31 c#程序\writeread\writeread\bin\Debug\TwinCAT.Ads.dll
文件 1226008 2017-07-26 08:31 c#程序\writeread\writeread\bin\Debug\TwinCAT.Ads.xm
文件 27136 2019-12-02 11:00 c#程序\writeread\writeread\bin\Debug\writeread.exe
文件 36352 2019-12-02 11:00 c#程序\writeread\writeread\bin\Debug\writeread.pdb
文件 21680 2021-01-06 15:18 c#程序\writeread\writeread\bin\Debug\writeread.vshost.exe
文件 490 2019-03-19 12:46 c#程序\writeread\writeread\bin\Debug\writeread.vshost.exe.manifest
文件 15074 2020-07-27 09:09 c#程序\writeread\writeread\Form1.cs
文件 40119 2018-12-23 13:50 c#程序\writeread\writeread\Form1.Designer.cs
文件 6181 2018-12-23 13:50 c#程序\writeread\writeread\Form1.resx
文件 1209 2020-12-17 09:18 c#程序\writeread\writeread\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6222 2021-01-06 15:18 c#程序\writeread\writeread\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 32768 2011-07-10 21:41 c#程序\writeread\writeread\obj\Debug\Interop.TcAdsDll.dll
文件 4608 2015-06-09 15:55 c#程序\writeread\writeread\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
文件 42 2020-12-30 17:18 c#程序\writeread\writeread\obj\Debug\writeread.csproj.CoreCompileInputs.cache
文件 10430 2021-01-06 15:18 c#程序\writeread\writeread\obj\Debug\writeread.csproj.FileListAbsolute.txt
文件 847 2018-12-23 13:50 c#程序\writeread\writeread\obj\Debug\writeread.csproj.GenerateResource.Cache
文件 502 2011-07-10 21:41 c#程序\writeread\writeread\obj\Debug\writeread.csproj.ResolveComReference.cache
文件 21081 2020-12-30 17:18 c#程序\writeread\writeread\obj\Debug\writeread.csprojAssemblyReference.cache
文件 3771 2019-12-02 11:00 c#程序\writeread\writeread\obj\Debug\writeread.csprojResolveAssemblyReference.cache
文件 27136 2019-12-02 11:00 c#程序\writeread\writeread\obj\Debug\writeread.exe
文件 180 2019-12-02 11:00 c#程序\writeread\writeread\obj\Debug\writeread.Form1.resources
文件 36352 2019-12-02 11:00 c#程序\writeread\writeread\obj\Debug\writeread.pdb
文件 180 2019-12-02 11:00 c#程序\writeread\writeread\obj\Debug\writeread.Properties.Resources.resources
文件 481 2011-07-10 20:59 c#程序\writeread\writeread\Program.cs
............此处省略28个文件信息
- 上一篇:Ymodem窗体应用程序
- 下一篇:EMS企业进销存源码(附数据库)
相关资源
- 酒店房间管理(ListView)
- 明华URF-35H读卡器 C#读写源码 为大家
- c#读写PDF文件sql
- 基于C#与Mwic_32.dll编写的IC刷卡读写考
-
C# 读写xm
l类 -
读写xm
l源码 - VS 2008 C#读写excel文件
- C#读写EXCEl支持xlsx
- RFID仓储管理系统
- .net生成pdf 读写pdf文件包itextsharp 5.2
- c# 双缓冲 技术与
- C#23.net_经典400个
- ISO15693协议读写器开发源码
- C#Json文件读写修改类附带操作程序.
- C#使用CH341 SPI模块读写SD卡
- C#基于OPC服务器读写欧姆龙PLC数据
- C# mysql操作的最好demo+帮助文档
- 0237 C#通过OPC连接PLC读写数据源码.ra
- 蓝山人事管理系统winform版本+sql语句建
- C#网络编程实作教程
- TwinCAT3的HMI上位机
- npoi的excel读写代码C#实现,并用winfo
- PLC通讯实现-C#访问OPCUA实现读写PLC
- WPF各种动画效果例子252069
- DWGdirect.NET文档说明C# 读写CAD文件DWG格
- DWGdirect_NET文档说明C# .NET读写CAD文件
- C#版RFID无线射频识别系统
- C#网络应用编程第三版全书源码
- 读写锁源代码C#编写
- 非常好用的遗传算法 C#程序 源码 遗传
评论
共有 条评论