From 0fe6b074f3f3994d87af195f37e349a83e27882c Mon Sep 17 00:00:00 2001
From: QuakeGod <QuakeGod@sina.com>
Date: 星期六, 10 十二月 2022 16:55:40 +0800
Subject: [PATCH] FP0 fix utf8 char

---
 Src/PLCfunctions.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/Src/PLCfunctions.c b/Src/PLCfunctions.c
index fbee49a..f6acac0 100644
--- a/Src/PLCfunctions.c
+++ b/Src/PLCfunctions.c
@@ -372,6 +372,28 @@
 	return 0;
 }
 
+inline void SetAddrBit(unsigned short * pW, unsigned char bitAddr)
+{
+	(*pW)|=1<<(bitAddr&0xf);
+}
+
+inline void ResetBit(unsigned short * pW, unsigned char bitAddr)
+{
+	(*pW)&=~(1<<(bitAddr&0xf));
+}
+static inline void SetBitValue(unsigned short * pW, unsigned char bitAddr, unsigned char Value)
+{
+	if (Value)	{	SetAddrBit(pW, bitAddr);}
+	else {ResetBit(pW, bitAddr);}
+}
+
+static inline unsigned char GetBitValue(unsigned short W, unsigned char bitAddr)
+{
+	if (W&(1<<(bitAddr&0xf))) return 1;
+	else return 0;
+}
+
+
 int ProcessPLCBinProg(const stBinProg1 * pBinprog, int nStepSize)
 {
 	if (!PLCMem.bPLCRunning) return 0;
@@ -744,7 +766,7 @@
 			break;
 		}
 
-		lastScanInputVal = PLCMem.ProgTrace[CurPos];
+		lastScanInputVal =  PLCMem.ProgTrace[CurPos]; //GetBitValue(KMem.WDFs);
 		PLCMem.ProgTrace[CurPos] = KMem.CurVAL;
 		CurPos += nNextPos;
 	}

--
Gitblit v1.9.1