From c5764186c3ec23eb954463495b8fbd77e32b268c Mon Sep 17 00:00:00 2001
From: QuakeGod <QuakeGod@sina.com>
Date: 星期三, 01 二月 2023 10:58:10 +0800
Subject: [PATCH] radio add new device type

---
 Inc/KMachine.h |   84 ++++++++++++++++++++++++-----------------
 1 files changed, 49 insertions(+), 35 deletions(-)

diff --git a/Inc/KMachine.h b/Inc/KMachine.h
index e3fb8a4..e135092 100644
--- a/Inc/KMachine.h
+++ b/Inc/KMachine.h
@@ -49,18 +49,26 @@
 #define LoHofB(x) ((x)&0xf)
 #define HiHofB(x) (((x)>>4)&0xf)
 
-//  信息块
-//  工厂参数配置块
-//  用户/系统参数配置块
+//  淇℃伅鍧�
+//  宸ュ巶鍙傛暟閰嶇疆鍧�
+//  鐢ㄦ埛/绯荤粺鍙傛暟閰嶇疆鍧�
 //  
 //
 
 typedef struct tagInfoBlock
 {
-	USHORT nDeviceType;
-	USHORT ProgVer;
-	USHORT KLinkVer;
-	USHORT nCapacity;
+//	USHORT nBlockLenth;
+	USHORT nDeviceTypeVer;			//device type		x.y
+//	UCHAR nDevierVer;
+	USHORT ProgVer;					//prog version	x.y
+	USHORT KLinkVer;				//x.y
+	USHORT KBusVer;					//x.y
+//	USHORT KNetVer;					//x.y
+//	USHORT KWLVer;					//x.y
+	
+	UCHAR nCapacity1;				//	? K
+	UCHAR nCapacity2;				//	? k
+	
 	UCHAR nDInput;
 	UCHAR nDOutput;
 	UCHAR nAInput;
@@ -69,6 +77,12 @@
 	UCHAR nHOutput;
 	UCHAR nExt1;
 	UCHAR nExt2;
+	UCHAR nLogSize;
+	UCHAR nPorts;
+	UCHAR nManSize;
+	UCHAR nAbility;
+	UCHAR nSwitchBits;
+	
 	
 }stKMInfoBlock;
 
@@ -103,26 +117,26 @@
 
 enum enPortType
 {
-	PortType_Com = 0,	//计算机通讯
-	PortType_Gen = 1,	//通用通讯,自由口
-	PortType_KLink = 2, //Klink通讯
-	PortType_KBus = 3, 	//KBus通讯
-	PortType_KNet = 4, 	// KNet通讯
-	PortType_ModbusRTU = 5, //Modbus RTU 通讯
+	PortType_Com = 0,	//璁$畻鏈洪�氳
+	PortType_Gen = 1,	//閫氱敤閫氳锛岃嚜鐢卞彛
+	PortType_KLink = 2, //Klink閫氳
+	PortType_KBus = 3, 	//KBus閫氳
+	PortType_KNet = 4, 	// KNet閫氳
+	PortType_ModbusRTU = 5, //Modbus RTU 閫氳
 };
 
-//每个模块有 0/1/2/3/4/5/6/7/8个 通讯port
-//不限于 UART, 网口,无线,单总线等,都是port
-//甚至可以有虚拟的port
+//姣忎釜妯″潡鏈� 0/1/2/3/4/5/6/7/8涓� 閫氳port
+//涓嶉檺浜� UART, 缃戝彛锛屾棤绾匡紝鍗曟�荤嚎绛夛紝閮芥槸port
+//鐢氳嚦鍙互鏈夎櫄鎷熺殑port
 
 typedef struct tagPortStat
 {
-	UCHAR nWorking;			//工作中
-	UCHAR nStation;			//自己站号
-	UCHAR bBus;					//总线?,,全双工?
-	UCHAR bMaster;			//主机
-	UCHAR PortType;			//端口工作模式
-	UCHAR nDevices;			//连接的设备数量//不包括自己 //device list;
+	UCHAR nWorking;			//宸ヤ綔涓�
+	UCHAR nStation;			//鑷繁绔欏彿
+	UCHAR bBus;					//鎬荤嚎?,,鍏ㄥ弻宸�?
+	UCHAR bMaster;			//涓绘満
+	UCHAR PortType;			//绔彛宸ヤ綔妯″紡
+	UCHAR nDevices;			//杩炴帴鐨勮澶囨暟閲�//涓嶅寘鎷嚜宸� //device list;
 	
 }stPortStat,*pPortStat;
 
@@ -146,11 +160,11 @@
 
 typedef struct tagKMFuncParam
 {
-	USHORT EnablePLC:1;		//使能内部PLC功能
-	USHORT RunMode;				//工作模式
+	USHORT EnablePLC:1;		//浣胯兘鍐呴儴PLC鍔熻兘
+	USHORT RunMode;				//宸ヤ綔妯″紡
 }stKMFuncParam;
 
-// 输入输出地址映射
+// 杈撳叆杈撳嚭鍦板潃鏄犲皠
 
 typedef struct tagComPortParam			//4 Bytes
 {
@@ -190,7 +204,7 @@
 	USHORT workmode;									// SC1  // 2 Bytes 0=From jumper  
 	USHORT SwitchFunc;								// SC2  // 2 Bytes 
 	
-	USHORT OutMappings[6];										//12 Bytes //输出映射
+	USHORT OutMappings[6];										//12 Bytes //杈撳嚭鏄犲皠
 	
 	stComPortParam PortParams[2];							// 8 Bytes
 	stOutputHoldParam OutputParams[16];				//16 Bytes
@@ -237,7 +251,7 @@
 	
 }stFactData;
 */
-typedef struct tagFactoryData		//工厂量产参数,数据
+typedef struct tagFactoryData		//宸ュ巶閲忎骇鍙傛暟锛屾暟鎹�
 {
 	USHORT Sign1;
 	USHORT Seq1;
@@ -396,12 +410,12 @@
 	stTimer Timers[TOTALTIMERS];
 
 	union {
-	unsigned short WX[KLDataWXCount];		//本机的X和Y
+	unsigned short WX[KLDataWXCount];		//鏈満鐨刋鍜孻
 	unsigned char WXB[KLDataWXCount*2];	
 	};
 	union {
-	unsigned short WY[KLDataWYCount];		//本机的X和Y
-	unsigned char WYB[KLDataWYCount*2];		//本机的X和Y
+	unsigned short WY[KLDataWYCount];		//鏈満鐨刋鍜孻
+	unsigned char WYB[KLDataWYCount*2];		//鏈満鐨刋鍜孻
 	}; 
 	unsigned short WR[KLDataWRCount];
 	
@@ -412,7 +426,7 @@
 	unsigned short SV[KLDataSVCount];
 	
 	
-	unsigned short WLX[16];		//虚拟的X和Y,远程通讯时映射用。
+	unsigned short WLX[16];		//铏氭嫙鐨刋鍜孻锛岃繙绋嬮�氳鏃舵槧灏勭敤銆�
 	unsigned short WLY[16];
 	unsigned short WLR[16];	
 	unsigned short WSR[16];
@@ -423,10 +437,10 @@
 	unsigned char DTB[KLDataDTCount*2];
 };
 
-	// 配置寄存器
-	// 系统状态寄存器
-	// 特殊寄存器
-	// 调试,监控寄存器
+	// 閰嶇疆瀵勫瓨鍣�
+	// 绯荤粺鐘舵�佸瘎瀛樺櫒
+	// 鐗规畩瀵勫瓨鍣�
+	// 璋冭瘯锛岀洃鎺у瘎瀛樺櫒
 	union {
 		unsigned int SDD[KLDataSDTCount/2];
 		unsigned short SDT[KLDataSDTCount];

--
Gitblit v1.9.1