C#数据类型 全局变量 类型转换方法(汇总)

1、C#和S7-1200PLC S7.NET通信

C#和S7-1200PLC S7.NET通信-CSDN博客文章浏览阅读98次。一步步建立一个C#项目(连续读取S7-1200PLC数据)_s7协议批量读取-CSDN博客这篇博客作为C#的基础系列,和大家分享如何一步步建立一个C#项目完成对S7-1200PLC数据的连续读取。首先创建一个窗体应用。_s7协议批量读取C#开发编程软件下载安装-CSDN博客文章浏览阅读55次。。。。https://rxxw-control.blog.csdn.net/article/details/140894526

1、字符串+浮点数+数组

2、代码

cs 复制代码
public string position1;
public string position2;
public string position3;
public string position4;
public UInt32 diInput;
public List<string> arString =new List<string>(new string[6]);//字符串;
public List<float> arPosition = new List<float>(new float[6]);//位置数组元素个数=6;
public List<bool> arInput = new List<bool>(new bool[32]);//输入数组;
public bool bTemp0;

下面我们看下,在C#里如何建结构变量。

3、如何建立结构变量

4、代码

cs 复制代码
struct udtAxis //C#区分大小写,这里都是小写;
{
    public bool bEstop;//急停;
    public bool bPower;//使能;
    public bool bReset;//复位;
    public bool bHome;//回原;
    public bool bHalt;//暂停;
    public bool bLimit1;//正向超程;
    public bool bLimit2;//负向超程;
    public float rAbsVelocity;//绝对值定位运行速度;
    public float rPosition;//位置;
    public float rVelocity;//速度;
    public float rActPosition;//实际位置;
    public float rActVelocity;//实际速度;
}
  udtAxis Axis1 = new udtAxis();//建立轴1
  udtAxis Axis2 = new udtAxis();//建立轴2  

5、转为浮点数

。。。

相关推荐
future_studio20 小时前
聊聊 Unity(小白专享、C# 小程序 之 图片播放器)
unity·小程序·c#
mjhcsp21 小时前
MATLAB 疑难问题诊疗:从常见报错到深度优化的全流程指南
开发语言·matlab
Lynnxiaowen21 小时前
今天我们开始学习python语句和模块
linux·运维·开发语言·python·学习
逐步前行21 小时前
C标准库--浮点<float.h>
c语言·开发语言
zoyation21 小时前
多线程简介和在JAVA中应用
java·开发语言
余辉zmh21 小时前
【C++篇】:ServiceBus RPC 分布式服务总线框架项目
开发语言·c++·rpc
Tony Bai21 小时前
释放 Go 的极限潜能:CPU 缓存友好的数据结构设计指南
开发语言·后端·缓存·golang
仲夏幻境1 天前
js利用ajax同步调用如何
开发语言·javascript·ajax
aramae1 天前
详细分析平衡树--红黑树(万字长文/图文详解)
开发语言·数据结构·c++·笔记·算法
一百天成为python专家1 天前
python爬虫入门(小白五分钟从入门到精通)
开发语言·爬虫·python·opencv·yolo·计算机视觉·正则表达式