You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.8 KiB
C#
74 lines
1.8 KiB
C#
using Rs.Framework;
|
|
using Rs.Motion.Base;
|
|
using Rs.Motion.GugaoEcat;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Xml.Serialization;
|
|
|
|
namespace Rs.Motion.Ztm
|
|
{
|
|
/// <summary>
|
|
/// GLink卡
|
|
/// </summary>
|
|
[XmlInclude(typeof(ZtmIO))]
|
|
public class ZtmIOCard : IIOCard
|
|
{
|
|
[XmlIgnore]
|
|
public short MC { get; set; }
|
|
public void SetMc(short mc)
|
|
{
|
|
foreach (ZtmIO io in DOut)
|
|
{
|
|
io.mc = mc;
|
|
}
|
|
foreach (ZtmIO io in DIn)
|
|
{
|
|
io.mc = mc;
|
|
}
|
|
}
|
|
|
|
public void Init()
|
|
{
|
|
foreach (IIO iO in DIn)
|
|
{
|
|
((ZtmIO)iO).mc = MC;
|
|
}
|
|
|
|
foreach (IIO iO in DIn)
|
|
{
|
|
((ZtmIO)iO).mc = MC;
|
|
}
|
|
}
|
|
public override void Init(short cardID,ushort inCount, ushort outCount, ushort slaveNo)
|
|
{
|
|
for (ushort i = 0; i < outCount; i++)
|
|
{
|
|
ZtmIO io = new ZtmIO();
|
|
io.CardID = cardID;
|
|
io.Name = $"Ztm{cardID}_Out" + i;
|
|
io.Index = i;
|
|
io.SlaveNo = (ushort)slaveNo;
|
|
DOut.Add(io);
|
|
}
|
|
for (ushort i = 0; i < inCount; i++)
|
|
{
|
|
ZtmIO io = new ZtmIO();
|
|
io.CardID = cardID;
|
|
io.Name = $"Ztm{cardID}_In" + i;
|
|
io.Index = i;
|
|
io.SlaveNo = (ushort)slaveNo;
|
|
DIn.Add(io);
|
|
}
|
|
}
|
|
|
|
public override void Save()
|
|
{
|
|
string filename = $"config/motion/io/ztm{CardID}.xml";
|
|
XmlSerializerHelper.Instance.Serialize<ZtmIOCard>(filename, this);
|
|
}
|
|
}
|
|
}
|