darker
2025-02-15 46996b55fed671525f1aaf01a29c8aa73662be9e
SourceCode/Bond/Servo/CCLinkPerformance/PerformanceMelsec.h
@@ -28,7 +28,7 @@
#define CC_LINK_IE_FIELD_CHANNEL(x) (180 + (x))   // x 范围:1~4
#define CC_LINK_IE_TSN_CHANNEL(x) (280 + (x))     // x 范围:1~4
// 自定义错误码
 // 自定义错误码
#define ERROR_CODE_UNKNOWN            0x00010000 // 未知
#define ERROR_CODE_NOT_CONNECTED      0x00020000 // 未连接
#define ERROR_CODE_INVALID_PARAM      0x00030000 // 参数无效
@@ -130,7 +130,7 @@
enum class DataType {
   BIT = 1,   // 位 (1位)
   WORD = 2,  // 字 (16位)
   DWORD =4   // 双字 (32位)
   DWORD = 4  // 双字 (32位)
};
// 控制代码
@@ -180,22 +180,22 @@
    * 1~239 表示普通网络号
    **/
   /*
    * [Station No.]
    * MELSECNET/H:1~64 表示其他站点,255 表示本站
    * CC-Link 系列网络的范围类似,区别在于站号的取值范围
    * MELSECNET/H             : 1~64(Other stations),255(Own station)
    * CC-Link                 : 0~63(Other stations),255(Own station)
    * CC-Link IE Controller   : 1~120(Other stations),255(Own station)
    * CC-Link IE Field        : 0~120(Other stations),255(Own station)
    * CC-Link IE TSN          : 0~120(Other stations),255(Own station)
    **/
    /*
     * [Station No.]
     * MELSECNET/H:1~64 表示其他站点,255 表示本站
     * CC-Link 系列网络的范围类似,区别在于站号的取值范围
     * MELSECNET/H             : 1~64(Other stations),255(Own station)
     * CC-Link                 : 0~63(Other stations),255(Own station)
     * CC-Link IE Controller   : 1~120(Other stations),255(Own station)
     * CC-Link IE Field        : 0~120(Other stations),255(Own station)
     * CC-Link IE TSN          : 0~120(Other stations),255(Own station)
     **/
   /*
    * 高 8 位(网络号): 指定设备所属的网络
    * 低 8 位(站点号): 指定设备在网络中的编号
    * 用一个参数传递设备的网络号和站点号时: nSt = station.nStNo | ((station.nNetNo << 8) & 0xFF00);
    **/
     /*
      * 高 8 位(网络号): 指定设备所属的网络
      * 低 8 位(站点号): 指定设备在网络中的编号
      * 用一个参数传递设备的网络号和站点号时: nSt = station.nStNo | ((station.nNetNo << 8) & 0xFF00);
      **/
   short nNetNo = 0;    // 网络编号:PLC所连接的网络编号,0表示默认网络
   short nStNo = 255;   // 站点编号:指定与PLC连接的站点编号,255通常表示广播或所有站点
@@ -211,13 +211,13 @@
   // 重载 < 运算符(用于排序或比较,通常用于 map 或 set 中作为 key)
   bool operator<(const StationIdentifier& other) const {
      return std::tie(nNetNo, nStNo) <
            std::tie(other.nNetNo, other.nStNo);
         std::tie(other.nNetNo, other.nStNo);
   }
   // 重载 == 运算符(用于相等比较)
   bool operator==(const StationIdentifier& other) const {
      return std::tie(nNetNo, nStNo) ==
            std::tie(other.nNetNo, other.nStNo);
         std::tie(other.nNetNo, other.nStNo);
   }
   // 重载 = 运算符(用于赋值)
@@ -330,7 +330,7 @@
   }
};
using BitContainer = std::vector<uint8_t>;      // 每个元素存储 8 个位
using BitContainer = std::vector<bool>;         // 每个元素存储 1  位
using WordContainer = std::vector<uint16_t>;   // 每个元素存储 16 位
using DWordContainer = std::vector<uint32_t>;   // 每个元素存储 32 位
@@ -435,7 +435,7 @@
   // 容器转换
   static void ConvertCharToShort(const std::vector<char>& vecChar, std::vector<short>& vecShort);
   static void ConvertShortToChar(const std::vector<short>& vecShort, std::vector<char>&vecChar);
   static void ConvertShortToChar(const std::vector<short>& vecShort, std::vector<char>& vecChar);
   static void ConvertUint8ToShort(const std::vector<uint8_t>& vecUint8, std::vector<short>& vecShort);
   static void ConvertShortToUint8(const std::vector<short>& vecShort, std::vector<uint8_t>& vecUint8);
   static void ConvertUint32ToShort(const std::vector<uint32_t>& vecUint32, std::vector<short>& vecShort);