From 46996b55fed671525f1aaf01a29c8aa73662be9e Mon Sep 17 00:00:00 2001
From: darker <mr.darker@163.com>
Date: 星期六, 15 二月 2025 17:13:17 +0800
Subject: [PATCH] 1. 修复位读写,位读写的起始地址需要是8的倍数
---
SourceCode/Bond/Servo/CCLinkPerformance/PerformanceMelsec.h | 42 +++++++++++++++++++++---------------------
1 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/SourceCode/Bond/Servo/CCLinkPerformance/PerformanceMelsec.h b/SourceCode/Bond/Servo/CCLinkPerformance/PerformanceMelsec.h
index 903ca41..60dea51 100644
--- a/SourceCode/Bond/Servo/CCLinkPerformance/PerformanceMelsec.h
+++ b/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浣�)
};
// 鎺у埗浠g爜
@@ -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; // 缃戠粶缂栧彿锛歅LC鎵�杩炴帴鐨勭綉缁滅紪鍙凤紝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);
--
Gitblit v1.9.3