PLCDataStructure.cs 1023 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.InteropServices;
  5. using System.Text;
  6. using Aitex.Core.RT.IOCore;
  7. namespace Aitex.Triton160.RT.PLC
  8. {
  9. [StructLayout(LayoutKind.Sequential, Pack = 1)]
  10. public struct PLC_INPUT_DATA
  11. {
  12. [MarshalAs(UnmanagedType.ByValArray, SizeConst = IOGroupManager.DioBlockLength)]
  13. public Byte[] DI;
  14. [MarshalAs(UnmanagedType.ByValArray, SizeConst = IOGroupManager.AioBlockLength)]
  15. public float[] AI;
  16. }
  17. /// <summary>
  18. /// C#与PLC之间进行数据交换的结构体定义
  19. /// 采用TwinCAT ADS方式进行输入、输出区的数据更新
  20. /// </summary>
  21. [StructLayout(LayoutKind.Sequential, Pack = 1)]
  22. public struct PLC_OUTPUT_DATA
  23. {
  24. [MarshalAs(UnmanagedType.ByValArray, SizeConst = IOGroupManager.DioBlockLength)]
  25. public Byte[] DO;
  26. [MarshalAs(UnmanagedType.ByValArray, SizeConst = IOGroupManager.AioBlockLength)]
  27. public float[] AO;
  28. }
  29. }