From df03213660361b1c771f0a3f21b6ddaeaef7763a Mon Sep 17 00:00:00 2001
From: QuakeGod <quakegod@sina.com>
Date: 星期二, 05 九月 2023 11:44:52 +0800
Subject: [PATCH] add ladder to prog 1

---
 MTerm1/CMyPaneInputShow.h                               |   21 
 MTerm1/0prog4.kpg                                       |  187 +
 ConfigTool/ConfigTool.rc                                |    0 
 ConfigTool/resource.h                                   |    1 
 ConsoleApplication1/ConsoleApplication1.vcxproj.filters |   22 
 MTerm1/CMyFuncKeyToolBar.cpp                            |    6 
 MTerm1/MyDlgBarInputShow.cpp                            |  946 --------
 ConfigTool/ConfigToolView.cpp                           |    4 
 MTerm1/MTerm1View.cpp                                   |  109 
 KLink1/KLink1.vcxproj                                   |   10 
 MTerm1/CMyFuncKeyToolBar.h                              |    4 
 MTerm1.sln                                              |   16 
 ConsoleApplication1/ConsoleApplication1.cpp             |   86 
 KLink1/Resource.h                                       |    3 
 MTerm1/MainFrm.h                                        |   51 
 LCDDisplay/LCDDisplay.rc                                |    0 
 MTerm1/DialogEventLog.cpp                               |    2 
 KLink1/CDialogCommSet1.h                                |    2 
 MTerm2/MTerm2.vcxproj                                   |   10 
 MTerm1/MTerm1.rc                                        |    0 
 KLink1/KLink.cpp                                        |   10 
 MFCApplication3/MFCApplication3.vcxproj                 |   10 
 ConfigTool/ConfigTool.vcxproj                           |   10 
 MTerm1/CMyPaneInputShow.cpp                             |  101 
 MTerm1/MainFrm.cpp                                      |  265 --
 KLink3/KLink3.vcxproj                                   |   10 
 MTerm1/MyFormInputShow.h                                |  242 ++
 MTerm1/0prog2.kpg                                       |   44 
 ConfigTool/DeviceList.ini                               |    4 
 MTerm1/MTerm1Doc.cpp                                    |  443 +++
 KLink1/CDialogCommSet1.cpp                              |   18 
 MTerm1/MTerm1.vcxproj                                   |   18 
 ConsoleApplication1/ConsoleApplication1.vcxproj         |  147 +
 MTerm1/0prog5.kpg                                       |   43 
 MTerm1/Resource.h                                       |    7 
 MultiTerminal1/MultiTerminal1.vcxproj                   |   10 
 MTerm1/MTerm1View.h                                     |   39 
 ConfigTool/CChidSysCfg1.cpp                             |    4 
 LCDDisplay/LCDDisplay.vcxproj                           |   10 
 MTerm1/MyFormInputShow.cpp                              | 3414 ++++++++++++++++++++++++++++++++
 KLink1/KLink1.rc                                        |    0 
 KLink1/HvSerialPort.cpp                                 |    2 
 MTerm1/MTerm1.vcxproj.filters                           |   12 
 KLink1/KLink.h                                          |    5 
 44 files changed, 4,997 insertions(+), 1,351 deletions(-)

diff --git a/ConfigTool/CChidSysCfg1.cpp b/ConfigTool/CChidSysCfg1.cpp
index 11a2a5f..2b5e7d0 100644
--- a/ConfigTool/CChidSysCfg1.cpp
+++ b/ConfigTool/CChidSysCfg1.cpp
@@ -251,7 +251,7 @@
 // ---------  宸ヤ綔妯″紡  ---------------------------------------
 //宸ヤ綔妯″紡锛岃烦绾垮姛鑳界瓑锛実ood 鎸囩ず鐏�
 //
-
+	((CComboBox*)GetDlgItem(IDC_COMBO_WORKMODE))->SetCurSel(psyscfg->workmode);
 // -----------------------------------------------------------
 //----------  閫氳绔彛1锛孯S232  -----------------------------
 /*
@@ -367,6 +367,8 @@
 	CString s1;
 	s1.Format(_T("GetParams"));
 	SysLog(s1);
+	psyscfg->workmode = ((CComboBox*)GetDlgItem(IDC_COMBO_WORKMODE))->GetCurSel();
+
 	for (int i = 0; i < 6; i++) {
 		unsigned char ntype = ((CComboBox *)GetDlgItem(type_ctrl_ids[i]))->GetCurSel();
 		unsigned char byteaddr = ((CComboBox *)GetDlgItem(addr_ctrl_ids[i]))->GetCurSel();
diff --git a/ConfigTool/ConfigTool.rc b/ConfigTool/ConfigTool.rc
index 8b2cbd6..33d77cf 100644
--- a/ConfigTool/ConfigTool.rc
+++ b/ConfigTool/ConfigTool.rc
Binary files differ
diff --git a/ConfigTool/ConfigTool.vcxproj b/ConfigTool/ConfigTool.vcxproj
index 3d84871..7dfedfa 100644
--- a/ConfigTool/ConfigTool.vcxproj
+++ b/ConfigTool/ConfigTool.vcxproj
@@ -23,20 +23,20 @@
     <ProjectGuid>{E60A8A23-131E-49E5-B61E-C374C721ACBA}</ProjectGuid>
     <Keyword>MFCProj</Keyword>
     <RootNamespace>ConfigTool</RootNamespace>
-    <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
@@ -44,14 +44,14 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
diff --git a/ConfigTool/ConfigToolView.cpp b/ConfigTool/ConfigToolView.cpp
index 45f4659..7a11b2c 100644
--- a/ConfigTool/ConfigToolView.cpp
+++ b/ConfigTool/ConfigToolView.cpp
@@ -660,8 +660,8 @@
 	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
 	CString s1;
 	
-	int res = ((CConfigToolDoc *)m_pDocument)->MyKlink.SetCommParam();
-	s1.Format(_T("Com Set = %d "),res);
+	int res = GetDocument()->MyKlink.SetCommParam();
+	s1.Format(_T("Com Set = %d  COM%d %d %s"),res, GetDocument()->MyKlink.m_nPort, GetDocument()->MyKlink.m_nBaudRate, GetDocument()->MyKlink.m_Settings);
 	SysLog(s1);
 }
 
diff --git a/ConfigTool/DeviceList.ini b/ConfigTool/DeviceList.ini
index 3f07681..f7a5f76 100644
--- a/ConfigTool/DeviceList.ini
+++ b/ConfigTool/DeviceList.ini
@@ -6,8 +6,8 @@
 04=8入8出 模块,旧版,排线
 05=16入16出 主机 旧版 黑色端子
 06=8入8出 模块 旧版 黑色端子
-07=16入16出 模块 旧版绿色端子
-08=8入8出 模块 旧版绿色端子
+07=16入16出 模块 旧版黑色端子
+08=8入8出 模块 旧版黑色端子
 09=16入16出 模块 新版绿色端子
 0A=8入8出 模块 新版绿色端子
 0B=8入8从 Mini
diff --git a/ConfigTool/resource.h b/ConfigTool/resource.h
index bb88214..761f94d 100644
--- a/ConfigTool/resource.h
+++ b/ConfigTool/resource.h
@@ -176,6 +176,7 @@
 #define IDC_BUTTON_RELOAD               1086
 #define IDC_COMBO_BAUDRATE1             1086
 #define IDC_COMBO4                      1087
+#define IDC_COMBO_WORKMODE              1087
 #define IDC_EDIT_END_TIME2              1088
 #define IDC_COMBO_WORKMODE1             1089
 #define IDC_COMBO_WORKMODE2             1090
diff --git a/ConsoleApplication1/ConsoleApplication1.cpp b/ConsoleApplication1/ConsoleApplication1.cpp
new file mode 100644
index 0000000..1122025
--- /dev/null
+++ b/ConsoleApplication1/ConsoleApplication1.cpp
@@ -0,0 +1,86 @@
+// ConsoleApplication1.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
+//
+
+#include <iostream>
+#include <stdio.h>
+#include <stdlib.h>
+const char str1[] =
+"1+--------------------------------------------------------------------------+\r\n" \
+"2|       1         2     BIKE  Develope V1.00    5         6         7      |\r\n" \
+"3|34567890123456789012345678901234567890123456789012345678901234567890123456|\r\n" \
+"4+-------------------+------------------+-----------------------------------+\r\n" \
+"5| 电池: --.--V 高压: --.--V 差: --.--V | LED --------    AD采集            |\r\n" \
+"6+-------------------+------------------+ 通道  值  电压    通道  值  电压  |\r\n" \
+"7| 转把  _---  -.--V     霍耳  - - -    |  0  _---  -.--V    4  _---  -.--V |\r\n" \
+"8| 低 _---  高 _---                     |  1  _---  -.--V    5  _---  -.--V |\r\n" \
+"9| PWM    ---  --.-%     驱动  - - -    |  2  _---  -.--V    6  _---  -.--V |\r\n" \
+"0|               错误 - - -    - - -    |  3  _---  -.--V    7  _---  -.--V |\r\n" \
+"1+--------------------------------------+-----------------------------------|\r\n" \
+"2| 电机极对数: ---  车轮周长:--- CM    |  电机电流 --.-- A                 |\r\n" \
+"3| 转速: ---- p/s  ---- r/m  --.-- Km/H | FPLL --------                     |\r\n" \
+"4+--------------------------------------+-----------------------------------+\r\n";
+
+
+
+int aa[] = { 1,2,3,10,100,25,33,67,99,12,9,88,10,29,-1,-10,5000,666,888,999,6666 };
+
+
+void sort(int pdata[], int len)
+{
+    for (int i = 0; i < len-1; i++)   {
+        for (int j = i + 1; j < len; j++)   {
+            if (pdata[i] > pdata[j]) { 
+                int c = pdata[i]; 
+                pdata[i] = pdata[j]; 
+                pdata[j] = c; }
+        }
+    }
+    return;
+}
+
+void display(int pdata[], int len)
+{
+
+    for (int i = 0; i < len; i++)
+    {
+        printf(" %d ", pdata[i]);
+    }
+    printf("\r\n");
+    return;
+}
+
+void fun1()
+{
+
+    // printf("\033[10;10H\033[33;44m abcdefg\033[0m");
+    for (int i = 0; i < 10000; i++)
+    {
+
+        printf("\033[%d;1H\033[2K %d \033[33;44m\r\n", (i / 1000) + 1, i);
+        printf("%s", str1);
+    }
+}
+int main()
+{
+    std::cout << " Hello World! \n "<< sizeof(aa) << " " << sizeof(int) << " " << _countof(aa) << " \n";
+
+    display(aa, _countof(aa));
+
+    sort(aa, _countof(aa));
+
+    display(aa, _countof(aa));
+
+   ;
+
+}
+
+// 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单
+// 调试程序: F5 或调试 >“开始调试”菜单
+
+// 入门使用技巧: 
+//   1. 使用解决方案资源管理器窗口添加/管理文件
+//   2. 使用团队资源管理器窗口连接到源代码管理
+//   3. 使用输出窗口查看生成输出和其他消息
+//   4. 使用错误列表窗口查看错误
+//   5. 转到“项目”>“添加新项”以创建新的代码文件,或转到“项目”>“添加现有项”以将现有代码文件添加到项目
+//   6. 将来,若要再次打开此项目,请转到“文件”>“打开”>“项目”并选择 .sln 文件
diff --git a/ConsoleApplication1/ConsoleApplication1.vcxproj b/ConsoleApplication1/ConsoleApplication1.vcxproj
new file mode 100644
index 0000000..c9fad22
--- /dev/null
+++ b/ConsoleApplication1/ConsoleApplication1.vcxproj
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <VCProjectVersion>16.0</VCProjectVersion>
+    <Keyword>Win32Proj</Keyword>
+    <ProjectGuid>{83c17606-596d-4072-83a2-0c634c20e742}</ProjectGuid>
+    <RootNamespace>ConsoleApplication1</RootNamespace>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="ConsoleApplication1.cpp" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/ConsoleApplication1/ConsoleApplication1.vcxproj.filters b/ConsoleApplication1/ConsoleApplication1.vcxproj.filters
new file mode 100644
index 0000000..e63e2ac
--- /dev/null
+++ b/ConsoleApplication1/ConsoleApplication1.vcxproj.filters
@@ -0,0 +1,22 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="婧愭枃浠�">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="澶存枃浠�">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
+    </Filter>
+    <Filter Include="璧勬簮鏂囦欢">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="ConsoleApplication1.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/KLink1/CDialogCommSet1.cpp b/KLink1/CDialogCommSet1.cpp
index 44249b5..ed90bee 100644
--- a/KLink1/CDialogCommSet1.cpp
+++ b/KLink1/CDialogCommSet1.cpp
@@ -101,13 +101,19 @@
 	for (int i = 1; i <= 16; i++)
 	{
 		s1.Format(_T("COM%d"), i);
-		if (get_com_name(s1, s2)) s1 = s2;
+		if (get_com_name(s1, s2)) { s1 = s2; }
 		m_combo_comport.AddString(s1);
 	}
-	sComSelStr = _T("COM3");
+	// sComSelStr = _T("COM3");
 	m_combo_comport.SelectString(0, sComSelStr);
-	m_combo_comport.SetCurSel(2);
+	// m_combo_comport.SetCurSel(2);
+	if (m_nComNum >0)
+		m_combo_comport.SetCurSel(m_nComNum - 1);
+	else {
+		m_combo_comport.SetCurSel(0);
+	}
 	return 0;
+
 	HKEY   hKey;
 	if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Hardware\\DeviceMap\\SerialComm"), NULL, KEY_READ, &hKey) == ERROR_SUCCESS)
 	{
@@ -151,7 +157,7 @@
 	// TODO: 鍦ㄦ澶勬坊鍔犲疄鐜颁唬鐮�.
 	((CComboBox *)GetDlgItem(IDC_COMBO_NETWORK_TYPE))->SetCurSel(0);
 	((CComboBox *)GetDlgItem(IDC_COMBO_PORT))->SetCurSel(0);
-	((CComboBox *)GetDlgItem(IDC_COMBO_BAUD))->SetCurSel(8);
+	((CComboBox *)GetDlgItem(IDC_COMBO_BAUD))->SetCurSel(7);
 
 	((CButton *)GetDlgItem(IDC_RADIO_DATA_LENGTH_8B))->SetCheck(1);
 
@@ -165,6 +171,10 @@
 	((CButton *)GetDlgItem(IDC_CHECK_AUTO_PARITY))->SetCheck(1);
 
 	UpdateComPortList();
+
+	CString s1;
+	if (m_bOpened) s1 = _T("宸茶繛鎺�"); else s1 = _T("鏈繛鎺�");
+	((CStatic*)GetDlgItem(IDC_STATIC_STATE))->SetWindowText(s1);
 	return 0;
 }
 
diff --git a/KLink1/CDialogCommSet1.h b/KLink1/CDialogCommSet1.h
index abd8f1a..937b484 100644
--- a/KLink1/CDialogCommSet1.h
+++ b/KLink1/CDialogCommSet1.h
@@ -29,6 +29,8 @@
 	int UpdateComPortList();
 	CComboBox m_combo_comport;
 	CString sComSelStr;
+	bool m_bOpened = false;
+	int nLastComPort = 0;
 	int m_nComNum;
 	int m_nBaudRate;
 	CStringA m_Settings;
diff --git a/KLink1/HvSerialPort.cpp b/KLink1/HvSerialPort.cpp
index fb34532..ba2169f 100644
--- a/KLink1/HvSerialPort.cpp
+++ b/KLink1/HvSerialPort.cpp
@@ -30,7 +30,7 @@
 	if (this->m_bOpened) 
 	{ 
 		m_strResult.Format(_T("COM%d already Opened"),m_nPort);
-		return R_ERR;
+		return R_OK;
 	}
 	ComPortName.Format(_T("\\\\.\\COM%d"), this->m_nPort);
 	hCom1 = CreateFile(ComPortName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);//FILE_ATTRIBUTE_NORMAL|FILE_FLAG_OVERLAPPED
diff --git a/KLink1/KLink.cpp b/KLink1/KLink.cpp
index cb0eed8..b921e64 100644
--- a/KLink1/KLink.cpp
+++ b/KLink1/KLink.cpp
@@ -136,6 +136,13 @@
 		//	dlg.DoModal();
 	*/
 	CDialogCommSet1 dialog1;
+	if (m_bCommParamSet)
+	{
+		dialog1.m_nComNum = m_nPort;
+		dialog1.m_nBaudRate = m_nBaudRate;
+		dialog1.m_Settings = m_Settings;
+		dialog1.m_bOpened = m_bOpened;
+	}
 	INT_PTR r = dialog1.DoModal();
 	//方法2的状态还原
 
@@ -1187,7 +1194,7 @@
 	return res;
 }
 
-int KLink1::GetMode(UCHAR nDst, UCHAR nType)
+int KLink1::GetMode(UCHAR nDst, UCHAR nType, UCHAR * value)
 {
 	int res = KL_OK;
 	//	res = ReadDataByte(nDst, 4, KLDataTypeSDT, 36, (UCHAR *)pValue);
@@ -1201,6 +1208,7 @@
 	unsigned char nCmd;
 	unsigned short nnCount = 0;
 	res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, m_DataBuf);
+	if (nnCount > 0) { *value = m_DataBuf[0]; }
 	return res;
 
 }
diff --git a/KLink1/KLink.h b/KLink1/KLink.h
index aa61b0a..22c0fb2 100644
--- a/KLink1/KLink.h
+++ b/KLink1/KLink.h
@@ -226,7 +226,8 @@
 		volatile unsigned short WorkMode2;
 		volatile unsigned short nBinProgBank;
 		volatile unsigned short nBinProgSize;
-		unsigned int Reserved2[1];
+		unsigned short bLEDFlick;
+		unsigned short Reserved2[1];
 		unsigned short CRC1;
 		unsigned short EndSign1;
 	}stRunStat, *pRunStat;
@@ -650,7 +651,7 @@
 	int ReadData(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT * nByteRead, USHORT * Values);
 	int WriteData(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT * Values);
 
-	int GetMode(UCHAR nDst, UCHAR nType);
+	int GetMode(UCHAR nDst, UCHAR nType, UCHAR* value);
 	int ChangeMode(UCHAR nDst, UCHAR nType);
 
 	int BlinkLED(UCHAR nDst, UCHAR nSecond);
diff --git a/KLink1/KLink1.rc b/KLink1/KLink1.rc
index 49cbd53..c800826 100644
--- a/KLink1/KLink1.rc
+++ b/KLink1/KLink1.rc
Binary files differ
diff --git a/KLink1/KLink1.vcxproj b/KLink1/KLink1.vcxproj
index ca340be..4ebbf29 100644
--- a/KLink1/KLink1.vcxproj
+++ b/KLink1/KLink1.vcxproj
@@ -23,21 +23,21 @@
     <ProjectGuid>{1F782E34-9087-4F87-9674-E4BDAA319726}</ProjectGuid>
     <Keyword>MFCDLLProj</Keyword>
     <RootNamespace>KLink1</RootNamespace>
-    <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
     <ProjectName>KLink1</ProjectName>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
@@ -45,14 +45,14 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
diff --git a/KLink1/Resource.h b/KLink1/Resource.h
index 1672929..cce282e 100644
--- a/KLink1/Resource.h
+++ b/KLink1/Resource.h
@@ -4,6 +4,7 @@
 //
 #define IDP_SOCKETS_INIT_FAILED         104
 #define IDD_DIALOG_COMMSET1             137
+#define IDC_STATIC_STATE                1000
 #define IDC_BUTTON_INIT                 1039
 #define IDC_BUTTON2                     1040
 #define IDC_COMBO_NETWORK_TYPE          1041
@@ -28,7 +29,7 @@
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        1000
 #define _APS_NEXT_COMMAND_VALUE         32771
-#define _APS_NEXT_CONTROL_VALUE         1000
+#define _APS_NEXT_CONTROL_VALUE         1001
 #define _APS_NEXT_SYMED_VALUE           1000
 #endif
 #endif
diff --git a/KLink3/KLink3.vcxproj b/KLink3/KLink3.vcxproj
index 9e70e62..bb5d0ee 100644
--- a/KLink3/KLink3.vcxproj
+++ b/KLink3/KLink3.vcxproj
@@ -23,32 +23,32 @@
     <ProjectGuid>{A9132770-20D8-423A-8F25-4B5F5B4459D3}</ProjectGuid>
     <Keyword>Win32Proj</Keyword>
     <RootNamespace>KLink3</RootNamespace>
-    <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
diff --git a/LCDDisplay/LCDDisplay.rc b/LCDDisplay/LCDDisplay.rc
index fbf14e9..18130d7 100644
--- a/LCDDisplay/LCDDisplay.rc
+++ b/LCDDisplay/LCDDisplay.rc
Binary files differ
diff --git a/LCDDisplay/LCDDisplay.vcxproj b/LCDDisplay/LCDDisplay.vcxproj
index 1122a56..0975991 100644
--- a/LCDDisplay/LCDDisplay.vcxproj
+++ b/LCDDisplay/LCDDisplay.vcxproj
@@ -23,21 +23,21 @@
     <ProjectGuid>{C9541E40-C2A2-4200-85E4-A94F58084D27}</ProjectGuid>
     <Keyword>MFCProj</Keyword>
     <RootNamespace>LCDDisplay</RootNamespace>
-    <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
     <ProjectName>LCDDisplayTest</ProjectName>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
@@ -45,14 +45,14 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
diff --git a/MFCApplication3/MFCApplication3.vcxproj b/MFCApplication3/MFCApplication3.vcxproj
index 1548ada..3255afa 100644
--- a/MFCApplication3/MFCApplication3.vcxproj
+++ b/MFCApplication3/MFCApplication3.vcxproj
@@ -23,20 +23,20 @@
     <ProjectGuid>{44A04701-2CEF-48CA-B63E-F32B6A1D9331}</ProjectGuid>
     <Keyword>MFCProj</Keyword>
     <RootNamespace>MFCApplication3</RootNamespace>
-    <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
@@ -44,14 +44,14 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
diff --git a/MTerm1.sln b/MTerm1.sln
index 5f7a0d8..1ab7ff6 100644
--- a/MTerm1.sln
+++ b/MTerm1.sln
@@ -1,7 +1,7 @@
 锘�
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.28307.1209
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.33529.622
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MultiTerminal1", "MultiTerminal1\MultiTerminal1.vcxproj", "{FB609F6E-0B21-4133-BF35-B4A79AE2F043}"
 EndProject
@@ -11,13 +11,15 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MTerm1", "MTerm1\MTerm1.vcxproj", "{7AA827E9-4264-4C9C-A5EA-A04CA08C6D12}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KLink1Lib", "KLink1\KLink1.vcxproj", "{1F782E34-9087-4F87-9674-E4BDAA319726}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KLink1", "KLink1\KLink1.vcxproj", "{1F782E34-9087-4F87-9674-E4BDAA319726}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KLink3", "KLink3\KLink3.vcxproj", "{A9132770-20D8-423A-8F25-4B5F5B4459D3}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConfigTool", "ConfigTool\ConfigTool.vcxproj", "{E60A8A23-131E-49E5-B61E-C374C721ACBA}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LCDDisplayTest", "LCDDisplay\LCDDisplay.vcxproj", "{C9541E40-C2A2-4200-85E4-A94F58084D27}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConsoleApplication1", "ConsoleApplication1\ConsoleApplication1.vcxproj", "{83C17606-596D-4072-83A2-0C634C20E742}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -91,6 +93,14 @@
 		{C9541E40-C2A2-4200-85E4-A94F58084D27}.Release|x64.Build.0 = Release|x64
 		{C9541E40-C2A2-4200-85E4-A94F58084D27}.Release|x86.ActiveCfg = Release|Win32
 		{C9541E40-C2A2-4200-85E4-A94F58084D27}.Release|x86.Build.0 = Release|Win32
+		{83C17606-596D-4072-83A2-0C634C20E742}.Debug|x64.ActiveCfg = Debug|x64
+		{83C17606-596D-4072-83A2-0C634C20E742}.Debug|x64.Build.0 = Debug|x64
+		{83C17606-596D-4072-83A2-0C634C20E742}.Debug|x86.ActiveCfg = Debug|Win32
+		{83C17606-596D-4072-83A2-0C634C20E742}.Debug|x86.Build.0 = Debug|Win32
+		{83C17606-596D-4072-83A2-0C634C20E742}.Release|x64.ActiveCfg = Release|x64
+		{83C17606-596D-4072-83A2-0C634C20E742}.Release|x64.Build.0 = Release|x64
+		{83C17606-596D-4072-83A2-0C634C20E742}.Release|x86.ActiveCfg = Release|Win32
+		{83C17606-596D-4072-83A2-0C634C20E742}.Release|x86.Build.0 = Release|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
diff --git a/MTerm1/0prog2.kpg b/MTerm1/0prog2.kpg
index 23020f5..7d9b49e 100644
--- a/MTerm1/0prog2.kpg
+++ b/MTerm1/0prog2.kpg
@@ -27,22 +27,6 @@
 AN	X23
 AN	X24
 AN	X25
-AN	X26
-AN	X27
-AN	X28
-AN	X29
-AN	X30
-AN	X31
-ST	X32
-AN	X33
-AN	X34
-AN	X35
-AN	X36
-AN	X37
-ST	X48
-AN	X49
-AN	X50
-AN	X51
 ST	Y0
 AN	Y1
 AN	Y2
@@ -75,17 +59,8 @@
 AN	Y29
 AN	Y30
 AN	Y31
-ST	Y32
-AN	Y33
-AN	Y34
-AN	Y35
-AN	Y36
-AN	Y37
-ST	Y48
-AN	Y49
-AN	Y50
-AN	Y51
-AN	Y52
+ST	R0
+MV	WY0	WLY1
 ST	SR13
 PSHS
 MV	WX0	WX1
@@ -357,3 +332,18 @@
 DT22	绿灯1剩余时间
 [MONCOILLIST]
 [MONDATALIST]
+时间
+DT13	黄灯1时间
+DT14	绿灯2延迟时间
+DT32	剩余秒数
+DT33	余数
+DT15	绿灯2时间
+DT16	黄灯2时间
+DT25	绿灯2剩余时间
+DT35	绿灯2剩余秒数
+DT36	绿灯2 秒余数
+DT22	绿灯1剩余时间
+[MONCOILLIST]
+[MONDATALIST]
+
+[MONDATALIST]
diff --git a/MTerm1/0prog4.kpg b/MTerm1/0prog4.kpg
new file mode 100644
index 0000000..caa9278
--- /dev/null
+++ b/MTerm1/0prog4.kpg
@@ -0,0 +1,187 @@
+[SYSCFG]
+[PROG]
+ST	X0
+AN	X1
+AN	X2
+AN	X3
+AN	X4
+AN	X5
+AN	X6
+AN	X7
+AN	X8
+AN	X9
+AN	X10
+AN	X11
+AN	X12
+ST	Y0
+AN	Y1
+AN	Y2
+AN	Y3
+AN	Y4
+AN	Y5
+AN	Y6
+AN	Y7
+AN	Y8
+AN	Y9
+AN	Y10
+AN	Y11
+ST/	X0
+OUT	R0
+ST/	X1
+OUT	R1
+ST	SR0
+AN	SR1
+AN	SR13
+ST	R0
+MV	WY0	WLY0
+ST	X2
+OR	Y5
+OUT	Y2
+ST	X3
+OR	Y6
+OUT	Y3
+ST	R10
+AN	R11
+AN	R12
+AN	R13
+AN	R14
+AN	R15
+AN	R16
+AN	R17
+AN	R18
+AN	R19
+AN	R120
+AN	R121
+AN	R122
+ST	SR13
+SET	R11
+ST	R11
+DF
+SET	R12
+RESET	R13
+RESET	R14
+RESET	R15
+RESET	R16
+ST	R12
+RESET	Y0
+RESET	Y1
+RESET	Y5
+RESET	Y6
+ST	R12
+AN/	X0
+AN/	X1
+TMX	11	K30
+RESET	R12
+SET	R13
+ST	R12
+AN	X1
+TMX	12	K30
+RESET	R12
+SET	R15
+ST	R13
+ST	X0
+OR	X1
+ANS
+TMX	13	K30
+RESET	R13
+RESET	Y5
+SET	R12
+ST	R13
+PSHS
+AN	X2
+SET	Y5
+POPS
+ST	X6
+OR	R6
+ANS
+AN	Y5
+RESET	R13
+SET	R14
+SET	Y1
+ST	R14
+TMX	14	K100
+RESET	Y1
+RESET	R14
+RESET	Y5
+SET	R12
+ST	R14
+AN/	X0
+AN	X1
+TMX	15	K5
+RESET	R14
+RESET	Y1
+RESET	Y5
+SET	R15
+ST	R15
+AN/	X0
+AN/	X1
+TMX	16	K20
+RESET	R15
+SET	R12
+ST	R15
+PSHS
+AN	X3
+SET	Y6
+POPS
+ST	X7
+OR	R7
+ANS
+AN	Y6
+RESET	R15
+SET	R16
+SET	Y0
+ST	R16
+PSHS
+TMX	17	K100
+POPS
+ST	T17
+OR/	X7
+ANS
+RESET	Y0
+RESET	R16
+RESET	Y6
+SET	R12
+ST	R16
+AN/	X0
+AN/	X1
+TMX	18	K20
+RESET	R16
+RESET	Y0
+RESET	Y6
+SET	R13
+ST	X5
+DF
+NOT
+TMX	20	K50
+ST	T20
+OR/	X5
+OUT	Y4
+[COMMENT]
+X0	进料检测传感器
+X1	有料检测传感器
+X2	进料按钮
+X3	出料按钮
+X4	防撞条信号
+X6	换向允许进料
+X7	换向允许出料
+Y0	正转控制
+Y1	反转控制
+Y2	绿灯
+Y3	红灯
+Y4	行走继电器
+Y5	请求进料
+Y6	允许出料
+SR10	ON
+SR11	OFF
+SR113	初始脉冲
+R13	无料
+R14	进料
+R12	未知
+R15	有料
+R16	出料
+R11	开始
+R6	模拟进料信号
+X5	防撞条
+R7	模拟出料信号
+[MONCOILLIST]
+[MONDATALIST]
diff --git a/MTerm1/0prog5.kpg b/MTerm1/0prog5.kpg
new file mode 100644
index 0000000..3bdf645
--- /dev/null
+++ b/MTerm1/0prog5.kpg
@@ -0,0 +1,43 @@
+[SYSCFG]
+[PROG]
+ST	SR13
+SET	R103
+ST	R103
+TML	23	K2000
+PSHS
+DF
+PSHS
+AN/	X4
+RESET	R50
+SET	R60
+RDS
+AN	X4
+SET	R50
+RESET	R60
+RDS
+SET	R67
+RDS
+SET	R30
+POPS
+SET	R32
+POPS
+AN	X2
+AN	X7
+SET	R99
+RESET	R103
+ST	X0
+AN	X2
+PSHS
+TML	75	K30000
+POPS
+SUB3	K30000	EV75	DT50
+DIV	DT5	K2	DT154
+SUB3	DT154	K0	DT56
+[COMMENT]
+R103	注释1
+R50	注释2
+EV75	经过值
+DT5	什么值
+DT154	另一个值
+[MONCOILLIST]
+[MONDATALIST]
diff --git a/MTerm1/CMyFuncKeyToolBar.cpp b/MTerm1/CMyFuncKeyToolBar.cpp
index 8b3c4d5..4f35c89 100644
--- a/MTerm1/CMyFuncKeyToolBar.cpp
+++ b/MTerm1/CMyFuncKeyToolBar.cpp
@@ -4,7 +4,7 @@
 	ON_WM_CREATE()
 	ON_WM_SIZE()
 END_MESSAGE_MAP()
-
+/*
 structButton myButtons[] =
 {
 	{33001,_T("11") },
@@ -21,14 +21,14 @@
 	{33012,_T("112") },
 };
 static int myButtonCount = sizeof(myButtons) / sizeof(structButton);
-
+*/
 int CMyFuncKeyToolBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
 {
 	if (CMFCToolBar::OnCreate(lpCreateStruct) == -1)
 		return -1;
 	CRect rect1(0, 0, 100, 24);
 	// TODO:  在此添加您专用的创建代码
-	m_buttons[1].Create(myButtons[1].sCaption,WS_CHILD | WS_TABSTOP | WS_VISIBLE |BS_PUSHBUTTON ,rect1, this, myButtons[1].nID);
+//	m_buttons[1].Create(myButtons[1].sCaption,WS_CHILD | WS_TABSTOP | WS_VISIBLE |BS_PUSHBUTTON ,rect1, this, myButtons[1].nID);
 
 	CRect rect0(0, 0, 500, 48);
 	this->MoveWindow(rect0);
diff --git a/MTerm1/CMyFuncKeyToolBar.h b/MTerm1/CMyFuncKeyToolBar.h
index b4271db..48fda47 100644
--- a/MTerm1/CMyFuncKeyToolBar.h
+++ b/MTerm1/CMyFuncKeyToolBar.h
@@ -1,12 +1,12 @@
 #pragma once
 #include <afxtoolbar.h>
-
+/*
 typedef struct tagStructButton {
 	int nID;
 	CString sCaption;
 
 }structButton;
-
+*/
 class CMyFuncKeyToolBar :
 	public CMFCToolBar
 {
diff --git a/MTerm1/CMyPaneInputShow.cpp b/MTerm1/CMyPaneInputShow.cpp
new file mode 100644
index 0000000..bb94c17
--- /dev/null
+++ b/MTerm1/CMyPaneInputShow.cpp
@@ -0,0 +1,101 @@
+#include "pch.h"
+#include "MTerm1.h"
+#include "CMyPaneInputShow.h"
+
+
+// CMyPaneRules
+
+IMPLEMENT_DYNAMIC(CMyPaneInputShow, CDockablePane)
+
+CMyPaneInputShow::CMyPaneInputShow()
+{
+
+	m_pMyFormInputShow = (CMyFormInputShow*)(RUNTIME_CLASS(CMyFormInputShow)->CreateObject());
+	//	m_pMyDialogLog=(CMyDialogLog*) (RUNTIME_CLASS(CMyDialogLog)->CreateObject());
+}
+
+CMyPaneInputShow::~CMyPaneInputShow()
+{
+}
+
+
+BEGIN_MESSAGE_MAP(CMyPaneInputShow, CDockablePane)
+	ON_WM_CREATE()
+	ON_WM_SIZE()
+	ON_WM_DESTROY()
+END_MESSAGE_MAP()
+
+
+
+// CMyPaneRules 消息处理程序
+
+
+
+
+int CMyPaneInputShow::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+	if (CDockablePane::OnCreate(lpCreateStruct) == -1)
+		return -1;
+
+	// TODO:  在此添加您专用的创建代码
+	RECT rect;
+
+	GetClientRect(&rect);
+
+	//	m_pMyFormLog->CreateEx(NULL, _T("CMyPaneLog"),_T("日志窗口"), WS_CHILD | WS_VISIBLE, rect, this, IDD_FORM_LOG, NULL);
+	m_pMyFormInputShow->Create(NULL, NULL, WS_CHILD | WS_VISIBLE, rect, this, IDD_FORM_INPUTSHOW, NULL);
+	//	m_MyDialogLog.Create(m_MyDialogLog.IDD,this);
+	//	m_MyDialogLog.ShowWindow(SW_SHOW);
+	//	m_MyDialogLog.OnInitDialog();
+	//	MyLogEdit1.Create(ES_MULTILINE|ES_WANTRETURN|WS_VSCROLL|WS_VISIBLE,rect,this,5678);
+	//	myLoger1.AttachWnd(MyLogEdit1.m_hWnd);
+	//	myLoger1.ShowTime=0;
+	//	myLoger1.showLineCount=0;
+	return 0;
+}
+
+
+void CMyPaneInputShow::OnSize(UINT nType, int cx, int cy)
+{
+	CDockablePane::OnSize(nType, cx, cy);
+
+	// TODO: 在此处添加消息处理程序代码
+	if (GetSafeHwnd() == NULL)
+	{
+		return;
+	}
+	/*
+		if (MyLogEdit1.GetSafeHwnd()!=NULL)
+		{
+			CRect rect;
+			GetClientRect(rect);
+			MyLogEdit1.SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOACTIVATE | SWP_NOZORDER);
+			MyLogEdit1.ReplaceSel(_T("On size \r\n"));
+		}
+		*/
+		///*
+	if (m_pMyFormInputShow->GetSafeHwnd() != NULL)
+	{
+		CRect rect;
+		GetClientRect(rect);
+		m_pMyFormInputShow->SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOACTIVATE | SWP_NOZORDER);
+	}
+	//*/
+	/*
+		if(m_MyDialogLog.GetSafeHwnd()!=NULL)
+		{
+			CRect rect;
+			GetClientRect(rect);
+			m_MyDialogLog.SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOACTIVATE | SWP_NOZORDER);
+		}
+	//*/
+
+}
+
+
+void CMyPaneInputShow::OnDestroy()
+{
+	CDockablePane::OnDestroy();
+
+	// TODO: 在此处添加消息处理程序代码
+}
diff --git a/MTerm1/CMyPaneInputShow.h b/MTerm1/CMyPaneInputShow.h
new file mode 100644
index 0000000..beef31a
--- /dev/null
+++ b/MTerm1/CMyPaneInputShow.h
@@ -0,0 +1,21 @@
+#pragma once
+#include <afxdockablepane.h>
+#include "MyFormInputShow.h"
+class CMyPaneInputShow :    public CDockablePane
+{
+	DECLARE_DYNAMIC(CMyPaneInputShow)
+public:
+	CMyPaneInputShow();
+	virtual ~CMyPaneInputShow();
+	CMyFormInputShow* m_pMyFormInputShow;
+protected:
+
+	//	CMyDialogLog m_MyDialogLog;
+		//	CEdit  MyLogEdit1;
+	DECLARE_MESSAGE_MAP()
+public:
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	afx_msg void OnSize(UINT nType, int cx, int cy);
+	afx_msg void OnDestroy();
+};
+
diff --git a/MTerm1/DialogEventLog.cpp b/MTerm1/DialogEventLog.cpp
index 4646bec..6f45c0a 100644
--- a/MTerm1/DialogEventLog.cpp
+++ b/MTerm1/DialogEventLog.cpp
@@ -100,7 +100,7 @@
 
 	m_nEventCount = nCount;
 	m_nCurEvent = 0;
-	SetTimer(1, 100, NULL);
+	SetTimer(1, 50, NULL);
 //	for (int i = 0; i < nCount; i++)
 //	{
 //		GetEventLogByIndex(i);
diff --git a/MTerm1/MTerm1.rc b/MTerm1/MTerm1.rc
index 2806d7f..89a1c74 100644
--- a/MTerm1/MTerm1.rc
+++ b/MTerm1/MTerm1.rc
Binary files differ
diff --git a/MTerm1/MTerm1.vcxproj b/MTerm1/MTerm1.vcxproj
index 2b4747a..b0404db 100644
--- a/MTerm1/MTerm1.vcxproj
+++ b/MTerm1/MTerm1.vcxproj
@@ -23,21 +23,21 @@
     <ProjectGuid>{7AA827E9-4264-4C9C-A5EA-A04CA08C6D12}</ProjectGuid>
     <Keyword>MFCProj</Keyword>
     <RootNamespace>MTerm1</RootNamespace>
-    <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
     <ProjectName>MTerm1</ProjectName>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
@@ -45,14 +45,14 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
@@ -80,14 +80,14 @@
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <LinkIncremental>true</LinkIncremental>
-    <LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;D:\WORK\VC_WORK\MTerm1\x64\Debug</LibraryPath>
+    <LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;..\x64\Debug</LibraryPath>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <LinkIncremental>false</LinkIncremental>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <LinkIncremental>false</LinkIncremental>
-    <LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;x64\Release</LibraryPath>
+    <LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;x64\Release;..\x64\release</LibraryPath>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
@@ -192,6 +192,7 @@
   <ItemGroup>
     <ClInclude Include="AnsiParser.h" />
     <ClInclude Include="CMyFuncKeyToolBar.h" />
+    <ClInclude Include="CMyPaneInputShow.h" />
     <ClInclude Include="CMyPropPage.h" />
     <ClInclude Include="DataParser1.h" />
     <ClInclude Include="DialogCoilMon.h" />
@@ -215,6 +216,7 @@
     <ClInclude Include="ChildFrm.h" />
     <ClInclude Include="MyDlgBarFuncKey.h" />
     <ClInclude Include="MyDlgBarInputShow.h" />
+    <ClInclude Include="MyFormInputShow.h" />
     <ClInclude Include="PropCommCfg.h" />
     <ClInclude Include="PropInputCfg.h" />
     <ClInclude Include="PropMemCfg.h" />
@@ -248,6 +250,7 @@
     <ClCompile Include="..\MyLib\StaticEx.cpp" />
     <ClCompile Include="AnsiParser.cpp" />
     <ClCompile Include="CMyFuncKeyToolBar.cpp" />
+    <ClCompile Include="CMyPaneInputShow.cpp" />
     <ClCompile Include="CMyPropPage.cpp" />
     <ClCompile Include="DataParser1.cpp" />
     <ClCompile Include="DialogCoilMon.cpp" />
@@ -270,6 +273,7 @@
     <ClCompile Include="ChildFrm.cpp" />
     <ClCompile Include="MyDlgBarFuncKey.cpp" />
     <ClCompile Include="MyDlgBarInputShow.cpp" />
+    <ClCompile Include="MyFormInputShow.cpp" />
     <ClCompile Include="PropCommCfg.cpp" />
     <ClCompile Include="PropInputCfg.cpp" />
     <ClCompile Include="PropMemCfg.cpp" />
diff --git a/MTerm1/MTerm1.vcxproj.filters b/MTerm1/MTerm1.vcxproj.filters
index 5d9633d..6095a5d 100644
--- a/MTerm1/MTerm1.vcxproj.filters
+++ b/MTerm1/MTerm1.vcxproj.filters
@@ -174,6 +174,12 @@
     <ClInclude Include="CMyPropPage.h">
       <Filter>澶存枃浠�</Filter>
     </ClInclude>
+    <ClInclude Include="CMyPaneInputShow.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="MyFormInputShow.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="MainFrm.cpp">
@@ -323,6 +329,12 @@
     <ClCompile Include="CMyPropPage.cpp">
       <Filter>婧愭枃浠�</Filter>
     </ClCompile>
+    <ClCompile Include="CMyPaneInputShow.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="MyFormInputShow.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="MTerm1.rc">
diff --git a/MTerm1/MTerm1Doc.cpp b/MTerm1/MTerm1Doc.cpp
index 7f3aaaf..d9ed313 100644
--- a/MTerm1/MTerm1Doc.cpp
+++ b/MTerm1/MTerm1Doc.cpp
@@ -485,6 +485,7 @@
 		if (Typetxt.Find( CoilTypeNameDef[i].TypeTxt)==0) {
 			*nCoilType = CoilTypeNameDef[i].nType;
 			*nCoilAddr = atoi(Typetxt.Mid(CoilTypeNameDef[i].TypeTxt.GetLength()));
+			return true;
 			return CoilTypeNameDef[i].nType;
 		}
 	}
@@ -514,6 +515,8 @@
 			return true;
 		}
 	}
+	*nDataType = KLDataTypeDEC;
+	*nDataAddr = atoi(Typetxt);
 	return false;
 }
 
@@ -870,7 +873,8 @@
 		CStringA s1A;
 		s1A = sCoilName;
 		int nParamType,nAddr;
-		TxtToCoilType(s1A, &nParamType,&nAddr)||TxtToDataType(s1A, &nParamType, &nAddr);
+		TxtToCoilType(s1A, &nParamType,&nAddr)
+			||TxtToDataType(s1A, &nParamType, &nAddr);
 
 		mCoilAnnos[nCoilAnnoCount].nType = nParamType;
 		mCoilAnnos[nCoilAnnoCount].nAddr = nAddr;
@@ -901,8 +905,8 @@
 int CMTerm1Doc::TransProgToBin()
 {
 	CString s1;
+	stBinProg15* pBinProg15;
 	stBinProg2 * pBinProg2;
-	stBinProg15 * pBinProg15;
 	stBinProg3 * pBinProg3;
 	nBinProgSteps = 0;
 	for (int i = 0; i < m_nProgSteps; i++)
@@ -996,12 +1000,15 @@
 		case OP_TMX:
 		case OP_TMY:
 			pBinProg15 = (stBinProg15 *)(&BinProgs[nBinProgSteps]);
+
 			BinProgs[nBinProgSteps].nOp = nOpType;
 			BinProgs[nBinProgSteps].nParamType = nParamAddr1;
 			BinProgs[nBinProgSteps].nParamAddr = nParamAddr2;
 			BinProgs[nBinProgSteps + 1].nOp = nParamType2;
 			BinProgs[nBinProgSteps + 1].nParamType = 0;
 			BinProgs[nBinProgSteps + 1].nParamAddr = 0;
+			pBinProg15->nOpNum = Progs[i].Params[0].nParamAddr;
+			
 			nBinProgSteps += 2;
 			break;
 			// 1 鍙傛暟楂樼骇鎸囦护
@@ -1058,7 +1065,251 @@
 
 int CMTerm1Doc::TransBinToProg()
 {
+	CString s1;
+	//nBinProgSteps = 0;
+	m_nProgSteps = 0;
+	stBinProg2* pBinProg2;
+	stBinProg15* pBinProg15;
+	stBinProg3* pBinProg3;
+	CStringA s1A;
+	CString s2,s3;
+	CStringA s2A, s3A;
+	for (int i = 0; i < nBinProgSteps; i++)
+	{
+		int nOpType = BinProgs[i].nOp;
+		int nParamType1 = BinProgs[i].nParamType;
+		int nParamAddr1 = BinProgs[i].nParamAddr;
+//		int nParamType1 = Progs[i].Params[0].nParamType;
+//		int nParamAddr1 = Progs[i].Params[0].nParamAddr;
+		int nParamType2, nParamAddr2;
+		int nParamType3, nParamAddr3;
+		CoilTypeToTxt(nParamType1, s1A);
+		s1.Format(_T("%S%d"), s1A, nParamAddr1);
+		Progs[m_nProgSteps].Params[0].nParamType = nParamType1;
+		Progs[m_nProgSteps].Params[0].nParamAddr = nParamAddr1;
+		Progs[m_nProgSteps].Params[0].sParamStr = s1;
 
+		switch (nOpType)
+		{
+		case OP_NONE:
+			break;
+			//case OP_NOP:
+			break;
+			//鏃犲弬鏁� 鎸囦护
+		case OP_NOT:
+		case OP_ANS:
+		case OP_ORS:
+		case OP_PSHS:
+		case OP_RDS:
+		case OP_POPS:
+		case OP_DF:
+		case OP_DF_:
+			Progs[m_nProgSteps].nOpType1 = nOpType;
+			Progs[m_nProgSteps].nParamCount = 0;
+			Progs[m_nProgSteps].Params[0].nParamType = nParamType1;
+			Progs[m_nProgSteps].Params[0].nParamAddr = nParamAddr1;
+
+			//BinProgs[nBinProgSteps].nOp = nOpType;
+			m_nProgSteps += 1;
+			//nBinProgSteps += 1;
+			break;
+			// 1鍙傛暟鎸囦护
+		case OP_ST:
+		case OP_ST_:
+		case OP_AN:
+		case OP_AN_:
+		case OP_OR:
+		case OP_OR_:
+			Progs[m_nProgSteps].nOpType1 = nOpType;
+			Progs[m_nProgSteps].nParamCount = 1;
+			Progs[m_nProgSteps].Params[0].nParamType = nParamType1;
+			Progs[m_nProgSteps].Params[0].nParamAddr = nParamAddr1;
+			m_nProgSteps += 1;
+			//i += 1;
+			break;
+			// 1 鍙傛暟 杈撳嚭
+		case OP_OUT:
+		case OP_SET:
+		case OP_RESET:
+			Progs[m_nProgSteps].nOpType1 = nOpType;
+			Progs[m_nProgSteps].nParamCount = 1;
+			Progs[m_nProgSteps].Params[0].nParamType = nParamType1;
+			Progs[m_nProgSteps].Params[0].nParamAddr = nParamAddr1;
+			m_nProgSteps += 1;
+			//i += 1;
+			break;
+
+			// 姣旇緝鎸囦护
+		case OP_ST_EQ:
+		case OP_ST_NE:
+		case OP_ST_LT:
+		case OP_ST_GT:
+		case OP_ST_LE:
+		case OP_ST_GE:
+		case OP_AN_EQ:
+		case OP_AN_NE:
+		case OP_AN_LT:
+		case OP_AN_GT:
+		case OP_AN_LE:
+		case OP_AN_GE:
+		case OP_OR_EQ:
+		case OP_OR_NE:
+		case OP_OR_LT:
+		case OP_OR_GT:
+		case OP_OR_LE:
+		case OP_OR_GE:
+			pBinProg2 = (stBinProg2*)(&BinProgs[i]);
+
+			nParamType1 = pBinProg2->nParamType1;
+			nParamAddr1 = pBinProg2->nParamAddr1;
+			nParamType2 = pBinProg2->nParamType2;
+			nParamAddr2 = pBinProg2->nParamAddr2;
+
+			DataTypeToTxt(nParamType1, s1A);
+			s1.Format(_T("%S%d"), s1A, nParamAddr1);
+
+			DataTypeToTxt(nParamType2, s2A);
+			s2.Format(_T("%S%d"), s2A, nParamAddr2);
+
+			Progs[m_nProgSteps].nOpType1 = nOpType;
+			Progs[m_nProgSteps].nParamCount = 2;
+			Progs[m_nProgSteps].Params[0].nParamType = nParamType1;
+			Progs[m_nProgSteps].Params[0].nParamAddr = nParamAddr1;
+			Progs[m_nProgSteps].Params[0].sParamStr = s1;
+
+			Progs[m_nProgSteps].Params[1].nParamType = nParamType2;
+			Progs[m_nProgSteps].Params[1].nParamAddr = nParamAddr2;
+			Progs[m_nProgSteps].Params[1].sParamStr = s2;
+
+			m_nProgSteps += 1;
+			i += 1;
+			break;
+
+			// 瀹氭椂鍣�
+		case OP_TML:
+		case OP_TMR:
+		case OP_TMX:
+		case OP_TMY:
+			//pBinProg2 = (stBinProg2*)(&BinProgs[i]);
+
+			pBinProg15 = (stBinProg15*)(&BinProgs[i]);
+
+			nParamType1 = 0;
+			nParamAddr1 = pBinProg15->nOpNum;
+			nParamType2 = pBinProg15->nParamType1;
+			nParamAddr2 = pBinProg15->nParamAddr1;
+			//nParamAddr2 = pBinProg15->nParamAddr2;
+			DataTypeToTxt(nParamType1, s1A);
+			s1.Format(_T("%d"), nParamAddr1);
+
+			DataTypeToTxt(nParamType2, s2A);
+			s2.Format(_T("%S%d"), s2A, nParamAddr2);
+
+			Progs[m_nProgSteps].nOpType1 = nOpType;
+			Progs[m_nProgSteps].nParamCount = 2;
+			Progs[m_nProgSteps].Params[0].nParamType = nParamType1;
+			Progs[m_nProgSteps].Params[0].nParamAddr = nParamAddr1;
+			Progs[m_nProgSteps].Params[0].sParamStr = s1;
+
+			Progs[m_nProgSteps].Params[1].nParamType = nParamType2;
+			Progs[m_nProgSteps].Params[1].nParamAddr = nParamAddr2;
+			Progs[m_nProgSteps].Params[1].sParamStr = s2;
+			m_nProgSteps += 1;
+			i += 1;
+
+			break;
+			// 1 鍙傛暟楂樼骇鎸囦护
+		case OP_INC:
+		case OP_DEC:
+			pBinProg15 = (stBinProg15*)(&BinProgs[i]);
+			nParamType1 = pBinProg15->nParamType1;
+			nParamAddr1 = pBinProg15->nParamAddr1;
+
+			DataTypeToTxt(nParamType1, s1A);
+			s1.Format(_T("%S%d"), s1A, nParamAddr1);
+
+			Progs[m_nProgSteps].nOpType1 = nOpType;
+			Progs[m_nProgSteps].nParamCount = 1;
+			Progs[m_nProgSteps].Params[0].nParamType = nParamType1;
+			Progs[m_nProgSteps].Params[0].nParamAddr = nParamAddr1;
+			Progs[m_nProgSteps].Params[0].sParamStr = s1;
+
+			m_nProgSteps += 1;
+			i += 1;
+			break;
+			// 2鍙傛暟楂樼骇鎸囦护
+		case OP_MV:
+		case OP_ADD2:
+		case OP_SUB2:
+			pBinProg2 = (stBinProg2*)(&BinProgs[i]);
+
+			nParamType1 = pBinProg2->nParamType1;
+			nParamAddr1 = pBinProg2->nParamAddr1;
+			nParamType2 = pBinProg2->nParamType2;
+			nParamAddr2 = pBinProg2->nParamAddr2;
+
+			DataTypeToTxt(nParamType1, s1A);
+			s1.Format(_T("%S%d"), s1A, nParamAddr1);
+
+			DataTypeToTxt(nParamType2, s2A);
+			s2.Format(_T("%S%d"), s2A, nParamAddr2);
+
+			Progs[m_nProgSteps].nOpType1 = nOpType;
+			Progs[m_nProgSteps].nParamCount = 2;
+			Progs[m_nProgSteps].Params[0].nParamType = nParamType1;
+			Progs[m_nProgSteps].Params[0].nParamAddr = nParamAddr1;
+			Progs[m_nProgSteps].Params[0].sParamStr = s1;
+
+			Progs[m_nProgSteps].Params[1].nParamType = nParamType2;
+			Progs[m_nProgSteps].Params[1].nParamAddr = nParamAddr2;
+			Progs[m_nProgSteps].Params[1].sParamStr = s2;
+
+			m_nProgSteps += 1;
+			i += 1;
+
+			break;
+			// 3 鍙傛暟楂樼骇鎸囦护
+		case OP_ADD3:
+		case OP_SUB3:
+		case OP_MUL:
+		case OP_DIV:
+			pBinProg3 = (stBinProg3*)(&BinProgs[i]);
+			nParamType1 = pBinProg3->nParamType1;
+			nParamAddr1 = pBinProg3->nParamAddr1;
+			nParamType2 = pBinProg3->nParamType2;
+			nParamAddr2 = pBinProg3->nParamAddr2;
+			nParamType3 = pBinProg3->nParamType3;
+			nParamAddr3 = pBinProg3->nParamAddr3;
+
+			DataTypeToTxt(nParamType1, s1A);
+			s1.Format(_T("%S%d"), s1A, nParamAddr1);
+
+			DataTypeToTxt(nParamType2, s2A);
+			s2.Format(_T("%S%d"), s2A, nParamAddr2);
+			DataTypeToTxt(nParamType3, s3A);
+			s3.Format(_T("%S%d"), s3A, nParamAddr3);
+
+			Progs[m_nProgSteps].nOpType1 = nOpType;
+			Progs[m_nProgSteps].nParamCount = 3;
+			Progs[m_nProgSteps].Params[0].nParamType = nParamType1;
+			Progs[m_nProgSteps].Params[0].nParamAddr = nParamAddr1;
+			Progs[m_nProgSteps].Params[0].sParamStr = s1;
+			Progs[m_nProgSteps].Params[1].nParamType = nParamType2;
+			Progs[m_nProgSteps].Params[1].nParamAddr = nParamAddr2;
+			Progs[m_nProgSteps].Params[1].sParamStr = s2;
+			Progs[m_nProgSteps].Params[2].nParamType = nParamType3;
+			Progs[m_nProgSteps].Params[2].nParamAddr = nParamAddr3;
+			Progs[m_nProgSteps].Params[2].sParamStr = s3;
+			m_nProgSteps += 1;
+			i += 2;
+			break;
+		default:
+			break;
+		}
+
+	}
+	s1.Format(_T("%d binsteps to %d Steps "), nBinProgSteps, m_nProgSteps );
+	DbgLog(s1);
 	return 0;
 }
 
@@ -1069,12 +1320,15 @@
 	CString s1;
 	if (!m_bOnline) {
 		r = Connect();
-		MyKLink1.Open();
+	//	MyKLink1.Open();
 	}
 	if (!m_bOnline) return;
 	r = MyKLink1.ReadRunStat(1,0,0,32,(unsigned short *)&MyKLink1.KMRunStat);
 
-
+	if (r != 0) {
+		AfxMessageBox(_T("UploadFrom PLC Failed"));
+		return;
+	}
 //	AfxMessageBox(_T("UploadFrom PLC From Doc"));
 	CString s2;
 	s2.Format(_T("Cur Programs %d \r\n"), nBinProgSteps);
@@ -1131,12 +1385,12 @@
 	CString s1;
 	if (!m_bOnline) {
 		r=Connect();
-		MyKLink1.Open();
+	//	MyKLink1.Open();
 	}
 	if (!m_bOnline) return 0;
 
 	if (m_bPlcRunning) {
-		 r = AfxMessageBox(_T("PLC Running, Stop it?"), MB_YESNO);
+		 r = AfxMessageBox(_T("PLC杩愯涓紝鏄惁鍋滄浠ヤ究涓嬭浇绋嬪簭?"), MB_YESNO);
 		 if (r == IDYES) {	StopPLC();}
 		 else { return 0; }
 	}
@@ -1153,11 +1407,16 @@
 	for (int i = 0; i < DownloadSize; i += Steps) {
 		//int Steps = 16;
 		if (i + Steps > DownloadSize) { Steps = DownloadSize - i; }
-		s1.Format(_T("Downloading %d to %d "), i, i + Steps);
-		DbgLog(s1);
-		r = MyKLink1.WriteProgram(1, 2, (i)*4, Steps * 4, (USHORT *)&BinProgs[i]);
-		s1.Format(_T("Download r = %d "), r);
-		DbgLog(s1);
+		int n = 0;
+		do {
+			s1.Format(_T("Downloading %d to %d "), i, i + Steps);
+			DbgLog(s1);
+			r = MyKLink1.WriteProgram(1, 2, (i) * 4, Steps * 4, (USHORT*)&BinProgs[i]);
+			s1.Format(_T("Download r = %d "), r);
+			DbgLog(s1);
+			n += 1;
+			if (n > 10) break;
+		} while (r != 0);
 		//Update Progress Bar
 	}
 
@@ -1171,7 +1430,10 @@
 
 	// 涓嬭浇绯荤粺瀵勫瓨鍣ㄩ厤缃�
 
-
+	//鍚姩杩愯
+	r = AfxMessageBox(_T("绋嬪簭涓嬭浇瀹屾垚锛屾槸鍚﹀惎鍔ㄨ繍琛�?"), MB_YESNO);
+	if (r == IDYES) { StartPLC(); }
+	else { return 0; }
 
 	return 0;
 }
@@ -1194,7 +1456,7 @@
 	if (!m_bOnline)
 	{
 		r = Connect();
-		MyKLink1.Open();
+		//MyKLink1.Open();
 	}
 	if (!m_bOnline) return;
 //	m_bOnline = true;
@@ -1229,17 +1491,32 @@
 void CMTerm1Doc::OnSimulate()
 {
 	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
+	CString s1;
+	unsigned short* p1 = (unsigned short *)&BinProgs;
 	if (!m_bSimulate) {
-		myKMachine1.Download(BinProgs, nBinProgSteps);
-		myKMachine1.StartPLC();
+	
+		s1.Format(_T("鍚姩PLC妯℃嫙\r\n"));
+		SysLog(s1);
 		m_bSimulate = true;
+		s1.Empty();
+		for (int i = 0; i < nBinProgSteps; i++) {
+			s1.AppendFormat(_T("%04X %04X "), p1[i*2],p1[i*2+1]);
+		}
+		SysLog(s1);
+		s1.Format(_T("Download %d program to sim PLC"),nBinProgSteps);
+		SysLog(s1);
+		myKMachine1.Download(BinProgs, nBinProgSteps);
 		m_bOnline = true;
+		myKMachine1.StartPLC();
+		s1.Format(_T("Start sim PLC"));
+		SysLog(s1);
 		StartPLC();
 	}
 	else {
+		StopPLC();
 		m_bSimulate = false;
 		m_bOnline = false;
-		StopPLC();
+
 	}
 	UpdateAllViews(NULL, UpdataHint::UpdateStat);
 }
@@ -1253,23 +1530,28 @@
 int CMTerm1Doc::StartPLC()
 {
 	// TODO: 鍦ㄦ澶勬坊鍔犲疄鐜颁唬鐮�.
-	for (int i = 0; i < KLDataWXCount; i++) {
-		KMem.WX[i] = 0;
+	if (m_bSimulate) {
+		for (int i = 0; i < KLDataWXCount; i++) {
+			KMem.WX[i] = 0;
+		}
+		for (int i = 0; i < KLDataWYCount; i++) {
+			KMem.WY[i] = 0;
+		}
+		for (int i = 0; i < KLDataWRCount; i++) {
+			KMem.WR[i] = 0;
+		}
+		for (int i = 0; i < KLDataDTCount; i++) {
+			KMem.DT[i] = 0;
+		}
+		for (int i = 0; i < TOTALTIMERS; i++) {
+			KMem.Timers[i] = { 0 };
+		}
+		nScanCount = 0;
+		m_bPlcRunning = 1;
+	}else {
+		MyKLink1.ChangeMode(1, 1);
+		m_bPlcRunning = 1;
 	}
-	for (int i = 0; i < KLDataWYCount; i++) {
-		KMem.WY[i] = 0;
-	}
-	for (int i = 0; i < KLDataWRCount; i++) {
-		KMem.WR[i] = 0;
-	}
-	for (int i = 0; i < KLDataDTCount; i++) {
-		KMem.DT[i] = 0;
-	}
-	for (int i = 0; i < TOTALTIMERS; i++) {
-		KMem.Timers[i] = { 0 };
-	}
-	nScanCount = 0;
-	m_bPlcRunning = 1;
 	return 0;
 }
 
@@ -1277,8 +1559,13 @@
 int CMTerm1Doc::StopPLC()
 {
 	// TODO: 鍦ㄦ澶勬坊鍔犲疄鐜颁唬鐮�.
-
-	m_bPlcRunning = false;
+	if (m_bSimulate) {
+		m_bPlcRunning = false;
+	}
+	else {
+		MyKLink1.ChangeMode(1, 0);
+		m_bPlcRunning = false;
+	}
 
 	return 0;
 }
@@ -1340,7 +1627,60 @@
 	int res = MyKLink1.Connect();
 	unsigned short len1;
 	int j=MyKLink1.GetInfo(1, &len1, buf1);
-	s1.Format(_T("GetInfo = %d %d"), j,len1);
+	s1.Format(_T("GetInfo = %d %d \r\n"), j,len1);
+	if (j==0 && len1 > 0) {
+		for (int i = 0; i < len1/2; i++) {
+			s1.AppendFormat(_T("%04X "), buf1[i]);
+		}
+		s1 += _T("\r\n");
+		pKMInfoBlock pinfob = (pKMInfoBlock)buf1;
+
+		s1.AppendFormat(_T(" DeviceType %04X \r\n"),pinfob->nDeviceTypeVer);
+		s1.AppendFormat(_T(" nProgVer %04X \r\n"), pinfob->nProgVer);
+		s1.AppendFormat(_T(" nKLinkVer %04X \r\n"), pinfob->nKLinkVer);
+		s1.AppendFormat(_T(" nKBusVer %04X \r\n"), pinfob->nKBusVer);
+		s1.AppendFormat(_T(" nCapacity1 %d k\r\n"), pinfob->nCapacity1);
+		s1.AppendFormat(_T(" nCapacity2 %d k\r\n"), pinfob->nCapacity2);
+		s1.AppendFormat(_T(" nDInput %d \r\n"), pinfob->nDInput);
+		s1.AppendFormat(_T(" nDOutput %d \r\n"), pinfob->nDOutput);
+		s1.AppendFormat(_T(" nAInput %d \r\n"), pinfob->nAInput);
+		s1.AppendFormat(_T(" nAOutput %d \r\n"), pinfob->nAOutput);
+		s1.AppendFormat(_T(" nHInput %d \r\n"), pinfob->nHInput);
+		s1.AppendFormat(_T(" nHOutput %d \r\n"), pinfob->nHOutput);
+		s1.AppendFormat(_T(" nExt1 %d \r\n"), pinfob->nExt1);
+		s1.AppendFormat(_T(" nExt2 %d \r\n"), pinfob->nExt2);
+		s1.AppendFormat(_T(" nLogSize %d \r\n"), pinfob->nLogSize);
+		s1.AppendFormat(_T(" nPorts %d \r\n"), pinfob->nPorts);
+		s1.AppendFormat(_T(" nManSize %d \r\n"), pinfob->nManSize);
+		s1.AppendFormat(_T(" nAbility %d \r\n"), pinfob->nAbility);
+		s1.AppendFormat(_T(" nSwitchBits %d \r\n"), pinfob->nSwitchBits);
+
+	}
+	SysLog(s1);
+	int r = MyKLink1.ReadRunStat(1, 0, 0, 32, (unsigned short*)&MyKLink1.KMRunStat);
+	s1.Format(_T("GetRunStat = %d %d \r\n"), r, 32);
+	KLink1::stRunStat RunStat1 = MyKLink1.KMRunStat;
+
+	s1.AppendFormat(_T(" Sign1 %04X \r\n"), RunStat1.Sign1);
+	s1.AppendFormat(_T(" Seq1 %d \r\n"), RunStat1.Seq1);
+	s1.AppendFormat(_T(" PowerCount %d \r\n"), RunStat1.PowerCount);
+	s1.AppendFormat(_T(" Reserved1 %d \r\n"), RunStat1.Reserved1);
+	s1.AppendFormat(_T(" UpTime %d \r\n"), RunStat1.UpTime);
+	s1.AppendFormat(_T(" UserData1 %d \r\n"), RunStat1.UserData1);
+	s1.AppendFormat(_T(" WorkMode %d \r\n"), RunStat1.WorkMode);
+	s1.AppendFormat(_T(" WorkMode2 %d \r\n"), RunStat1.WorkMode2);
+	s1.AppendFormat(_T(" nBinProgBank %d \r\n"), RunStat1.nBinProgBank);
+	s1.AppendFormat(_T(" nBinProgSize %d \r\n"), RunStat1.nBinProgSize);
+	s1.AppendFormat(_T(" bLEDFlick %d \r\n"), RunStat1.bLEDFlick);
+	s1.AppendFormat(_T(" Reserved2 %d \r\n"), RunStat1.Reserved2);
+	s1.AppendFormat(_T(" CRC1 %04X \r\n"), RunStat1.CRC1);
+	s1.AppendFormat(_T(" EndSign1 %04X \r\n"), RunStat1.EndSign1);
+
+	unsigned char value;
+	r = MyKLink1.GetMode(1, 0, &value);
+	if (r == KLink1::KL_OK) { m_bPlcRunning = value; }
+
+
 	SysLog(s1);
 //	m_static_connect.SetCtlColor(RGB(0, 255, 0));
 /*
@@ -1889,6 +2229,20 @@
 			KMem.WY[i] = myKMachine1.KMem.WY[i];
 		}
 
+		nDataType = MyKLink1.KLDataTypeWLX;
+		nDataAddr = 0;
+		nDataCount = 4;
+		for (int i = 0; i < nDataCount; i++) {
+			KMem.WLX[i] = myKMachine1.KMem.WLX[i];
+		}
+
+		nDataType = MyKLink1.KLDataTypeWLY;
+		nDataAddr = 0;
+		nDataCount = 4;
+		for (int i = 0; i < nDataCount; i++) {
+			KMem.WLY[i] = myKMachine1.KMem.WLY[i];
+		}
+
 		nDataType = MyKLink1.KLDataTypeWR;
 		nDataAddr = 0;
 		nDataCount = 10;
@@ -1942,6 +2296,25 @@
 			s1.Format(_T("R:= %d %s  \r\n"), res, MyKLink1.m_resultStr);
 			SysLog(s1);
 		}
+
+		nDataType = MyKLink1.KLDataTypeWLX;
+		nDataAddr = 0;
+		nDataCount = 4;
+		res = MyKLink1.ReadDataWord(1, nDataType, nDataAddr, nDataCount, &nCount, KMem.WLX);// (unsigned char *)&KMem.DT[nDataAddr]);
+		if (res != MyKLink1.KL_OK) {
+			s1.Format(_T("R:= %d %s  \r\n"), res, MyKLink1.m_resultStr);
+			SysLog(s1);
+		}
+
+		nDataType = MyKLink1.KLDataTypeWLY;
+		nDataAddr = 0;
+		nDataCount = 4;
+		res = MyKLink1.ReadDataWord(1, nDataType, nDataAddr, nDataCount, &nCount, KMem.WLY);// (unsigned char *)&KMem.DT[nDataAddr]);
+		if (res != MyKLink1.KL_OK) {
+			s1.Format(_T("R:= %d %s  \r\n"), res, MyKLink1.m_resultStr);
+			SysLog(s1);
+		}
+
 		nDataType = MyKLink1.KLDataTypeWR;
 		nDataAddr = 0;
 		nDataCount = 10;
diff --git a/MTerm1/MTerm1View.cpp b/MTerm1/MTerm1View.cpp
index bd3a8bd..a34e24c 100644
--- a/MTerm1/MTerm1View.cpp
+++ b/MTerm1/MTerm1View.cpp
@@ -17,6 +17,7 @@
 #include "DialogSetData.h"
 #include "DialogIoComment.h"
 #include "KDefine.h"
+#include "MainFrm.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -344,24 +345,31 @@
 			}
 		}
 		// 鑾峰彇鏁版嵁  骞舵樉绀哄悇鍗曞厓
+
 		for (int j = 0; j < m_CellPerLine; j++) {
 			nCol = j;
 			nDataType = Cells[nRow][nCol].nDataType;
 			nDataAddr = Cells[nRow][nCol].nDataAddr;
-			if ((nDataType&TYPEDATA) == TYPEDATA) {
-				nStat = pDoc->GetVarData(nDataType, nDataAddr);
+			if (m_bMonitoring) {
+				if ((nDataType & TYPEDATA) == TYPEDATA) {
+					nStat = pDoc->GetVarData(nDataType, nDataAddr);
+				}
+				else {
+					nStat = pDoc->GetCoilValue(nDataType, nDataAddr);
+				}
+				Cells[nRow][nCol].nStat = nStat;
+				nType = Cells[nRow][nCol].nType;
+				if (nType == typeNO || nType == typeNC || nType == typeCMP || nType == typeTM)
+				{
+					int nProgStep = Cells[nRow][nCol].nProgStep;
+					int nBinProgStep = pDoc->Progs[nProgStep].nBinStep;
+					Cells[nRow][nCol].nTrace = pDoc->ProgTrace[nBinProgStep];
+				}
 			}
 			else {
-				nStat = pDoc->GetCoilValue(nDataType, nDataAddr);
+				Cells[nRow][nCol].nStat = 0; Cells[nRow][nCol].nTrace = 0;
 			}
-			Cells[nRow][nCol].nStat = nStat;
-			nType = Cells[nRow][nCol].nType;
-			if (nType == typeNO || nType == typeNC || nType == typeCMP || nType == typeTM)
-			{
-				int nProgStep = Cells[nRow][nCol].nProgStep;
-				int nBinProgStep = pDoc->Progs[nProgStep].nBinStep;
-				Cells[nRow][nCol].nTrace = pDoc->ProgTrace[nBinProgStep];
-			}
+
 			DrawCell(pDC, i, j);
 		}
 
@@ -1130,6 +1138,23 @@
 
 	CScrollView::OnKeyDown(nChar, nRepCnt, nFlags);
 }
+int CMTerm1View::CellFocusChg(int nRow, int nCol)
+{
+	CString s1;
+	stCell & thecell = Cells[nRow][nCol];
+	s1.Format(_T("Cell %d %d Type %02X \r\n"), nRow, nCol, thecell.nType);
+	s1.AppendFormat(_T(" sCoilName %s sParam %s \r\n"), thecell.sCoilName, thecell.sParam );
+	s1.AppendFormat(_T("LeftUp %d leftDn %d "), thecell.bLeftLineUp, thecell.bLeftLineDn);
+	DbgLog(s1);
+
+	auto p1 = (CMainFrame*)AfxGetMainWnd();
+	auto p2 = p1->GetInputWnd();
+	p2->SetCurCellPos(nRow,nCol,thecell);
+
+
+
+	return 0;
+}
 
 void CMTerm1View::OnLButtonDown(UINT nFlags, CPoint point)
 {
@@ -1156,6 +1181,7 @@
 	}
 
 	//	DrawFocusRect();
+	CellFocusChg(nRow, nCol);
 	GetDocument()->UpdateAllViews(this, m_FocusCol);
 	needReDraw = 1;
 	this->RedrawWindow();
@@ -1470,15 +1496,19 @@
 	return -1;
 }
 
-void CMTerm1View::GetIncToView(stCell cell1)               //**************************************************************************************************//
+void CMTerm1View::SetCellToView(stCell cell1)               //**************************************************************************************************//
 {
 
-
 	Cells[m_FocusRow][m_FocusCol] = cell1;
-
 	m_bModified = 1;
 	needReDraw = 1;
 	m_FocusCol += 1;
+	Cells[m_FocusRow][0].bEditing = 1;
+
+	if (m_nTotalRow < m_FocusRow + 1) {
+		m_nTotalRow = m_FocusRow + 1;
+	}
+
 	if (m_FocusCol >= 16) 
 	{ m_FocusCol = 0;m_FocusRow += 1; }
 	
@@ -2442,6 +2472,8 @@
 	DbgLog(s1);
 	for (int i = 0; i < n; i++)	{
 		int optype=allprogs.Progs[i].nOpType1;
+		allprogs.Progs[i].PairTo = 0;
+		allprogs.Progs[i].nBinStep = i;
 		CStringA OpTxtA,OpShowTxtA;
 		CString OpTxt,OpShowTxt;
 		pDoc->OpToTxt(optype, OpTxtA);
@@ -2449,8 +2481,10 @@
 		OpTxt = OpTxtA;
 		OpShowTxt = OpShowTxtA;
 		s1.Format(_T("%d %s %s"), optype, OpTxt, OpShowTxt);
+		pDoc->Progs[i] = allprogs.Progs[i];
 //		DbgLog(s1);
 	}
+	pDoc->m_nProgSteps = n;
 	return 0;
 }
 
@@ -2462,25 +2496,37 @@
 	int nNextX = 1;
 	nCurPosY = nPosY;
 	nCurPosX = nPosX;
-
+	int nCoilType, CoilAddr;
+	CMTerm1Doc* pDoc = GetDocument();
 	for (int j = nPosX; j < m_CellPerLine; j+=nNextX) {
 		nCurPosX = j;
 		//鍏堝鐞嗗綋鍓嶅崟鍏�;
 		int nType = Cells[nCurPosY][nCurPosX].nType;
 		CString sCellName = Cells[nCurPosY][nCurPosX].sCoilName;
 		CMTerm1Doc::stProg theprog;
-
+		CStringA sCellNameA;
+		sCellNameA = sCellName;
 		if (nType == typeNO) {
 			if (j==0) {
 				s1.Format(_T("%d %d ST %s"), nCurPosY, nCurPosX,sCellName);
 				sProgSec.AppendFormat(_T("ST %s\r\n"),sCellName);
 				theprog.nOpType1 = OP_ST;
+				theprog.nParamCount = 1;
+				pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr);
+				theprog.Params[0].nParamType = nCoilType;
+				theprog.Params[0].nParamAddr = CoilAddr;
+				theprog.Params[0].sParamStr = sCellNameA;
 				progsec.Append(theprog);
 			}
 			else {
 				s1.Format(_T("%d %d AN %s"), nCurPosY, nCurPosX, sCellName);
 				sProgSec.AppendFormat(_T("NO %s\r\n"), sCellName);
 				theprog.nOpType1 = OP_AN;
+				theprog.nParamCount = 1;
+				pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr);
+				theprog.Params[0].nParamType = nCoilType;
+				theprog.Params[0].nParamAddr = CoilAddr;
+				theprog.Params[0].sParamStr = sCellNameA;
 				progsec.Append(theprog);
 			}
 			nSteps += 1;
@@ -2492,6 +2538,11 @@
 				s1.Format(_T("%d %d ST/ %s"), nCurPosY, nCurPosX, sCellName);
 				sProgSec.AppendFormat(_T("ST/ %s\r\n"), sCellName);
 				theprog.nOpType1 = OP_ST_;
+				theprog.nParamCount = 1;
+				pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr);
+				theprog.Params[0].nParamType = nCoilType;
+				theprog.Params[0].nParamAddr = CoilAddr;
+				theprog.Params[0].sParamStr = sCellNameA;
 				progsec.Append(theprog);
 
 			}
@@ -2500,6 +2551,11 @@
 				s1.Format(_T("%d %d AN/ %s"), nCurPosY, nCurPosX, sCellName);
 				sProgSec.AppendFormat(_T("AN/ %s\r\n"), sCellName);
 				theprog.nOpType1 = OP_AN_;
+				theprog.nParamCount = 1;
+				pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr);
+				theprog.Params[0].nParamType = nCoilType;
+				theprog.Params[0].nParamAddr = CoilAddr;
+				theprog.Params[0].sParamStr = sCellNameA;
 				progsec.Append(theprog);
 			}
 			DbgLog(s1);
@@ -2554,6 +2610,11 @@
 			DbgLog(s1);
 			sProgSec.AppendFormat(_T("OUT %s\r\n"), sCellName);
 			theprog.nOpType1 = OP_OUT;
+			theprog.nParamCount = 1;
+			pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr);
+			theprog.Params[0].nParamType = nCoilType;
+			theprog.Params[0].nParamAddr = CoilAddr;
+			theprog.Params[0].sParamStr = sCellNameA;
 			progsec.Append(theprog);
 			nSteps += 1;
 			nNextX =  1;
@@ -2563,6 +2624,11 @@
 			DbgLog(s1);
 			sProgSec.AppendFormat(_T("SET %s\r\n"), sCellName);
 			theprog.nOpType1 = OP_SET;
+			theprog.nParamCount = 1;
+			pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr);
+			theprog.Params[0].nParamType = nCoilType;
+			theprog.Params[0].nParamAddr = CoilAddr;
+			theprog.Params[0].sParamStr = sCellNameA;
 			progsec.Append(theprog);
 			nSteps += 1;
 			nNextX =  1;
@@ -2572,6 +2638,11 @@
 			DbgLog(s1);
 			sProgSec.AppendFormat(_T("RESET %s\r\n"), sCellName);
 			theprog.nOpType1 = OP_RESET;
+			theprog.nParamCount = 1;
+			pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr);
+			theprog.Params[0].nParamType = nCoilType;
+			theprog.Params[0].nParamAddr = CoilAddr;
+			theprog.Params[0].sParamStr = sCellNameA;
 			progsec.Append(theprog);
 			nSteps += 1;
 			nNextX =  1;
@@ -2580,6 +2651,7 @@
 			s1.Format(_T("%d %d CMP %s %s %s"), nCurPosY, nCurPosX, sCellName,Cells[nCurPosY][nCurPosX+1].sParam,Cells[nCurPosY][nCurPosX + 2].sParam);
 			DbgLog(s1);
 			theprog.nOpType1 = OP_ST_GT;
+			theprog.nParamCount = 1;
 			progsec.Append(theprog);
 			sProgSec.AppendFormat(_T("CMP %s %s %s \r\n"), sCellName, Cells[nCurPosY][nCurPosX + 1].sParam, Cells[nCurPosY][nCurPosX + 2].sParam);
 			nSteps += 1;
@@ -2589,6 +2661,11 @@
 			s1.Format(_T("%d %d TM %s %d %s"), nCurPosY, nCurPosX, sCellName,Cells[nCurPosY][nCurPosX+1].sParam,Cells[nCurPosY][nCurPosX + 2].sParam);
 			DbgLog(s1);
 			theprog.nOpType1 = OP_TMX;
+			theprog.nParamCount = 1;
+			pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr);
+			theprog.Params[0].nParamType = nCoilType;
+			theprog.Params[0].nParamAddr = CoilAddr;
+			theprog.Params[0].sParamStr = sCellNameA;
 			progsec.Append(theprog);
 			sProgSec.AppendFormat(_T("TM %s %d %s\r\n"), sCellName, Cells[nCurPosY][nCurPosX+1].sParam, Cells[nCurPosY][nCurPosX + 2].sParam);
 			nSteps += 1;
diff --git a/MTerm1/MTerm1View.h b/MTerm1/MTerm1View.h
index 85053dc..4276493 100644
--- a/MTerm1/MTerm1View.h
+++ b/MTerm1/MTerm1View.h
@@ -48,7 +48,7 @@
 		typeRESET=21,
 
 		typeCMP,
-		typeExt1,		//琚墠闈㈢殑鎸囦护鍗犵敤鐨勭┖闂�
+		typeExt1,	//23 0x17	//琚墠闈㈢殑鎸囦护鍗犵敤鐨勭┖闂�
 		typeExt2,
 		typeExt3,
 
@@ -62,28 +62,28 @@
 	};
 	struct stCell
 	{
-		int nType;
-		int nProgStep;
-		int bFocused = 0;
-		int bSelected = 0;
-		int bEditing = 0;
-		int bModified = 0;
+		int nType;				//鍗曞厓绫诲瀷銆�
+		int nProgStep;			//瀵瑰簲绋嬪簭鐨勬鏁�
+		int bFocused = 0;		//鐑偣閫変腑
+		int bSelected = 0;		//閫変腑
+		int bEditing = 0;		//缂栬緫涓�
+		int bModified = 0;		//琚慨鏀逛簡
 
-		int bErrFocus = 0;
+		int bErrFocus = 0;		//閿欒鐑偣
 
-		int bLeftLineUp = 0;
-		int bLeftLineDn = 0;
-		int nStat = 0;
-		int nTrace = 0;
-		int nDataWidth = 0;
-		int nDataType=0;
-		int nDataAddr=0;
-		CString sParam;
-		CString sCoilName;
+		int bLeftLineUp = 0;	//宸︿晶鍚戜笂绔栫嚎
+		int bLeftLineDn = 0;	//宸︿晶鍚戜笅绔栫嚎
+		int nStat = 0;			//褰撳墠鐘舵��//   鐩戞帶鏃舵牴鎹姸鎬侊紝鏄剧ず鏁板�兼垨鑹插潡
+		int nTrace = 0;			//褰撳墠璺熻釜鐘舵��
+//		int nDataWidth = 0;
+		int nDataType=0;		//鍙傛暟鏁版嵁绫诲瀷
+		int nDataAddr=0;		//鍙傛暟鏁版嵁鍦板潃/鍊�
+		CString sParam;			//鍙傛暟鍚�
+		CString sCoilName;		//绾垮湀鍚�
 		void clear() { 
 			nType = 0; bFocused = 0; bSelected = 0; bEditing = 0; bModified = 0;
 			bLeftLineUp = 0; bLeftLineDn = 0; nStat = 0;
-			nDataWidth = 0; nDataType = 0; nDataAddr = 0;
+			nDataType = 0; nDataAddr = 0;
 			sParam.Empty(); sCoilName.Empty();
 		}
 	};
@@ -206,6 +206,7 @@
 
 	int ScrollCellIntoView(int nRow, int nCol);
 	int isCellInView(int nRow, int nCol);
+	int CellFocusChg(int nRow, int nCol);
 
 // 閲嶅啓
 public:
@@ -281,7 +282,7 @@
 	afx_msg void OnInputIoComment();
 	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
 	int ScanLDSCells(int nStartLine, int nEndLine, int nPosY, int nPosX, int nLevel, stProgSection & progsec, CString & sProgSec, int &nSteps);
-	void GetIncToView(stCell cell1);
+	void SetCellToView(stCell cell1);
 
 };
 
diff --git a/MTerm1/MainFrm.cpp b/MTerm1/MainFrm.cpp
index 176f4fa..bdd1f4b 100644
--- a/MTerm1/MainFrm.cpp
+++ b/MTerm1/MainFrm.cpp
@@ -37,34 +37,14 @@
 	ON_UPDATE_COMMAND_UI(ID_VIEW_INPUTSEG_BAR, &CMainFrame::OnUpdateViewInputsegBar)
 	ON_COMMAND(ID_VIEW_COMMENTS_BAR, &CMainFrame::OnViewCommentsBar)
 	ON_UPDATE_COMMAND_UI(ID_VIEW_COMMENTS_BAR, &CMainFrame::OnUpdateViewCommentsBar)
-	ON_COMMAND(ID_BUTTON_0, &CMainFrame::OnBtn0)
-	ON_COMMAND(ID_BUTTON_1, &CMainFrame::OnBtn1)
-	ON_COMMAND(ID_BUTTON_2, &CMainFrame::OnBtn2)
-	ON_COMMAND(ID_BUTTON_3, &CMainFrame::OnBtn3)
-	ON_COMMAND(ID_BUTTON_4, &CMainFrame::OnBtn4)
-	ON_COMMAND(ID_BUTTON_5, &CMainFrame::OnBtn5)
-	ON_COMMAND(ID_BUTTON_6, &CMainFrame::OnBtn6)
-	ON_COMMAND(ID_BUTTON_7, &CMainFrame::OnBtn7)
-	ON_COMMAND(ID_BUTTON_8, &CMainFrame::OnBtn8)
-	ON_COMMAND(ID_BUTTON_9, &CMainFrame::OnBtn9)
-	ON_COMMAND(ID_BUTTON_A, &CMainFrame::OnBtnA)
-	ON_COMMAND(ID_BUTTON_B, &CMainFrame::OnBtnB)
-	ON_COMMAND(ID_BUTTON_C, &CMainFrame::OnBtnC)
-	ON_COMMAND(ID_BUTTON_D, &CMainFrame::OnBtnD)
-	ON_COMMAND(ID_BUTTON_E, &CMainFrame::OnBtnE)
-	ON_COMMAND(ID_BUTTON_F, &CMainFrame::OnBtnF)
-	ON_COMMAND(ID_BUTTON_MINUS, &CMainFrame::OnBtnMinus)
-	ON_COMMAND(ID_BUTTON_DOT, &CMainFrame::OnBtnDot)
-	ON_COMMAND(ID_BUTTON_RET, &CMainFrame::OnBtnRet)
-	ON_COMMAND(ID_BUTTON_INSERT, &CMainFrame::OnBtnInsert)
-	ON_COMMAND(ID_BUTTON_DELETE, &CMainFrame::OnBtnDelete)
-	ON_COMMAND(ID_BUTTON_ESC, &CMainFrame::OnBtnEsc)
+
 //	ON_COMMAND(ID_MENU_VIEW_LDS, &CMainFrame::OnMenuViewLds)
 //	ON_COMMAND(ID_MENU_VIEW_BLD, &CMainFrame::OnMenuViewBld)
 //	ON_COMMAND(ID_MENU_VIEW_BNL, &CMainFrame::OnMenuViewBnl)
 
 ON_COMMAND(ID_MENU_SHOW_LOG, &CMainFrame::OnMenuShowLog)
 ON_COMMAND(ID_MENU_SHOW_DEV, &CMainFrame::OnMenuShowDev)
+ON_COMMAND(ID_MENU_SHOWNAV, &CMainFrame::OnMenuShownav)
 END_MESSAGE_MAP()
 
 static UINT indicators[] =
@@ -233,6 +213,17 @@
 		return FALSE;
 	}
 	m_wndMyPaneLog.EnableDocking(CBRS_ALIGN_ANY);
+//*/
+// // 
+///*
+	
+	if (!m_wndMyPaneInputShow.Create(_T("杈撳叆绐楀彛"), this, CRect(2, 2, 20, 20), TRUE, 1236, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
+		| WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI))
+	{
+		TRACE0("鏈兘鍒涘缓鈥淢yPaneInputShow绐楀彛\n");
+		return FALSE;
+	}
+	m_wndMyPaneInputShow.EnableDocking(CBRS_ALIGN_BOTTOM);
 
 //*/
 //	m_dlgMyLog.Create(m_dlgMyLog.IDD, this);
@@ -270,9 +261,11 @@
 //	DockPane(&m_wndToolBar_Func_Key);
 //	DockPane(&m_wndDlgBar_Func_Key);
 //	DockControlBar(&m_wndDlgBar_Func_Key);
+	DockPane(&m_wndMyPaneInputShow);
 	DockPane(&m_wndNavView);
 	DockPane(&m_wndMyPaneLog);
 
+//	m_wndMyPaneInputShow.m_pMyFormInputShow->SetBtnDisplayESC(1);
 
 //*/
 	return 0;
@@ -433,206 +426,44 @@
 	s1.Format(_T("From MainFrame , input %s"), m_InputInfo);
 	SysLog(s1);
 
+	//	m_wndDlgBar_InputShow.SetDisplay(inputInfo);
+
+	return 0;
+}
+
+int CMainFrame::SetDisplayInfo(int Info)
+{
+	// TODO: 鍦ㄦ澶勬坊鍔犲疄鐜颁唬鐮�.
+	CString        m_InputInfo;
+
+	CString s1;
+	s1.Format(_T("From MainFrame , SetDisplayInfo %x"), Info);
+	SysLog(s1);
+
+	//	m_wndDlgBar_InputShow.SetDisplay(inputInfo);
+	m_wndMyPaneInputShow.m_pMyFormInputShow->SetDisplay(Info);
+	return 0;
+}
+
+int CMainFrame::SetCellInfo(int info)
+{
+	// TODO: 鍦ㄦ澶勬坊鍔犲疄鐜颁唬鐮�.
+	CString        m_InputInfo;
+
+	CString s1;
+	s1.Format(_T("From MainFrame , SetCellInfo %x"), info);
+	SysLog(s1);
+
 //	m_wndDlgBar_InputShow.SetDisplay(inputInfo);
 
 	return 0;
 }
 
-void CMainFrame::OnBtn0()
+int CMainFrame::GetInputCell(tagInputCell inputCell)
 {
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-//	m_wndDlgBar_InputShow.SetDisplay(0x00030000);
-}
-void CMainFrame::OnBtn1()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-//	m_wndDlgBar_InputShow.SetDisplay(0x00030001);
-}
-void CMainFrame::OnBtn2()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-//	m_wndDlgBar_InputShow.SetDisplay(0x00030002);
-}
-void CMainFrame::OnBtn3()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-//	m_wndDlgBar_InputShow.SetDisplay(0x00030003);
-}
-void CMainFrame::OnBtn4()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-//	m_wndDlgBar_InputShow.SetDisplay(0x00030004);
-}
-void CMainFrame::OnBtn5()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-//	m_wndDlgBar_InputShow.SetDisplay(0x00030005);
-}
-void CMainFrame::OnBtn6()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-//	m_wndDlgBar_InputShow.SetDisplay(0x00030006);
-}
-void CMainFrame::OnBtn7()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-//	m_wndDlgBar_InputShow.SetDisplay(0x00030007);
-}
-void CMainFrame::OnBtn8()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-//	m_wndDlgBar_InputShow.SetDisplay(0x00030008);
-}
-void CMainFrame::OnBtn9()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-//	m_wndDlgBar_InputShow.SetDisplay(0x00030009);
-}
-void CMainFrame::OnBtnA()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-//	m_wndDlgBar_InputShow.SetDisplay(0x0003000A);
-}
-void CMainFrame::OnBtnB()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-//	m_wndDlgBar_InputShow.SetDisplay(0x0003000B);
-}
-void CMainFrame::OnBtnC()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-//	m_wndDlgBar_InputShow.SetDisplay(0x0003000C);
-}
 
-void CMainFrame::OnBtnD()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-//	m_wndDlgBar_InputShow.SetDisplay(0x0003000D);
-}
-void CMainFrame::OnBtnE()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-//	m_wndDlgBar_InputShow.SetDisplay(0x0003000E);
-}
-void CMainFrame::OnBtnF()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-
-//	m_wndDlgBar_InputShow.SetDisplay(0x0003000F);
-
-
-
-}
-void CMainFrame::OnBtnMinus()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-	//m_wndDlgBar_InputShow.SetDisplay(_T("-"));
-}
-void CMainFrame::OnBtnDot()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-	//m_wndDlgBar_InputShow.SetDisplay(_T("."));
-}
-
-
-
-
-int CMainFrame::GetInputCell(CMyDlgBarInputShow::tagInputCell inputCell)
-{
-	
-	localInputCell = inputCell;
+	//	localInputCell = inputCell;
 	return 0;
-}
-
-
-void CMainFrame::OnBtnRet()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-	CString strName;
-	 CMTerm1View::stCell cell1;
-
-	CMDIChildWnd  *pChild = (CMDIChildWnd   *)GetActiveFrame();
-	CView   *p1 = (CView*)pChild->GetActiveView();
-	if (p1 == NULL) return;
-	CMTerm1View * p2 = (CMTerm1View *)p1;
-//	m_wndDlgBar_InputShow.SetDisplay(0x00140000);
-
-	switch (localInputCell.OP)
-	{
-	case CMTerm1View::typeNO:
-	case CMTerm1View::typeNC:
-	case CMTerm1View::typeOUT:
-	case CMTerm1View::typeSET:
-	case CMTerm1View::typeRESET:
-	case CMTerm1View::typeTM:
-		switch (localInputCell.param)
-		{
-		case KLCoilTypeX:
-			strName = "X";
-			break;
-		case KLCoilTypeY:
-			strName = "Y";
-			break;
-		case KLCoilTypeR:
-			strName = "R";
-			break;
-		case KLCoilTypeLR:
-			strName = "L";
-			break;
-		case KLCoilTypeT:
-			strName = "T";
-			break;
-		case KLCoilTypeC:
-			strName = "C";
-			break;
-		case OP_TMX:
-			strName = "TMX   ";
-		case OP_TMY:
-			strName = "TMY   ";
-		case OP_TMR:
-			strName = "TMR   ";
-		case OP_TML:
-			strName = "TML   ";
-		default:
-			break;
-		}
-	default:
-		break;		
-	}
-
-
-
-	cell1.sCoilName = strName + localInputCell.num;
-	cell1.nType = localInputCell.OP;
-	//cell1.sCoilName = "R555";
-	cell1.nProgStep = 0;
-	cell1.bEditing = 1;
-	cell1.sParam = "D88";
-	cell1.bLeftLineUp = 0;
-	cell1.nDataType = CMTerm1View::typeCoil;
-
-	p2->GetIncToView(cell1);   
-
-	
-//	m_wndDlgBar_Func_Key.SetBtnDisplayESC();
-}
-void CMainFrame::OnBtnInsert()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-//	m_wndDlgBar_InputShow.SetDisplay(0x00240000);
-//	m_wndDlgBar_Func_Key.SetBtnDisplayESC();
-}
-void CMainFrame::OnBtnDelete()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-//	m_wndDlgBar_InputShow.SetDisplay(0x00340000);
-//	m_wndDlgBar_Func_Key.SetBtnDisplayESC();
-}
-void CMainFrame::OnBtnEsc()
-{
-	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
-	//m_wndDlgBar_InputShow.SetDisplay(_T("Esc"));
-//	m_wndDlgBar_Func_Key.SetBtnDisplayESC();
 }
 
 void CMainFrame::OnMenuShowDev()
@@ -640,3 +471,9 @@
 	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
 
 }
+
+void CMainFrame::OnMenuShownav()
+{
+	// TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜
+	m_wndNavView.ShowWindow(SW_SHOW);
+}
diff --git a/MTerm1/MainFrm.h b/MTerm1/MainFrm.h
index 577a66a..abe45d0 100644
--- a/MTerm1/MainFrm.h
+++ b/MTerm1/MainFrm.h
@@ -13,6 +13,8 @@
 #include "MyDlgBarFuncKey.h"
 #include "MyDialogLog.h"
 #include "MyDlgBarInputShow.h"
+#include "CMyPaneInputShow.h"
+
 
 class CMainFrame : public CMDIFrameWndEx
 {
@@ -41,24 +43,26 @@
 protected:  // 鎺т欢鏉″祵鍏ユ垚鍛�
 	CMFCToolBar          m_wndToolBar;
 
-	CMyFuncKeyToolBar   m_wndToolBar_Func_Key;
+//	CMyFuncKeyToolBar   m_wndToolBar_Func_Key;
 //	CMyDlgBarFuncKey	m_wndDlgBar_Func_Key;  
 //	CToolBar          m_wndTBar_Edit_Key;
 //	CToolBar          m_wndTBar_Num_Key;
 //	CToolBar          m_wndTBar_InputShow;
 //	CMyDlgBarInputShow m_wndDlgBar_InputShow;
 
-	CToolBar          m_wndToolBar_Comments;
+//	CToolBar          m_wndToolBar_Comments;
 	
 	CNavView        m_wndNavView;
 
-	CEdit				m_InputShowEdit;
-	CStaticEx			m_InputShowStatic;
+//	CEdit				m_InputShowEdit;
+//	CStaticEx			m_InputShowStatic;
 	
-
+	
 	CMyPaneLog		m_wndMyPaneLog;
 //	CMyDialogLog	m_dlgMyLog;
-	CMyDlgBarInputShow::tagInputCell localInputCell;
+
+
+	CMyPaneInputShow m_wndMyPaneInputShow;
 
 // 鐢熸垚鐨勬秷鎭槧灏勫嚱鏁�
 protected:
@@ -80,34 +84,23 @@
 //	afx_msg void OnMenuViewLds();
 //	afx_msg void OnMenuViewBld();
 //	afx_msg void OnMenuViewBnl();
+
+	int SetDisplayInfo(int Info);
+
+	CMyFormInputShow* GetInputWnd() {
+		return m_wndMyPaneInputShow.m_pMyFormInputShow;
+	};
+
+	int SetCellInfo(int info);
 	int GetInputInfo(int inputInfo);
-	int GetInputCell(CMyDlgBarInputShow::tagInputCell inputCell);
+	int GetInputCell(tagInputCell inputCell);
+
 	afx_msg void OnMenuShowLog();
 	virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
-	afx_msg void OnBtn0();
-	afx_msg void OnBtn1();
-	afx_msg void OnBtn2();
-	afx_msg void OnBtn3();
-	afx_msg void OnBtn4();
-	afx_msg void OnBtn5();
-	afx_msg void OnBtn6();
-	afx_msg void OnBtn7();
-	afx_msg void OnBtn8();
-	afx_msg void OnBtn9();
-	afx_msg void OnBtnA();
-	afx_msg void OnBtnB();
-	afx_msg void OnBtnC();
-	afx_msg void OnBtnD();
-	afx_msg void OnBtnE();
-	afx_msg void OnBtnF();
-	afx_msg void OnBtnMinus();
-	afx_msg void OnBtnDot();
-	afx_msg void OnBtnRet();
-	afx_msg void OnBtnInsert();
-	afx_msg void OnBtnDelete();
-	afx_msg void OnBtnEsc();
+
 	afx_msg void OnMenuShowDev();
 
+	afx_msg void OnMenuShownav();
 };
 
 
diff --git a/MTerm1/MyDlgBarInputShow.cpp b/MTerm1/MyDlgBarInputShow.cpp
index 884e1f1..72902ff 100644
--- a/MTerm1/MyDlgBarInputShow.cpp
+++ b/MTerm1/MyDlgBarInputShow.cpp
@@ -1872,7 +1872,7 @@
 		if (editEndFlag)
 		{
 			CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd();
-			p1->GetInputCell(stInputCell);
+//			p1->GetInputCell(stInputCell);
 		}
 		else
 		{
@@ -2285,951 +2285,7 @@
 int CMyDlgBarInputShow::SetDisplay1(int inputInfo)
 {
 	// TODO: 鍦ㄦ澶勬坊鍔犲疄鐜颁唬鐮�.
-/*
-	static int clickCounter = 0;
-	static int clickCounterDF = 0;
-	static int clickCounterNot = 0;
-	static char curTaskState = 'A';
-	static int lastLParam = 0;
-	static CString str, strStoreB, strStoreC, strNum;
-	static CString strOp, strParam;
 
-	CString s1,strNumTemp;
-	int para=0;
-	int HParam, LParam;
-	s1.Format(_T("is this window %d"), IsWindow(m_hWnd));
-	SysLog(s1);
-//	ChangeState(inputInfo>>16, lastTaskState, curTaskState);
-	if (inputInfo == 0x00010008)
-	{ 
-		clickCounterDF++;
-		if (clickCounterDF == 1)                     //DF  redefine key value
-		{
-			
-			inputInfo = 0x00010008;
-		}
-		else if (clickCounterDF == 2)
-		{
-			inputInfo = 0x00010009;
-			clickCounterDF = 0;
-		}
-	}
-	if (inputInfo==0x00010010)
-	{
-		clickCounter++;
-
-		if (clickCounter == 1)  //updown  redefine key value
-		{
-			inputInfo = 0x00010010;
-		}
-		else if (clickCounter == 2)
-		{
-			inputInfo = 0x00010011;
-		}
-		else if (clickCounter == 3)
-		{
-			inputInfo = 0x00010012;
-			clickCounter = 0;
-		}
-	}
-	if (inputInfo == 0x00010013)
-	{
-		clickCounterNot++;
-		if (clickCounterNot == 1)                     //NOT  redefine key value
-		{
-
-			inputInfo = 0x00010013;
-		}
-		else if (clickCounterNot == 2)
-		{
-			inputInfo = 0x00010014;
-			clickCounterNot = 0;
-		}
-	}
- 
-	HParam = inputInfo >> 16;
-	LParam = inputInfo & 0xffff;
-	
-
-	switch (curTaskState)
-	{
-	case 'A':
-		if (HParam == 0x1)                      //operator 1
-		{
-			switch (LParam)
-			{
-			case 1:
-				strOp = _T("-| |-"); strParam = ""; 
-				if (lastLParam != LParam)
-				{
-					clickCounter = 0;
-					clickCounterNot = 0;
-				}
-				lastLParam = LParam;
-				curTaskState = 'B';
-				break;
-			case 2:
-				strOp = _T("鈹斺敜鈹溾敇");strParam = "";
-				if (lastLParam != LParam)
-				{
-					clickCounter = 0;
-					clickCounterNot = 0;
-				}
-				lastLParam = LParam;
-				curTaskState = 'B'; 
-				break;
-			case 3:
-				strOp = _T("-[ ]");strParam = "";
-				if (lastLParam != LParam)
-				{
-					clickCounter = 0;
-					clickCounterNot = 0;
-				}
-				lastLParam = LParam;
-				curTaskState = 'B'; 
-				break;
-			case 4:
-				strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 5:
-				strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 6:
-				strOp = _T("-<S>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break;
-			case 7:
-				strOp = _T("-<R>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break;
-			case 8:
-				strOp = _T("(DF)");strParam = "";
-				if (lastLParam != LParam)
-				{
-					clickCounterNot = 0;
-				}
-				lastLParam = LParam;
-				curTaskState = 'A';
-				break;
-			case 9:
-				strOp = _T("(DF/)");strParam = "";
-				if (lastLParam != LParam)
-				{
-					clickCounterNot = 0;
-				}
-				lastLParam = LParam;
-				curTaskState = 'A';
-				break;
-			case 0x0a:
-				strOp = _T("(ED)");strParam = "";lastLParam = LParam;curTaskState = 'A'; break;
-			case 0x0b:
-				strOp = _T("-[TMX]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 0x0c:
-				strOp = _T("-[TMY]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 0x0d:
-				strOp = _T("-[TMR]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 0x0e:
-				strOp = _T("-[TML]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 0x0f:
-				strOp = _T("-[CT]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 0x10:
-				switch (lastLParam)
-				{
-				case 1:
-					strOp = _T("-|鈫憒-");strParam = "";curTaskState = 'B'; break;
-				case 2:
-					strOp = _T("鈹斺敜鈫戔敎鈹�");strParam = "";curTaskState = 'B'; break;
-				case 3:
-					strOp = _T("-[鈫慮"); strParam = "";curTaskState = 'B';break;
-				default:
-					break;
-				}
-				break;
-			case 0x11:
-				switch (lastLParam)
-				{
-				case 1:
-					strOp = _T("-|鈫搢-");strParam = "";curTaskState = 'B'; break;
-				case 2:
-					strOp = _T("鈹斺敜鈫撯敎鈹�");strParam = "";curTaskState = 'B'; break;
-				case 3:
-					strOp = _T("-[鈫揮");strParam = "";curTaskState = 'B'; break;
-				default:
-					break;
-				}
-				break;
-			case 0x12:
-				switch (lastLParam)
-				{
-				case 1:
-					strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break;
-				case 2:
-					strOp = _T("鈹斺敜鈹溾敇");strParam = "";curTaskState = 'B'; break;
-				case 3:
-					strOp = _T("-[ ]");strParam = "";curTaskState = 'B'; break;
-				default:
-					break;
-				}
-				break;
-			case 0x13:
-				switch (lastLParam)
-				{
-				case 1:
-					strOp = _T("-|/|-");strParam = "";curTaskState = 'B'; break;
-				case 2:
-					strOp = _T("鈹斺敜/鈹溾敇");strParam = "";curTaskState = 'B'; break;
-				case 8:
-					strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break;
-				case 9:
-					strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break;
-				case 3:
-				case 4:
-				case 5:
-				case 6:
-				case 7:
-				case 0xa:
-				case 0xb:
-				case 0xc:
-				case 0xd:
-				case 0xe:
-				case 0xf:
-					strOp = _T("- / -");strParam = "";curTaskState = 'A';break;
-				default:
-					break;
-				}
-				break;
-			case 0x14:
-				switch (lastLParam)
-				{
-				case 1:
-					strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break;
-				case 2:
-					strOp = _T("鈹斺敜鈹溾敇"); strParam = "";curTaskState = 'B';break;
-				case 8:
-					strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break;
-				case 9:
-					strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break;
-				case 3:
-				case 4:
-				case 5:
-				case 6:
-				case 7:
-				case 0xa:
-				case 0xb:
-				case 0xc:
-				case 0xd:
-				case 0xe:
-				case 0xf:
-					strOp = _T("- / -");strParam = "";curTaskState = 'A';break;
-				default:
-					break;
-				}
-				break;
-			default:
-				break;
-			}
-		}
-		str = strOp;
-		break;
-	case 'B':
-		str = strOp;
-		if (HParam == 0x1)                      //operator 1
-		{
-			switch (LParam)
-			{
-			case 1:
-				strOp = _T("-| |-"); strParam = "";
-				if (lastLParam != LParam)
-				{
-					clickCounter = 0;
-					clickCounterNot = 0;
-				}
-				lastLParam = LParam;
-				curTaskState = 'B';
-				break;
-			case 2:
-				strOp = _T("鈹斺敜鈹溾敇");strParam = "";
-				if (lastLParam != LParam)
-				{
-					clickCounter = 0;
-					clickCounterNot = 0;
-				}
-				lastLParam = LParam;
-				curTaskState = 'B';
-				break;
-			case 3:
-				strOp = _T("-[ ]");strParam = "";
-				if (lastLParam != LParam)
-				{
-					clickCounter = 0;
-					clickCounterNot = 0;
-				}
-				lastLParam = LParam;
-				curTaskState = 'B';
-				break;
-			case 4:
-				strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 5:
-				strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 6:
-				strOp = _T("-<S>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break;
-			case 7:
-				strOp = _T("-<R>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break;
-			case 8:
-				strOp = _T("(DF)");strParam = "";
-				if (lastLParam != LParam)
-				{
-					clickCounterNot = 0;
-				}
-				lastLParam = LParam;
-				curTaskState = 'A';
-				break;
-			case 9:
-				strOp = _T("(DF/)");strParam = "";
-				if (lastLParam != LParam)
-				{
-					clickCounterNot = 0;
-				}
-				lastLParam = LParam;
-				curTaskState = 'A';
-				break;
-			case 0x0a:
-				strOp = _T("(ED)");strParam = "";lastLParam = LParam;curTaskState = 'A'; break;
-			case 0x0b:
-				strOp = _T("-[TMX]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 0x0c:
-				strOp = _T("-[TMY]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 0x0d:
-				strOp = _T("-[TMR]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 0x0e:
-				strOp = _T("-[TML]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 0x0f:
-				strOp = _T("-[CT]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 0x10:
-				switch (lastLParam)
-				{
-				case 1:
-					strOp = _T("-|鈫憒-");strParam = "";curTaskState = 'B'; break;
-				case 2:
-					strOp = _T("鈹斺敜鈫戔敎鈹�");strParam = "";curTaskState = 'B'; break;
-				case 3:
-					strOp = _T("-[鈫慮"); strParam = "";curTaskState = 'B';break;
-				default:
-					break;
-				}
-				break;
-			case 0x11:
-				switch (lastLParam)
-				{
-				case 1:
-					strOp = _T("-|鈫搢-");strParam = "";curTaskState = 'B'; break;
-				case 2:
-					strOp = _T("鈹斺敜鈫撯敎鈹�");strParam = "";curTaskState = 'B'; break;
-				case 3:
-					strOp = _T("-[鈫揮");strParam = "";curTaskState = 'B'; break;
-				default:
-					break;
-				}
-				break;
-			case 0x12:
-				switch (lastLParam)
-				{
-				case 1:
-					strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break;
-				case 2:
-					strOp = _T("鈹斺敜鈹溾敇");strParam = "";curTaskState = 'B'; break;
-				case 3:
-					strOp = _T("-[ ]");strParam = "";curTaskState = 'B'; break;
-				default:
-					break;
-				}
-				break;
-			case 0x13:
-				switch (lastLParam)
-				{
-				case 1:
-					strOp = _T("-|/|-");strParam = "";curTaskState = 'B'; break;
-				case 2:
-					strOp = _T("鈹斺敜/鈹溾敇");strParam = "";curTaskState = 'B'; break;
-				case 8:
-					strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break;
-				case 9:
-					strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break;
-				case 3:
-				case 4:
-				case 5:
-				case 6:
-				case 7:
-				case 0xa:
-				case 0xb:
-				case 0xc:
-				case 0xd:
-				case 0xe:
-				case 0xf:
-					strOp = _T("- / -");strParam = "";curTaskState = 'A';break;
-				default:
-					break;
-				}
-				break;
-			case 0x14:
-				switch (lastLParam)
-				{
-				case 1:
-					strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break;
-				case 2:
-					strOp = _T("鈹斺敜鈹溾敇"); strParam = "";curTaskState = 'B';break;
-				case 8:
-					strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break;
-				case 9:
-					strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break;
-				case 3:
-				case 4:
-				case 5:
-				case 6:
-				case 7:
-				case 0xa:
-				case 0xb:
-				case 0xc:
-				case 0xd:
-				case 0xe:
-				case 0xf:
-					strOp = _T("- / -");strParam = "";curTaskState = 'A';break;
-				default:
-					break;
-				}
-				break;
-			default:
-				break;
-			}
-		}
-		else if (HParam == 0x2)
-		{
-			switch (LParam)
-			{
-			case 1:
-				strParam =_T(" X");curTaskState = 'C'; break;
-			case 2:
-				strParam = _T(" Y");curTaskState = 'C'; break;
-			case 3:
-				strParam = _T(" R");curTaskState = 'C'; break;
-			case 4:
-				strParam = _T(" L"); curTaskState = 'C';break;
-			case 5:
-				strParam = _T(" P");curTaskState = 'C'; break;
-			case 6:
-				strParam = _T(" T"); curTaskState = 'C';break;
-			case 7:
-				strParam = _T(" C");curTaskState = 'C'; break;
-			case 8:
-				strParam = _T(" E");curTaskState = 'C'; break;
-			default:
-				break;
-			}
-		}
-
-
-		str = strOp + _T(" ") + strParam;
-		break;
-	case 'C':
-	//	str = strOp + _T(" ") + strParam;
-		if (HParam == 0x1)                      //operator 1
-		{
-			switch (LParam)
-			{
-			case 1:
-				strOp = _T("-| |-"); strParam = "";
-				if (lastLParam != LParam)
-				{
-					clickCounter = 0;
-					clickCounterNot = 0;
-				}
-				lastLParam = LParam;
-				curTaskState = 'B';
-				break;
-			case 2:
-				strOp = _T("鈹斺敜鈹溾敇");strParam = "";
-				if (lastLParam != LParam)
-				{
-					clickCounter = 0;
-					clickCounterNot = 0;
-				}
-				lastLParam = LParam;
-				curTaskState = 'B';
-				break;
-			case 3:
-				strOp = _T("-[ ]");strParam = "";
-				if (lastLParam != LParam)
-				{
-					clickCounter = 0;
-					clickCounterNot = 0;
-				}
-				lastLParam = LParam;
-				curTaskState = 'B';
-				break;
-			case 4:
-				strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 5:
-				strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 6:
-				strOp = _T("-<S>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break;
-			case 7:
-				strOp = _T("-<R>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break;
-			case 8:
-				strOp = _T("(DF)");strParam = "";
-				if (lastLParam != LParam)
-				{
-					clickCounterNot = 0;
-				}
-				lastLParam = LParam;
-				curTaskState = 'A';
-				break;
-			case 9:
-				strOp = _T("(DF/)");strParam = "";
-				if (lastLParam != LParam)
-				{
-					clickCounterNot = 0;
-				}
-				lastLParam = LParam;
-				curTaskState = 'A';
-				break;
-			case 0x0a:
-				strOp = _T("(ED)");strParam = "";lastLParam = LParam;curTaskState = 'A'; break;
-			case 0x0b:
-				strOp = _T("-[TMX]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 0x0c:
-				strOp = _T("-[TMY]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 0x0d:
-				strOp = _T("-[TMR]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 0x0e:
-				strOp = _T("-[TML]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 0x0f:
-				strOp = _T("-[CT]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 0x10:
-				switch (lastLParam)
-				{
-				case 1:
-					strOp = _T("-|鈫憒-");strParam = "";curTaskState = 'B'; break;
-				case 2:
-					strOp = _T("鈹斺敜鈫戔敎鈹�");strParam = "";curTaskState = 'B'; break;
-				case 3:
-					strOp = _T("-[鈫慮"); strParam = "";curTaskState = 'B';break;
-				default:
-					break;
-				}
-				break;
-			case 0x11:
-				switch (lastLParam)
-				{
-				case 1:
-					strOp = _T("-|鈫搢-");strParam = "";curTaskState = 'B'; break;
-				case 2:
-					strOp = _T("鈹斺敜鈫撯敎鈹�");strParam = "";curTaskState = 'B'; break;
-				case 3:
-					strOp = _T("-[鈫揮");strParam = "";curTaskState = 'B'; break;
-				default:
-					break;
-				}
-				break;
-			case 0x12:
-				switch (lastLParam)
-				{
-				case 1:
-					strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break;
-				case 2:
-					strOp = _T("鈹斺敜鈹溾敇");strParam = "";curTaskState = 'B'; break;
-				case 3:
-					strOp = _T("-[ ]");strParam = "";curTaskState = 'B'; break;
-				default:
-					break;
-				}
-				break;
-			case 0x13:
-				switch (lastLParam)
-				{
-				case 1:
-					strOp = _T("-|/|-");strParam = "";curTaskState = 'B'; break;
-				case 2:
-					strOp = _T("鈹斺敜/鈹溾敇");strParam = "";curTaskState = 'B'; break;
-				case 8:
-					strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break;
-				case 9:
-					strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break;
-				case 3:
-				case 4:
-				case 5:
-				case 6:
-				case 7:
-				case 0xa:
-				case 0xb:
-				case 0xc:
-				case 0xd:
-				case 0xe:
-				case 0xf:
-					strOp = _T("- / -");strParam = "";curTaskState = 'A';break;
-				default:
-					break;
-				}
-				break;
-			case 0x14:
-				switch (lastLParam)
-				{
-				case 1:
-					strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break;
-				case 2:
-					strOp = _T("鈹斺敜鈹溾敇"); strParam = "";curTaskState = 'B';break;
-				case 8:
-					strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break;
-				case 9:
-					strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break;
-				case 3:
-				case 4:
-				case 5:
-				case 6:
-				case 7:
-				case 0xa:
-				case 0xb:
-				case 0xc:
-				case 0xd:
-				case 0xe:
-				case 0xf:
-					strOp = _T("- / -");strParam = "";curTaskState = 'A';break;
-				default:
-					break;
-				}
-				break;
-			default:
-				break;
-			}
-		}
-		else if (HParam == 0x2)
-		{
-			switch (LParam)
-			{
-			case 1:
-				strParam = _T(" X");curTaskState = 'C'; break;
-			case 2:
-				strParam = _T(" Y");curTaskState = 'C'; break;
-			case 3:
-				strParam = _T(" R");curTaskState = 'C'; break;
-			case 4:
-				strParam = _T(" L"); curTaskState = 'C';break;
-			case 5:
-				strParam = _T(" P");curTaskState = 'C'; break;
-			case 6:
-				strParam = _T(" T"); curTaskState = 'C';break;
-			case 7:
-				strParam = _T(" C");curTaskState = 'C'; break;
-			case 8:
-				strParam = _T(" E");curTaskState = 'C'; break;
-			default:
-				break;
-			}
-		}
-		else if (HParam == 0x3)
-		{
-			switch (LParam)
-			{
-			case 0:
-				strNumTemp = _T("0");curTaskState = 'D'; break;
-			case 1:
-				strNumTemp = _T("1");curTaskState = 'D'; break;
-			case 2:
-				strNumTemp = _T("2");curTaskState = 'D'; break;
-			case 3:
-				strNumTemp = _T("3"); curTaskState = 'D';break;
-			case 4:
-				strNumTemp = _T("4");curTaskState = 'D'; break;
-			case 5:
-				strNumTemp = _T("5");curTaskState = 'D'; break;
-			case 6:
-				strNumTemp = _T("6"); curTaskState = 'D';break;
-			case 7:
-				strNumTemp = _T("7");curTaskState = 'D'; break;
-			case 8:
-				strNumTemp = _T("8");curTaskState = 'D'; break;
-			case 9:
-				strNumTemp = _T("9");curTaskState = 'D'; break;
-			case 0x0A:
-				strNumTemp = _T("A");curTaskState = 'D'; break;
-			case 0x0B:
-				strNumTemp = _T("B");curTaskState = 'D'; break;
-			case 0x0C:
-				strNumTemp = _T("C"); curTaskState = 'D';break;
-			case 0x0D:
-				strNumTemp = _T("D");curTaskState = 'D'; break;
-			case 0x0E:
-				strNumTemp = _T("E");curTaskState = 'D'; break;
-			case 0x0F:
-				strNumTemp = _T("F");curTaskState = 'D'; break;
-			default:
-				break;
-			}
-			if (strNum.GetLength() < 4)
-			{
-				strNum.Append(strNumTemp);
-			}
-			else
-			{
-				strNum = strNum.Right(strNum.GetLength() - 1);
-				strNum.Append(strNumTemp);
-			}
-		}
-
-		str = strOp + _T(" ") + strParam+ " " + strNum;
-		break;
-	case 'D':
-		if (HParam == 0x1)                      //operator 1
-		{
-			switch (LParam)
-			{
-			case 1:
-				strOp = _T("-| |-"); strParam = "";
-				if (lastLParam != LParam)
-				{
-					clickCounter = 0;
-					clickCounterNot = 0;
-				}
-				lastLParam = LParam;
-				curTaskState = 'B';
-				break;
-			case 2:
-				strOp = _T("鈹斺敜鈹溾敇");strParam = "";
-				if (lastLParam != LParam)
-				{
-					clickCounter = 0;
-					clickCounterNot = 0;
-				}
-				lastLParam = LParam;
-				curTaskState = 'B';
-				break;
-			case 3:
-				strOp = _T("-[ ]");strParam = "";
-				if (lastLParam != LParam)
-				{
-					clickCounter = 0;
-					clickCounterNot = 0;
-				}
-				lastLParam = LParam;
-				curTaskState = 'B';
-				break;
-			case 4:
-				strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 5:
-				strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 6:
-				strOp = _T("-<S>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break;
-			case 7:
-				strOp = _T("-<R>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break;
-			case 8:
-				strOp = _T("(DF)");strParam = "";
-				if (lastLParam != LParam)
-				{
-					clickCounterNot = 0;
-				}
-				lastLParam = LParam;
-				curTaskState = 'A';
-				break;
-			case 9:
-				strOp = _T("(DF/)");strParam = "";
-				if (lastLParam != LParam)
-				{
-					clickCounterNot = 0;
-				}
-				lastLParam = LParam;
-				curTaskState = 'A';
-				break;
-			case 0x0a:
-				strOp = _T("(ED)");strParam = "";lastLParam = LParam;curTaskState = 'A'; break;
-			case 0x0b:
-				strOp = _T("-[TMX]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 0x0c:
-				strOp = _T("-[TMY]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 0x0d:
-				strOp = _T("-[TMR]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 0x0e:
-				strOp = _T("-[TML]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 0x0f:
-				strOp = _T("-[CT]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
-			case 0x10:
-				switch (lastLParam)
-				{
-				case 1:
-					strOp = _T("-|鈫憒-");strParam = "";curTaskState = 'B'; break;
-				case 2:
-					strOp = _T("鈹斺敜鈫戔敎鈹�");strParam = "";curTaskState = 'B'; break;
-				case 3:
-					strOp = _T("-[鈫慮"); strParam = "";curTaskState = 'B';break;
-				default:
-					break;
-				}
-				break;
-			case 0x11:
-				switch (lastLParam)
-				{
-				case 1:
-					strOp = _T("-|鈫搢-");strParam = "";curTaskState = 'B'; break;
-				case 2:
-					strOp = _T("鈹斺敜鈫撯敎鈹�");strParam = "";curTaskState = 'B'; break;
-				case 3:
-					strOp = _T("-[鈫揮");strParam = "";curTaskState = 'B'; break;
-				default:
-					break;
-				}
-				break;
-			case 0x12:
-				switch (lastLParam)
-				{
-				case 1:
-					strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break;
-				case 2:
-					strOp = _T("鈹斺敜鈹溾敇");strParam = "";curTaskState = 'B'; break;
-				case 3:
-					strOp = _T("-[ ]");strParam = "";curTaskState = 'B'; break;
-				default:
-					break;
-				}
-				break;
-			case 0x13:
-				switch (lastLParam)
-				{
-				case 1:
-					strOp = _T("-|/|-");strParam = "";curTaskState = 'B'; break;
-				case 2:
-					strOp = _T("鈹斺敜/鈹溾敇");strParam = "";curTaskState = 'B'; break;
-				case 8:
-					strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break;
-				case 9:
-					strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break;
-				case 3:
-				case 4:
-				case 5:
-				case 6:
-				case 7:
-				case 0xa:
-				case 0xb:
-				case 0xc:
-				case 0xd:
-				case 0xe:
-				case 0xf:
-					strOp = _T("- / -");strParam = "";curTaskState = 'A';break;
-				default:
-					break;
-				}
-				break;
-			case 0x14:
-				switch (lastLParam)
-				{
-				case 1:
-					strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break;
-				case 2:
-					strOp = _T("鈹斺敜鈹溾敇"); strParam = "";curTaskState = 'B';break;
-				case 8:
-					strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break;
-				case 9:
-					strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break;
-				case 3:
-				case 4:
-				case 5:
-				case 6:
-				case 7:
-				case 0xa:
-				case 0xb:
-				case 0xc:
-				case 0xd:
-				case 0xe:
-				case 0xf:
-					strOp = _T("- / -");strParam = "";curTaskState = 'A';break;
-				default:
-					break;
-				}
-				break;
-			default:
-				break;
-			}
-			strNum.Empty();
-		}
-		else if (HParam == 0x2)
-		{
-			switch (LParam)
-			{
-			case 1:
-				strParam = _T(" X");curTaskState = 'C'; break;
-			case 2:
-				strParam = _T(" Y");curTaskState = 'C'; break;
-			case 3:
-				strParam = _T(" R");curTaskState = 'C'; break;
-			case 4:
-				strParam = _T(" L"); curTaskState = 'C';break;
-			case 5:
-				strParam = _T(" P");curTaskState = 'C'; break;
-			case 6:
-				strParam = _T(" T"); curTaskState = 'C';break;
-			case 7:
-				strParam = _T(" C");curTaskState = 'C'; break;
-			case 8:
-				strParam = _T(" E");curTaskState = 'C'; break;
-			default:
-				break;
-			}
-			strNum.Empty();
-		}
-		else if (HParam == 0x3)
-		{
-			switch (LParam)
-			{
-			case 0:
-				strNumTemp = _T("0");curTaskState = 'D'; break;
-			case 1:
-				strNumTemp = _T("1");curTaskState = 'D'; break;
-			case 2:
-				strNumTemp = _T("2");curTaskState = 'D'; break;
-			case 3:
-				strNumTemp = _T("3"); curTaskState = 'D';break;
-			case 4:
-				strNumTemp = _T("4");curTaskState = 'D'; break;
-			case 5:
-				strNumTemp = _T("5");curTaskState = 'D'; break;
-			case 6:
-				strNumTemp = _T("6"); curTaskState = 'D';break;
-			case 7:
-				strNumTemp = _T("7");curTaskState = 'D'; break;
-			case 8:
-				strNumTemp = _T("8");curTaskState = 'D'; break;
-			case 9:
-				strNumTemp = _T("9");curTaskState = 'D'; break;
-			case 0x0A:
-				strNumTemp = _T("A");curTaskState = 'D'; break;
-			case 0x0B:
-				strNumTemp = _T("B");curTaskState = 'D'; break;
-			case 0x0C:
-				strNumTemp = _T("C"); curTaskState = 'D';break;
-			case 0x0D:
-				strNumTemp = _T("D");curTaskState = 'D'; break;
-			case 0x0E:
-				strNumTemp = _T("E");curTaskState = 'D'; break;
-			case 0x0F:
-				strNumTemp = _T("F");curTaskState = 'D'; break;
-			default:
-				break;
-			}
-			if (strNum.GetLength() < 4)
-			{
-				strNum.Append(strNumTemp);
-			}
-			else
-			{
-				strNum = strNum.Right(strNum.GetLength() - 1);
-				strNum.Append(strNumTemp);
-			}
-			
-		}
-		else if (HParam == 0x14)
-		{
-			strParam = "";
-			strNum = "";
-			curTaskState = 'A';			
-			strNum.Empty();
-		}
-
-		str = strOp + _T(" ") + strParam + " " + strNum;
-		break;
-	}
-	SetDlgItemText(IDC_EDIT_INPUT,str);
-//	m_edit_input.SetWindowText(str); */
 	return 0;
 }
 
diff --git a/MTerm1/MyFormInputShow.cpp b/MTerm1/MyFormInputShow.cpp
new file mode 100644
index 0000000..a604166
--- /dev/null
+++ b/MTerm1/MyFormInputShow.cpp
@@ -0,0 +1,3414 @@
+// MyFormLog.cpp : 实现文件
+//
+
+#include "pch.h"
+#include "MTerm1.h"
+#include "MyFormInputShow.h"
+
+
+#include "MainFrm.h"
+
+// CMyFormLog
+structButton myButtons[6][3][11] =
+{
+	{{33101,_T("-|  |-"), 33102,_T("└┤├┘") ,33103,_T("|"), 33104,_T("-[OUT]") ,33105,_T("TM/CT") ,33106,_T("Fun") ,33107,_T("——") ,33108,_T("NOT/") ,33109,_T("INDEX") ,33110,_T("(MC)") ,33111,_T("(MCE)") },
+	{33201,_T("-<SET>-"), 33202,_T("-<RESET>") ,33203,_T("(DF(/))"), 33204,_T("(END)") ,33205,_T("比较") ,33206,_T("PFun") ,33207,_T("↑↓") ,33208,_T("[位]") ,33209,_T("[字]") ,33210,_T("指令1") ,33211,_T("指令2") },
+	{33301,_T("PG转换"), 33302,_T("在线") ,33303,_T("离线"), 33304,_T("关闭") ,33305,_T("查找") ,33306,_T("次Win") ,33307,_T("监控Go") ,33308,_T("状态") ,33309,_T("Run/Prog") ,33310,_T("PLC读取") ,33311,_T("PLC写入") } },
+
+	{{33401,_T("X"), 33402,_T("Y") ,33403,_T("R"), 33404,_T("L") ,33405,_T("P") ,33406,_T("比较") ,33407,_T("") ,33408,_T("NOT/") ,33409,_T("INDEX") ,33410,_T("No.清除") ,33411,_T("") },
+	{33501,_T("T"), 33502,_T("C") ,33503,_T("E"), 33504,_T("") ,33505,_T("") ,33506,_T("") ,33507,_T("↑↓") ,33508,_T("") ,33509,_T("") ,33510,_T("") ,33511,_T("") },
+	{33601,_T(""), 33602,_T("") ,33603,_T(""), 33604,_T("") ,33605,_T("") ,33606,_T("") ,33607,_T("") ,33608,_T("") ,33609,_T("") ,33610,_T("") ,33611,_T("") }},
+
+	{{33701,_T("D"), 33702,_T("F") ,33703,_T(""), 33704,_T("") ,33705,_T("") ,33706,_T("=") ,33707,_T(">") ,33708,_T("<") ,33709,_T("") ,33710,_T("") ,33711,_T("") },
+	{33801,_T(""), 33802,_T("") ,33803,_T(""), 33804,_T("") ,33805,_T("") ,33806,_T("") ,33807,_T("") ,33808,_T("") ,33809,_T("") ,33810,_T("") ,33811,_T("") },
+	{33901,_T(""), 33902,_T("") ,33903,_T(""), 33904,_T("") ,33905,_T("") ,33906,_T("") ,33907,_T("") ,33908,_T("") ,33909,_T("") ,33910,_T("") ,33911,_T("") }},
+
+	{{34101,_T("WX"), 34102,_T("WY") ,34103,_T("WR"), 34104,_T("WL") ,34105,_T("DT") ,34106,_T("LD") ,34107,_T("FL") ,34108,_T("") ,34109,_T("INDEX") ,34110,_T("No.清除") ,34111,_T("") },
+	{34201,_T("SV"), 34202,_T("EV") ,34203,_T("K"), 34204,_T("H") ,34205,_T("M") ,34206,_T("f") ,34207,_T("") ,34208,_T("") ,34209,_T("") ,34210,_T("") ,34211,_T("") },
+	{34301,_T("PG转换"), 34302,_T("") ,34303,_T(""), 34304,_T("") ,34305,_T("") ,34306,_T("") ,34307,_T("") ,34308,_T("") ,34309,_T("") ,34310,_T("") ,34311,_T("") }},
+
+	{{34401,_T("IX(I0)"), 34402,_T("IY(I1)") ,34403,_T("I2"), 34404,_T("I3") ,34405,_T("I4") ,34406,_T("I5") ,34407,_T("I6") ,34408,_T("I7") ,34409,_T("I8") ,34410,_T("") ,34411,_T("") },
+	{34501,_T("I9"), 34502,_T("IA") ,34503,_T("IB"), 34504,_T("IC") ,34505,_T("ID") ,34506,_T("") ,34507,_T("↑↓") ,34508,_T("") ,34509,_T("") ,34510,_T("") ,34511,_T("") },
+	{34601,_T(""), 34602,_T("") ,34603,_T(""), 34604,_T("") ,34605,_T("") ,34606,_T("") ,34607,_T("") ,34608,_T("") ,34609,_T("") ,34610,_T("") ,34611,_T("") }},
+
+	{{34701,_T("TMX"), 34702,_T("TMY") ,34703,_T("TMR"), 34704,_T("TML") ,34705,_T("") ,34706,_T("-[CT]-") ,34707,_T("") ,34708,_T("") ,34709,_T("INDEX") ,34710,_T("") ,34711,_T("") },
+	{34801,_T(""), 34802,_T("") ,34803,_T(""), 34804,_T("") ,34805,_T("") ,34806,_T("") ,34807,_T("") ,34808,_T("") ,34809,_T("") ,34810,_T("") ,34811,_T("") },
+	{34901,_T(""), 34902,_T("") ,34903,_T(""), 34904,_T("") ,34905,_T("") ,34906,_T("") ,34907,_T("") ,34908,_T("") ,34909,_T("") ,3490,_T("") ,34911,_T("") }},
+};
+
+static int myButtonCount = sizeof(myButtons[6][3][11]) / sizeof(structButton);
+
+structButton myNumButtons[18] =
+{
+	ID_BUTTON_0,_T("0"), ID_BUTTON_1,_T("1") ,ID_BUTTON_2,_T("2"), ID_BUTTON_3,_T("3") ,ID_BUTTON_4,_T("4") ,ID_BUTTON_5,_T("5") ,ID_BUTTON_6,_T("6") ,ID_BUTTON_7,_T("7") ,
+	ID_BUTTON_8,_T("8") ,ID_BUTTON_9,_T("9") ,ID_BUTTON_A,_T("A"),ID_BUTTON_B,_T("B"),ID_BUTTON_C,_T("C"),ID_BUTTON_D,_T("D"),ID_BUTTON_E,_T("E"),ID_BUTTON_F,_T("F"),
+	ID_BUTTON_MINUS,_T("-"),ID_BUTTON_DOT,_T(".")
+};
+
+static int myNumButtonCount = sizeof(myNumButtons) / sizeof(structButton);
+
+structButton myCmdButtons[4] =
+{
+	ID_BUTTON_RET, _T("↙"), ID_BUTTON_INSERT, _T("Ins"), ID_BUTTON_DELETE, _T("Del"), ID_BUTTON_ESC, _T("Esc")
+};
+static int myCmdButtonCount = sizeof(myCmdButtons) / sizeof(structButton);
+
+
+IMPLEMENT_DYNCREATE(CMyFormInputShow, CFormView)
+
+CMyFormInputShow::CMyFormInputShow()
+	: CFormView(CMyFormInputShow::IDD)
+{
+
+}
+
+CMyFormInputShow::~CMyFormInputShow()
+{
+}
+
+void CMyFormInputShow::DoDataExchange(CDataExchange* pDX)
+{
+	CFormView::DoDataExchange(pDX);
+	DDX_Control(pDX, IDC_EDIT_INPUT, m_edit_input);
+}
+
+BEGIN_MESSAGE_MAP(CMyFormInputShow, CFormView)
+	ON_WM_CREATE()
+	ON_WM_DESTROY()
+	ON_WM_SIZE()
+	ON_WM_MOUSEACTIVATE()
+	ON_WM_TIMER()
+
+	ON_BN_CLICKED(IDC_BUTTON1, &CMyFormInputShow::OnBnClickedButton1)
+
+	ON_BN_CLICKED(IDC_BUTTON_AND, &CMyFormInputShow::OnBnClickedBtnAnd)
+	ON_BN_CLICKED(IDC_BUTTON_OR, &CMyFormInputShow::OnBnClickedBtnOr)
+	ON_BN_CLICKED(IDC_BUTTON_VLINE, &CMyFormInputShow::OnBnClickedBtnVline)
+	ON_BN_CLICKED(IDC_BUTTON_OUT, &CMyFormInputShow::OnBnClickedBtnOut)
+	ON_BN_CLICKED(IDC_BUTTON_TMCT, &CMyFormInputShow::OnBnClickedBtnTmCt)
+	ON_BN_CLICKED(IDC_BUTTON_FUN, &CMyFormInputShow::OnBnClickedBtnFun)
+	ON_BN_CLICKED(IDC_BUTTON_HLINE, &CMyFormInputShow::OnBnClickedBtnHLine)
+	ON_BN_CLICKED(IDC_BUTTON_NOT, &CMyFormInputShow::OnBnClickedBtnNot)
+	ON_BN_CLICKED(IDC_BUTTON_INDEX, &CMyFormInputShow::OnBnClickedBtnIndex)
+	ON_BN_CLICKED(IDC_BUTTON_MC, &CMyFormInputShow::OnBnClickedBtnMc)
+	ON_BN_CLICKED(IDC_BUTTON_MCE, &CMyFormInputShow::OnBnClickedBtnMce)
+
+	ON_BN_CLICKED(IDC_BUTTON_SET, &CMyFormInputShow::OnBnClickedBtnSet)
+	ON_BN_CLICKED(IDC_BUTTON_RESET, &CMyFormInputShow::OnBnClickedBtnReset)
+	ON_BN_CLICKED(IDC_BUTTON_DF, &CMyFormInputShow::OnBnClickedBtnDf)
+	ON_BN_CLICKED(IDC_BUTTON_END, &CMyFormInputShow::OnBnClickedBtnEnd)
+	ON_BN_CLICKED(IDC_BUTTON_COMPARE, &CMyFormInputShow::OnBnClickedBtnCompare)
+	ON_BN_CLICKED(IDC_BUTTON_PFUN, &CMyFormInputShow::OnBnClickedBtnPFun)
+	ON_BN_CLICKED(IDC_BUTTON_UPDOWN, &CMyFormInputShow::OnBnClickedBtnUpDown)
+	ON_BN_CLICKED(IDC_BUTTON_BIT, &CMyFormInputShow::OnBnClickedBtnBit)
+	ON_BN_CLICKED(IDC_BUTTON_WORD, &CMyFormInputShow::OnBnClickedBtnWord)
+	ON_BN_CLICKED(IDC_BUTTON_INSTRUCTION1, &CMyFormInputShow::OnBnClickedBtnInc1)
+	ON_BN_CLICKED(IDC_BUTTON_INSTRUCTION2, &CMyFormInputShow::OnBnClickedBtnInc2)
+
+	ON_BN_CLICKED(IDC_BUTTON_PGCONVERT, &CMyFormInputShow::OnBnClickedBtnPgConvert)
+	ON_BN_CLICKED(IDC_BUTTON_ONLINE, &CMyFormInputShow::OnBnClickedBtnOnline)
+	ON_BN_CLICKED(IDC_BUTTON_OFFLINE, &CMyFormInputShow::OnBnClickedBtnOffline)
+	ON_BN_CLICKED(IDC_BUTTON_COLSE, &CMyFormInputShow::OnBnClickedBtnClose)
+	ON_BN_CLICKED(IDC_BUTTON_FIND, &CMyFormInputShow::OnBnClickedBtnFind)
+	ON_BN_CLICKED(IDC_BUTTON_NEXTWIN, &CMyFormInputShow::OnBnClickedBtnNextWin)
+	ON_BN_CLICKED(IDC_BUTTON_MONITOR, &CMyFormInputShow::OnBnClickedBtnMonitor)
+	ON_BN_CLICKED(IDC_BUTTON_STATUS, &CMyFormInputShow::OnBnClickedBtnStatus)
+	ON_BN_CLICKED(IDC_BUTTON_RUNPROG, &CMyFormInputShow::OnBnClickedBtnRunProg)
+	ON_BN_CLICKED(IDC_BUTTON_PLCREAD, &CMyFormInputShow::OnBnClickedBtnPlcRead)
+	ON_BN_CLICKED(IDC_BUTTON_PLCWRITE, &CMyFormInputShow::OnBnClickedBtnPlcWrite)
+
+	ON_BN_CLICKED(IDC_BUTTON_X, &CMyFormInputShow::OnBnClickedBtnX)
+	ON_BN_CLICKED(IDC_BUTTON_Y, &CMyFormInputShow::OnBnClickedBtnY)
+	ON_BN_CLICKED(IDC_BUTTON_R, &CMyFormInputShow::OnBnClickedBtnR)
+	ON_BN_CLICKED(IDC_BUTTON_L, &CMyFormInputShow::OnBnClickedBtnL)
+	ON_BN_CLICKED(IDC_BUTTON_P, &CMyFormInputShow::OnBnClickedBtnP)
+	ON_BN_CLICKED(IDC_BUTTON_COMPARE1, &CMyFormInputShow::OnBnClickedBtnCompare1)
+	ON_BN_CLICKED(IDC_BUTTON_NOT1, &CMyFormInputShow::OnBnClickedBtnNot)
+	ON_BN_CLICKED(IDC_BUTTON_T, &CMyFormInputShow::OnBnClickedBtnT)
+	ON_BN_CLICKED(IDC_BUTTON_C, &CMyFormInputShow::OnBnClickedBtnC)
+	ON_BN_CLICKED(IDC_BUTTON_E, &CMyFormInputShow::OnBnClickedBtnE)
+	ON_BN_CLICKED(IDC_BUTTON_UPDOWN1, &CMyFormInputShow::OnBnClickedBtnUpDown)
+
+	ON_BN_CLICKED(IDC_BUTTON_TMX, &CMyFormInputShow::OnBnClickedBtnTmx)
+	ON_BN_CLICKED(IDC_BUTTON_TMY, &CMyFormInputShow::OnBnClickedBtnTmy)
+	ON_BN_CLICKED(IDC_BUTTON_TMR, &CMyFormInputShow::OnBnClickedBtnTmr)
+	ON_BN_CLICKED(IDC_BUTTON_TML, &CMyFormInputShow::OnBnClickedBtnTml)
+	ON_BN_CLICKED(IDC_BUTTON_CT, &CMyFormInputShow::OnBnClickedBtnCt)
+
+	ON_BN_CLICKED(IDC_BUTTON_D, &CMyFormInputShow::OnBnClickedBtnD)
+	ON_BN_CLICKED(IDC_BUTTON_F, &CMyFormInputShow::OnBnClickedBtnF)
+	ON_BN_CLICKED(IDC_BUTTON_NEQ, &CMyFormInputShow::OnBnClickedBtnNEQ)
+	ON_BN_CLICKED(IDC_BUTTON_GT, &CMyFormInputShow::OnBnClickedBtnGT)
+	ON_BN_CLICKED(IDC_BUTTON_LT, &CMyFormInputShow::OnBnClickedBtnLT)
+
+	ON_BN_CLICKED(ID_BUTTON_0, &CMyFormInputShow::OnBtn0)
+	ON_BN_CLICKED(ID_BUTTON_1, &CMyFormInputShow::OnBtn1)
+	ON_BN_CLICKED(ID_BUTTON_2, &CMyFormInputShow::OnBtn2)
+	ON_BN_CLICKED(ID_BUTTON_3, &CMyFormInputShow::OnBtn3)
+	ON_BN_CLICKED(ID_BUTTON_4, &CMyFormInputShow::OnBtn4)
+	ON_BN_CLICKED(ID_BUTTON_5, &CMyFormInputShow::OnBtn5)
+	ON_BN_CLICKED(ID_BUTTON_6, &CMyFormInputShow::OnBtn6)
+	ON_BN_CLICKED(ID_BUTTON_7, &CMyFormInputShow::OnBtn7)
+	ON_BN_CLICKED(ID_BUTTON_8, &CMyFormInputShow::OnBtn8)
+	ON_BN_CLICKED(ID_BUTTON_9, &CMyFormInputShow::OnBtn9)
+	ON_BN_CLICKED(ID_BUTTON_A, &CMyFormInputShow::OnBtnA)
+	ON_BN_CLICKED(ID_BUTTON_B, &CMyFormInputShow::OnBtnB)
+	ON_BN_CLICKED(ID_BUTTON_C, &CMyFormInputShow::OnBtnC)
+	ON_BN_CLICKED(ID_BUTTON_D, &CMyFormInputShow::OnBtnD)
+	ON_BN_CLICKED(ID_BUTTON_E, &CMyFormInputShow::OnBtnE)
+	ON_BN_CLICKED(ID_BUTTON_F, &CMyFormInputShow::OnBtnF)
+	ON_BN_CLICKED(ID_BUTTON_MINUS, &CMyFormInputShow::OnBtnMinus)
+	ON_BN_CLICKED(ID_BUTTON_DOT, &CMyFormInputShow::OnBtnDot)
+	ON_BN_CLICKED(ID_BUTTON_RET, &CMyFormInputShow::OnBtnRet)
+	ON_BN_CLICKED(ID_BUTTON_INSERT, &CMyFormInputShow::OnBtnInsert)
+	ON_BN_CLICKED(ID_BUTTON_DELETE, &CMyFormInputShow::OnBtnDelete)
+	ON_BN_CLICKED(ID_BUTTON_ESC, &CMyFormInputShow::OnBtnEsc)
+
+
+	ON_WM_CHAR()
+END_MESSAGE_MAP()
+
+
+// CMyFormLog 诊断
+
+#ifdef _DEBUG
+void CMyFormInputShow::AssertValid() const
+{
+	CFormView::AssertValid();
+}
+
+#ifndef _WIN32_WCE
+void CMyFormInputShow::Dump(CDumpContext& dc) const
+{
+	CFormView::Dump(dc);
+}
+#endif
+#endif //_DEBUG
+
+
+// CMyFormLog 消息处理程序
+
+
+BOOL CMyFormInputShow::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+
+	return CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
+}
+
+
+int CMyFormInputShow::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+	if (CFormView::OnCreate(lpCreateStruct) == -1)
+		return -1;
+
+	// TODO:  在此添加您专用的创建代码
+
+	return 0;
+}
+
+
+void CMyFormInputShow::OnDestroy()
+{
+	CFormView::OnDestroy();
+
+	// TODO: 在此处添加消息处理程序代码
+}
+
+
+void CMyFormInputShow::OnSize(UINT nType, int cx, int cy)
+{
+	CFormView::OnSize(nType, cx, cy);
+	// TODO: 在此处添加消息处理程序代码
+	CWnd * pwnd;
+/*
+	pwnd=GetDlgItem(IDC_EDIT_LOG);
+	if (pwnd!=NULL)
+	{
+//		RECT	rect1;
+		pwnd->SetWindowPos(NULL,0,0,cx,cy-20,NULL);
+	}
+//*/
+
+/*
+	pwnd = GetDlgItem(IDC_RICHEDIT2_LOG);
+	if (pwnd != NULL)
+	{
+		//		RECT	rect1;
+		pwnd->SetWindowPos(NULL, 0, 0, cx, cy - 20, NULL);
+	}
+	pwnd=GetDlgItem(IDC_CHECK_PAUSE);
+	if (pwnd!=NULL)
+	{
+		//RECT	rect1;
+		CRect rect1;
+		pwnd->GetWindowRect(rect1);
+		ScreenToClient(&rect1);
+		pwnd->SetWindowPos(NULL,0, cy - rect1.Height()-4,rect1.Width(),rect1.Height(),NULL);
+	}
+	pwnd=GetDlgItem(IDC_CHECK_NOSCROLL);
+	if (pwnd!=NULL)
+	{
+		CRect rect1;
+		pwnd->GetWindowRect(rect1);
+		ScreenToClient(&rect1);
+		pwnd->SetWindowPos(NULL,cx-rect1.Width(),cy-rect1.Height()-4,rect1.Width(),rect1.Height(),NULL);
+	}
+//*/
+
+}
+
+
+void CMyFormInputShow::OnInitialUpdate()
+{
+	CFormView::OnInitialUpdate();
+/*
+	CString VersionStr = _T("V1.02");
+	CString BuildStr = _T("20210728");
+	// TODO: 在此添加专用代码和/或调用基类
+	myLogger1.SetLogPathName(_T("D:\\Logs\\MTerm1"), _T("MTerm1"));
+	myLogger1.AttachWnd(m_richedit_log.m_hWnd);
+	myLogger1.bShowLog[0] = 1;
+	myLogger1.bShowThreadId = 0;
+	myLogger1.bShowChannel = 0;
+	myLogger1.bSaveLog[0] = 1;
+	myLogger1.bShowDate = 1;
+	SysLog(_T(" Start ") + VersionStr + _T(" ") + BuildStr + _T("\r\n"));
+	myLogger1.bShowDate = 0;
+//	myLogger1.bShowLineCount=0;
+//	myLogger1.bShowTime=0;
+	myLogger1.UpdateLogDisplay();
+	SetTimer(1, 100, NULL);
+*/
+
+	CString(s1);
+
+	s1.Format(_T(" MyDlgBarFuncKey Onupdate "));
+	SysLog(s1);
+
+//	LRESULT bRet = HandleInitDialog(wParam, lParam);
+//	if (!UpdateData(FALSE))
+//	{
+//		TRACE("InitDialogBar Failed!");
+//	}
+
+	CRect rect0;
+	GetClientRect(&rect0);
+	int nWidth = rect0.Width();
+	int nHeight = rect0.Height();
+	nWidth = 720; // rect0.Width();
+	nHeight = 60;
+	int nTopMargin = 32;
+	s1.Format(_T("Width %d Height %d "), nWidth, nHeight);
+	SysLog(s1);
+	int nLeftMargin = 48;
+
+	int nSpace = nWidth - nLeftMargin;
+	int x1, y1, x2, y2;
+	CRect rect1(0, 20, 300, 40);
+	for (int i = 0; i < myNumButtonCount; i++) {
+		x1 = nLeftMargin * 3 + i * (nSpace - nLeftMargin * 2) / 24;
+		y1 = 2;
+		x2 = x1 + (nSpace - nLeftMargin * 2) / 24 -2;
+		y2 = y1 + nHeight / 3;
+		rect1.SetRect(x1, y1, x2, y2);
+		m_NumButtons[i].Create(myNumButtons[i].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_PUSHBUTTON, rect1, this, myNumButtons[i].nID);
+		m_NumButtons[i].ShowWindow(SW_SHOW);
+	}
+
+	for (int i = 0; i < myCmdButtonCount; i++) {
+		x1 = nLeftMargin * 3 + (i +16) * (nSpace - nLeftMargin * 2) / 20;
+		y1 = 2;
+		x2 = x1 + nSpace / 24;
+		y2 = y1 + nHeight / 3;
+		rect1.SetRect(x1, y1, x2, y2);
+		m_CmdButtons[i].Create(myCmdButtons[i].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_PUSHBUTTON, rect1, this, myCmdButtons[i].nID);
+		m_CmdButtons[i].ShowWindow(SW_SHOW);
+	}
+	//	font1.CreatePointFont(95, _T("楷体"));
+	for (int i = 0; i < m_Lines; i++) {
+		for (int j = 0; j < 11; j++) {
+			x1 = nLeftMargin + j * nSpace / 11;
+			y1 = nTopMargin + i * nHeight / 3;
+			x2 = x1 + nSpace / 11;
+			y2 = y1 + nHeight / 3;
+			rect1.SetRect(x1, y1, x2, y2);
+			m_buttons[0][i][j].Create(myButtons[0][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_PUSHBUTTON, rect1, this, myButtons[0][i][j].nID);
+			m_buttons[0][i][j].ShowWindow(SW_SHOW);
+			//			init;
+		}
+	}
+	for (int i = 0; i < m_Lines; i++) {
+		for (int j = 0; j < 11; j++) {
+			x1 = nLeftMargin + j * nSpace / 11;
+			y1 = nTopMargin + i * nHeight / 3;
+			x2 = x1 + nSpace / 11;
+			y2 = y1 + nHeight / 3;
+			rect1.SetRect(x1, y1, x2, y2);
+			m_buttons[1][i][j].Create(myButtons[1][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect1, this, myButtons[1][i][j].nID);
+			//			bit;
+		}
+	}
+	for (int i = 0; i < m_Lines; i++) {
+		for (int j = 0; j < 11; j++) {
+			x1 = nLeftMargin + j * nSpace / 11;
+			y1 = nTopMargin + i * nHeight / 3;
+			x2 = x1 + nSpace / 11;
+			y2 = y1 + nHeight / 3;
+			rect1.SetRect(x1, y1, x2, y2);
+			m_buttons[2][i][j].Create(myButtons[2][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect1, this, myButtons[2][i][j].nID);
+			//			compare;
+		}
+	}
+	for (int i = 0; i < m_Lines; i++) {
+		for (int j = 0; j < 11; j++) {
+			x1 = nLeftMargin + j * nSpace / 11;
+			y1 = nTopMargin + i * nHeight / 3;
+			x2 = x1 + nSpace / 11;
+			y2 = y1 + nHeight / 3;
+			rect1.SetRect(x1, y1, x2, y2);
+			m_buttons[3][i][j].Create(myButtons[3][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect1, this, myButtons[3][i][j].nID);
+			//			word;
+		}
+	}
+	for (int i = 0; i < m_Lines; i++) {
+		for (int j = 0; j < 11; j++) {
+			x1 = nLeftMargin + j * nSpace / 11;
+			y1 = nTopMargin + i * nHeight / 3;
+			x2 = x1 + nSpace / 11;
+			y2 = y1 + nHeight / 3;
+			rect1.SetRect(x1, y1, x2, y2);
+			m_buttons[4][i][j].Create(myButtons[4][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect1, this, myButtons[4][i][j].nID);
+			//			index;
+		}
+	}
+	for (int i = 0; i < m_Lines; i++) {
+		for (int j = 0; j < 11; j++) {
+			x1 = nLeftMargin + j * nSpace / 11;
+			y1 = nTopMargin + i * nHeight / 3;
+			x2 = x1 + nSpace / 11;
+			y2 = y1 + nHeight / 3;
+			rect1.SetRect(x1, y1, x2, y2);
+			m_buttons[5][i][j].Create(myButtons[5][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect1, this, myButtons[5][i][j].nID);
+			//			TMCT;
+		}
+	}
+
+	return ;   
+
+}
+
+
+int CMyFormInputShow::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+
+	return CFormView::OnMouseActivate(pDesktopWnd, nHitTest, message);
+}
+	
+
+void CMyFormInputShow::OnTimer(UINT_PTR nIDEvent)
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+/*
+	if (nIDEvent == 1)
+	{
+		KillTimer(1);
+		SetTimer(2, 200, NULL);
+	}
+	else if (nIDEvent == 2)
+	{
+		myLogger1.UpdateLogDisplay();
+	}
+	else
+	{
+
+	}
+*/
+	CFormView::OnTimer(nIDEvent);
+}
+
+
+void CMyFormInputShow::OnBnClickedButton1()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CString s1;
+	s1.Format(_T("Button1 Clicked"));
+	SysLog(s1);
+}
+
+
+
+
+void CMyFormInputShow::SetBtnDisplayESC(int n)
+{
+	for (int n = 1; n < 5; n++)
+	{
+		for (int i = 0; i < 3; i++) {
+			for (int j = 0; j < 11; j++) {
+				m_buttons[n][i][j].ShowWindow(SW_HIDE);
+			}
+		}
+	}
+	for (int i = 0; i < 3; i++) {
+		for (int j = 0; j < 11; j++) {
+			m_buttons[0][i][j].ShowWindow(SW_SHOW);
+		}
+	}
+	current_btn_window = 0;
+}
+
+void CMyFormInputShow::SetBtnDisplay(int n)
+{
+
+	for (int i = 0; i < 3; i++) {
+		for (int j = 0; j < 11; j++) {
+			m_buttons[current_btn_window][i][j].ShowWindow(SW_HIDE);
+		}
+	}
+
+	for (int i = 0; i < 3; i++) {
+		for (int j = 0; j < 11; j++) {
+			m_buttons[n][i][j].ShowWindow(SW_SHOW);
+		}
+	}
+	current_btn_window = n;
+}
+
+
+void CMyFormInputShow::stInit()
+{
+	m_InputCell =
+	{
+		 CMTerm1View::typeNO,
+		 false,
+		 false,
+		 false,
+		 false,
+		 false,
+		 false,
+		 false,
+		 false,
+		 false,
+		 false,
+		 false,
+		 false,
+		 0x10,
+		_T("")
+	};
+}
+
+
+int CMyFormInputShow::display(tagInputCell stDisplayCell)
+{
+	static CString strOp, strParam, strNum;
+	static CString str;
+	switch (stDisplayCell.OP)
+	{
+	case CMTerm1View::typeNO:
+		if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
+		{
+			strOp = _T("└┤├┘");
+		}
+		else
+		{
+			strOp = _T("-| |-");
+		}
+
+		break;
+	case CMTerm1View::typeNC:
+		if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
+		{
+			strOp = _T("└┤/├┘");
+		}
+		else
+		{
+			strOp = _T("-|/|-");
+		}
+
+		break;
+	case CMTerm1View::typeOUT:
+		strOp = _T("-[ ]");
+		break;
+	case CMTerm1View::typeSET:
+		strOp = _T("-<S>");
+		break;
+	case CMTerm1View::typeRESET:
+		strOp = _T("-<R>");
+		break;
+	case CMTerm1View::typeDF:
+		strOp = _T("(DF)");
+		break;
+	case CMTerm1View::typeDF_:
+		strOp = _T("(DF/)");
+		break;
+	case CMTerm1View::typeNOT:
+		strOp = _T("-/-");
+		break;
+	case CMTerm1View::typeTM:
+		strOp = _T("-[TM]");
+		break;
+	case CMTerm1View::typeCMP:
+		break;
+	default:
+		break;
+	}
+
+	if (stDisplayCell.bnot)
+	{
+		switch (stDisplayCell.OP)
+		{
+		case CMTerm1View::typeNO:
+			if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
+			{
+				strOp = _T("└┤/├┘");
+			}
+			else
+			{
+				strOp = _T("-|/|-");
+			}
+			break;
+		case CMTerm1View::typeOUT:
+			strOp = _T("-/-");
+			break;
+		case CMTerm1View::typeSET:
+			strOp = _T("-/-");
+			break;
+		case CMTerm1View::typeRESET:
+			strOp = _T("-/-");
+			break;
+		case CMTerm1View::typeDF:
+			strOp = _T("(DF/)");
+			break;
+		case CMTerm1View::typeDF_:
+			strOp = _T("(DF)");
+			break;
+		case CMTerm1View::typeNOT:
+			strOp = _T("-/-");
+			break;
+		case CMTerm1View::typeTM:
+			strOp = _T("-/-");
+			break;
+		default:
+			break;
+		}
+	}
+	if (stDisplayCell.bpp)
+	{
+		switch (stDisplayCell.OP)
+		{
+		case CMTerm1View::typeNO:
+			if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
+			{
+				strOp = _T("└┤↑├┘");
+			}
+			else
+			{
+				strOp = _T("-|↑|-");
+			}
+			break;
+		case CMTerm1View::typeOUT:
+			strOp = _T("-[↑]");
+			break;
+		default:
+			break;
+		}
+	}
+	if (stDisplayCell.bpn)
+	{
+		switch (stDisplayCell.OP)
+		{
+		case CMTerm1View::typeNO:
+			if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
+			{
+				strOp = _T("└┤↓├┘");
+			}
+			else
+			{
+				strOp = _T("-|↓|-");
+			}
+			break;
+		case CMTerm1View::typeOUT:
+			strOp = _T("-[↓]");
+			break;
+		default:
+			break;
+		}
+	}
+
+	if (stDisplayCell.bDouble)
+	{
+		switch (stDisplayCell.OP)
+		{
+		case CMTerm1View::typeNO:
+			if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
+			{
+				strOp = _T("└┤├┘D");
+			}
+			else
+			{
+				strOp = _T("-| |-D");
+			}
+			break;
+		case CMTerm1View::typeOUT:
+			strOp = _T("-| |-D");
+			break;
+		case CMTerm1View::typeSET:
+			strOp = _T("-| |-D");
+			break;
+		case CMTerm1View::typeRESET:
+			strOp = _T("-| |-D");
+			break;
+		case CMTerm1View::typeDF:
+			strOp = _T("-| |-D");
+			break;
+		case CMTerm1View::typeDF_:
+			strOp = _T("-| |-D");
+			break;
+		case CMTerm1View::typeNOT:
+			strOp = _T("-| |-D");
+			break;
+		case CMTerm1View::typeTM:
+			strOp = _T("-| |-D");
+			break;
+		default:
+			break;
+		}
+	}
+
+
+	if (stDisplayCell.bDouble1)
+	{
+		switch (stDisplayCell.OP)
+		{
+		case CMTerm1View::typeNO:
+			if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
+			{
+				strOp = _T("└┤├┘");
+			}
+			else
+			{
+				strOp = _T("-| |-");
+			}
+			break;
+		case CMTerm1View::typeOUT:
+			strOp = _T("-| |-");
+			break;
+		case CMTerm1View::typeSET:
+			strOp = _T("-| |-");
+			break;
+		case CMTerm1View::typeRESET:
+			strOp = _T("-| |-");
+			break;
+		case CMTerm1View::typeDF:
+			strOp = _T("-| |-");
+			break;
+		case CMTerm1View::typeDF_:
+			strOp = _T("-| |-");
+			break;
+		case CMTerm1View::typeNOT:
+			strOp = _T("-| |-");
+			break;
+		case CMTerm1View::typeTM:
+			strOp = _T("-| |-");
+			break;
+		default:
+			break;
+		}
+	}
+
+	if (stDisplayCell.bFloat)
+	{
+		switch (stDisplayCell.OP)
+		{
+		case CMTerm1View::typeNO:
+			if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
+			{
+				strOp = _T("└┤├┘F");
+			}
+			else
+			{
+				strOp = _T("-| |-F");
+			}
+			break;
+		case CMTerm1View::typeOUT:
+			strOp = _T("-| |-F");
+			break;
+		case CMTerm1View::typeSET:
+			strOp = _T("-| |-F");
+			break;
+		case CMTerm1View::typeRESET:
+			strOp = _T("-| |-F");
+			break;
+		case CMTerm1View::typeDF:
+			strOp = _T("-| |-F");
+			break;
+		case CMTerm1View::typeDF_:
+			strOp = _T("-| |-F");
+			break;
+		case CMTerm1View::typeNOT:
+			strOp = _T("-| |-F");
+			break;
+		case CMTerm1View::typeTM:
+			strOp = _T("-| |-F");
+			break;
+		default:
+			break;
+		}
+	}
+
+	if (stDisplayCell.bFloat1)
+	{
+		switch (stDisplayCell.OP)
+		{
+		case CMTerm1View::typeNO:
+			if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
+			{
+				strOp = _T("└┤├┘");
+			}
+			else
+			{
+				strOp = _T("-| |-");
+			}
+		case CMTerm1View::typeOUT:
+			strOp = _T("-| |-");
+			break;
+		case CMTerm1View::typeSET:
+			strOp = _T("-| |-");
+			break;
+		case CMTerm1View::typeRESET:
+			strOp = _T("-| |-");
+			break;
+		case CMTerm1View::typeDF:
+			strOp = _T("-| |-");
+			break;
+		case CMTerm1View::typeDF_:
+			strOp = _T("-| |-");
+			break;
+		case CMTerm1View::typeNOT:
+			strOp = _T("-| |-");
+			break;
+		case CMTerm1View::typeTM:
+			strOp = _T("-| |-");
+			break;
+		default:
+			break;
+		}
+	}
+	switch (stDisplayCell.param)
+	{
+	case KLCoilTypeX:
+		strParam = _T("X");
+		break;
+	case KLCoilTypeY:
+		strParam = _T("Y");
+		break;
+	case KLCoilTypeR:
+		strParam = _T("R");
+		break;
+	case KLCoilTypeLR:
+		strParam = _T("L");
+		break;
+	case KLCoilTypeT:
+		strParam = _T("T");
+		break;
+	case KLCoilTypeC:
+		strParam = _T("C");
+		break;
+	case OP_TMX:
+		if (strOp == _T("-[TM]"))
+			strOp = "";
+		strParam = _T("-[TMX]");
+		break;
+	case OP_TMY:
+		if (strOp == _T("-[TM]"))
+			strOp = "";
+		strParam = _T("-[TMY]");
+		break;
+	case OP_TMR:
+		if (strOp == _T("-[TM]"))
+			strOp = "";
+		strParam = _T("-[TMR]");
+		break;
+	case OP_TML:
+		if (strOp == _T("-[TM]"))
+			strOp = "";
+		strParam = _T("-[TML]");
+		break;
+	default:
+		strParam = " ";
+		break;
+	}
+
+	if ((m_InputCell.bcmpEq) && (!m_InputCell.bcmpLt) && (!m_InputCell.bcmpGt))
+	{
+		strParam = "=";
+	}
+	if ((!m_InputCell.bcmpEq) && (m_InputCell.bcmpLt) && (!m_InputCell.bcmpGt))
+	{
+		strParam = "<";
+	}
+	if ((!m_InputCell.bcmpEq) && (!m_InputCell.bcmpLt) && (m_InputCell.bcmpGt))
+	{
+		strParam = ">";
+	}
+	if ((m_InputCell.bcmpEq) && (m_InputCell.bcmpLt))
+	{
+		strParam = "<=";
+	}
+	if ((m_InputCell.bcmpEq) && (m_InputCell.bcmpGt))
+	{
+		strParam = ">=";
+	}
+	if ((m_InputCell.bcmpLt) && (m_InputCell.bcmpGt))
+	{
+		strParam = "<>";
+	}
+	strNum = stDisplayCell.num;
+	str = strOp + _T(" ") + strParam + " " + strNum;
+	SetDlgItemText(IDC_EDIT_INPUT, str);
+	return 0;
+}
+
+int CMyFormInputShow::SetCurCellPos(int nRow, int nCol, CMTerm1View::stCell theCell)
+{
+	m_InputCell.clear();
+
+	int nType = theCell.nType;
+	switch (nType)
+	{
+	case CMTerm1View::typeNone:
+		m_InputCell.OP = CMTerm1View::typeNO;
+
+		break;
+	case CMTerm1View::typeLine1:
+		m_InputCell.OP = nType;
+		break;
+	case CMTerm1View::typeLine2:
+		m_InputCell.OP = nType;
+		break;
+	case CMTerm1View::typeNO:
+		m_InputCell.OP = nType;
+		m_InputCell.sCellName = theCell.sCoilName;
+		m_InputCell.param= theCell.nDataType;
+		m_InputCell.num.Format(_T("%d"), theCell.nDataAddr);
+		break;
+	case CMTerm1View::typeNC:
+		m_InputCell.OP = nType;
+		break;
+	case CMTerm1View::typePP:
+		m_InputCell.OP = nType;
+
+		break;
+	case CMTerm1View::typePN:
+		m_InputCell.OP = nType;
+		break;
+	case CMTerm1View::typeNOT:
+		m_InputCell.OP = nType;
+		break;
+	case CMTerm1View::typeDF:
+		m_InputCell.OP = nType;
+		break;
+	case CMTerm1View::typeDF_:
+		m_InputCell.OP = nType;
+		break;
+	case CMTerm1View::typeOUT:
+		m_InputCell.OP = nType;
+		m_InputCell.sCellName = theCell.sCoilName;
+		m_InputCell.param = theCell.nDataType;
+		m_InputCell.num.Format(_T("%d"), theCell.nDataAddr);
+		break;
+	case CMTerm1View::typeSET:
+		m_InputCell.OP = nType;
+		m_InputCell.sCellName = theCell.sCoilName;
+		m_InputCell.param = theCell.nDataType;
+		m_InputCell.num.Format(_T("%d"), theCell.nDataAddr);
+		break;
+	case CMTerm1View::typeRESET:
+		m_InputCell.OP = nType;
+		m_InputCell.sCellName = theCell.sCoilName;
+		m_InputCell.param = theCell.nDataType;
+		m_InputCell.num.Format(_T("%d"), theCell.nDataAddr);
+		break;
+	case CMTerm1View::typeCMP:
+		m_InputCell.OP = nType;
+		break;
+	case CMTerm1View::typeExt1:
+		m_InputCell.sCellName = theCell.sParam;
+		m_InputCell.param = theCell.nDataType;
+		m_InputCell.num.Format(_T("%d"), theCell.nDataAddr);
+		m_InputCell.OP = nType;
+		break;
+	case CMTerm1View::typeExt2:
+		break;
+	case CMTerm1View::typeExt3:
+		break;
+	case CMTerm1View::typeTM:
+		m_InputCell.OP = CMTerm1View::typeTM;
+		break;
+	case CMTerm1View::typeFN1:
+		m_InputCell.OP = CMTerm1View::typeFN1;
+		break;
+	case CMTerm1View::typeFN2:
+		m_InputCell.OP = CMTerm1View::typeFN2;
+		break;
+	case CMTerm1View::typeFN3:
+		m_InputCell.OP = CMTerm1View::typeFN3;
+		break;
+	case CMTerm1View::typeCoil:
+		break;
+	default:
+		break;
+	}
+
+	display(m_InputCell);
+	return 0;
+}
+
+
+void CMyFormInputShow::OnBtnRet()
+{
+	// TODO: 在此添加命令处理程序代码
+	CString strName;
+	CMTerm1View::stCell cell1;
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	CMDIChildWnd* pChild = (CMDIChildWnd*)p1->GetActiveFrame();
+	CView* p2 = (CView*)pChild->GetActiveView();
+	if (p2 == NULL) return;
+	CMTerm1View* p3 = (CMTerm1View*)p2;
+	//	m_wndDlgBar_InputShow.SetDisplay(0x00140000);
+	SetBtnDisplay(0);
+
+	switch (m_InputCell.OP)
+	{
+	case CMTerm1View::typeNO:
+	case CMTerm1View::typeNC:
+	case CMTerm1View::typeOUT:
+	case CMTerm1View::typeSET:
+	case CMTerm1View::typeRESET:
+	case CMTerm1View::typeTM:
+		switch (m_InputCell.param)
+		{
+		case KLCoilTypeX:
+			strName = "X";
+			break;
+		case KLCoilTypeY:
+			strName = "Y";
+			break;
+		case KLCoilTypeR:
+			strName = "R";
+			break;
+		case KLCoilTypeLR:
+			strName = "L";
+			break;
+		case KLCoilTypeT:
+			strName = "T";
+			break;
+		case KLCoilTypeC:
+			strName = "C";
+			break;
+		case OP_TMX:
+			strName = "TMX   ";
+		case OP_TMY:
+			strName = "TMY   ";
+		case OP_TMR:
+			strName = "TMR   ";
+		case OP_TML:
+			strName = "TML   ";
+		default:
+			break;
+		}
+	default:
+		break;
+	}
+
+
+
+	cell1.sCoilName = strName + m_InputCell.num;
+	cell1.nType = m_InputCell.OP;
+
+	cell1.nProgStep = 0;
+	cell1.bEditing = 1;
+
+	cell1.sParam = strName + m_InputCell.num;;
+
+	cell1.bLeftLineUp = 0;
+	cell1.nDataType = CMTerm1View::typeCoil;
+	cell1.nDataAddr = _tstoi(m_InputCell.num);
+	cell1.bModified = 1;
+	p3->SetCellToView(cell1);
+
+
+	//	m_wndDlgBar_Func_Key.SetBtnDisplayESC();
+}
+void CMyFormInputShow::OnBtnInsert()
+{
+	// TODO: 在此添加命令处理程序代码
+	SetDisplay(0x00240000);
+	//	m_wndDlgBar_Func_Key.SetBtnDisplayESC();
+}
+void CMyFormInputShow::OnBtnDelete()
+{
+	// TODO: 在此添加命令处理程序代码
+	SetDisplay(0x00340000);
+	//	m_wndDlgBar_Func_Key.SetBtnDisplayESC();
+}
+void CMyFormInputShow::OnBtnEsc()
+{
+	// TODO: 在此添加命令处理程序代码
+	//m_wndDlgBar_InputShow.SetDisplay(_T("Esc"));
+	SetBtnDisplayESC(0);
+	//	m_wndDlgBar_Func_Key.SetBtnDisplayESC();
+}
+
+static int flag = 0;
+int CMyFormInputShow::SetDisplay(int inputInfo)
+{
+	/*stInputCell.OP = CMTerm1View::typeNO;
+	stInputCell.param = KLCoilTypeY;
+	stInputCell.num = _T("1234");*/
+
+	static int clickCounter = 0;
+	static int clickCounterDF = 0;
+	static int clickCounterNot = 0;
+	static int clickCounterCMP = 0;
+	static int clickCounterD = 0;
+	static int clickCounterF = 0;
+	static char curTaskState = 'A';
+	static int lastLParam = 0;
+	static int lastCMP = 0;
+	static CString str, strStoreB, strStoreC, strNum;
+	static CString strOp, strParam;
+
+
+	CString s1, strNumTemp;
+	int para = 0;
+	int HParam, LParam;
+//	s1.Format(_T("is this window %d"), IsWindow(m_hWnd));
+//	SysLog(s1);
+	//	ChangeState(inputInfo>>16, lastTaskState, curTaskState);
+	if (inputInfo == 0x00010008)
+	{
+		clickCounterDF++;
+		if (clickCounterDF == 1)                     //DF  redefine key value
+		{
+
+			inputInfo = 0x00010008;
+		}
+		else if (clickCounterDF == 2)
+		{
+			inputInfo = 0x00010009;
+			clickCounterDF = 0;
+		}
+	}
+	if (inputInfo == 0x00010010)
+	{
+		clickCounter++;
+
+		if (clickCounter == 1)  //updown  redefine key value
+		{
+			inputInfo = 0x00010010;
+		}
+		else if (clickCounter == 2)
+		{
+			inputInfo = 0x00010011;
+		}
+		else if (clickCounter == 3)
+		{
+			inputInfo = 0x00010012;
+			clickCounter = 0;
+		}
+	}
+	if (inputInfo == 0x00010013)
+	{
+		clickCounterNot++;
+		if (clickCounterNot == 1)                     //NOT  redefine key value
+		{
+
+			inputInfo = 0x00010013;
+		}
+		else if (clickCounterNot == 2)
+		{
+			inputInfo = 0x00010014;
+			clickCounterNot = 0;
+		}
+	}
+
+	if (inputInfo == 0x00010015)
+	{
+		clickCounterD++;
+		if (clickCounterD == 1)                     //D  redefine key value
+		{
+
+			inputInfo = 0x00010015;
+		}
+		else if (clickCounterD == 2)
+		{
+			inputInfo = 0x00010017;
+			clickCounterD = 0;
+		}
+	}
+
+	if (inputInfo == 0x00010016)
+	{
+		clickCounterF++;
+		if (clickCounterF == 1)                     //D  redefine key value
+		{
+
+			inputInfo = 0x00010016;
+		}
+		else if (clickCounterF == 2)
+		{
+			inputInfo = 0x00010018;
+			clickCounterF = 0;
+		}
+	}
+
+	HParam = inputInfo >> 16;
+	LParam = inputInfo & 0xffff;
+
+
+	switch (curTaskState)
+	{
+	case 'A':
+		if (HParam == 0x1)                      //operator 1
+		{
+			m_InputCell.bnot = false;
+			m_InputCell.bpp = false;
+			m_InputCell.bpn = false;
+			m_InputCell.bcmpEq = false;
+			m_InputCell.bcmpLt = false;
+			m_InputCell.bcmpGt = false;
+			m_InputCell.bDouble = false;
+			m_InputCell.bDouble1 = false;
+			m_InputCell.bFloat = false;
+			m_InputCell.bFloat1 = false;
+			m_InputCell.bLeftLineUp = false;
+			m_InputCell.brightLineUp = false;
+
+			if ((LParam >= 0x1) && (LParam <= 0x0f))
+			{
+
+				if ((LParam == 0x8) || (LParam == 0x9))         //IF DF  not clear df
+				{
+					clickCounter = 0;
+					clickCounterNot = 0;
+					clickCounterCMP = 0;
+					clickCounterD = 0;
+					clickCounterF = 0;
+				}
+				else
+				{
+					if (lastLParam != LParam)
+					{
+						clickCounter = 0;
+						clickCounterNot = 0;
+						clickCounterDF = 0;
+						clickCounterCMP = 0;
+						clickCounterD = 0;
+						clickCounterF = 0;
+					}
+				}
+			}
+			if ((lastLParam == 0x14) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //from not to updown
+			{
+				clickCounter = 1;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+
+			}
+			if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //from up to not
+			{
+				clickCounter = 0;
+				clickCounterNot = 1;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+
+			}
+			if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //from down to not
+			{
+				clickCounter = 0;
+				clickCounterNot = 1;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+			}
+
+			if ((lastLParam == 0x13) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //not
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+
+			}
+			if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+
+			}
+			if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+			}
+
+			if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18)))  //D ,"", F,""
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 1;
+			}
+
+			if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18)))
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 1;
+			}
+			if ((lastLParam == 0x17) && ((LParam == 0x16) || (LParam == 0x18)))
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 1;
+			}
+			if ((lastLParam == 0x16) && ((LParam == 0x15) || (LParam == 0x17)))
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 1;
+				clickCounterF = 0;
+			}
+			if ((lastLParam == 0x18) && ((LParam == 0x15) || (LParam == 0x17)))
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 1;
+				clickCounterF = 0;
+			}
+			switch (LParam)
+			{
+			case 0x01:
+				m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;      //0x10 define para null 
+
+				lastLParam = LParam;
+				curTaskState = 'B';
+				break;
+			case 0x02:
+				m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;
+				m_InputCell.bLeftLineUp = true;
+				m_InputCell.brightLineUp = true;
+				lastLParam = LParam;
+				curTaskState = 'B';
+				break;
+			case 0x03:
+				m_InputCell.OP = CMTerm1View::typeOUT; m_InputCell.param = 0x10;
+
+				lastLParam = LParam;
+				curTaskState = 'B';
+				break;
+				/*case 4:
+					strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
+				case 5:
+					strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;*/
+			case 0x06:
+				m_InputCell.OP = CMTerm1View::typeSET; m_InputCell.param = 0x10;
+
+				lastLParam = LParam; curTaskState = 'B'; break;
+			case 0x07:
+				m_InputCell.OP = CMTerm1View::typeRESET; m_InputCell.param = 0x10;
+
+				lastLParam = LParam; curTaskState = 'B'; break;
+			case 0x08:
+				m_InputCell.OP = CMTerm1View::typeDF; m_InputCell.param = 0x10;
+
+				lastLParam = LParam;
+				curTaskState = 'A';
+				break;
+			case 0x09:
+				m_InputCell.OP = CMTerm1View::typeDF_; m_InputCell.param = 0x10;
+
+				lastLParam = LParam;
+				curTaskState = 'A';
+				break;
+			case 0x0a:
+				strOp = _T("(ED)"); strParam = ""; lastLParam = LParam; curTaskState = 'A'; break;
+			case 0x0b:
+				m_InputCell.OP = CMTerm1View::typeTM; m_InputCell.param = 0x10;
+
+				lastLParam = LParam;
+				curTaskState = 'B';
+				break;
+			case 0x10:
+				m_InputCell.bpp = true;
+				m_InputCell.bpn = false;
+				lastLParam = LParam;
+				break;
+			case 0x11:
+				m_InputCell.bpp = false;
+				m_InputCell.bpn = true;
+				lastLParam = LParam;
+				break;
+			case 0x12:
+				m_InputCell.bpp = false;
+				m_InputCell.bpn = false;
+				lastLParam = LParam;
+				break;
+			case 0x13:
+				switch (lastLParam)
+				{
+				case 0x03:
+				case 0x06:
+				case 0x07:
+				case 0x15:
+				case 0x17:
+				case 0x16:
+				case 0x18:
+				case 0x20:
+				case 0x21:
+				case 0x22:
+					m_InputCell.OP = CMTerm1View::typeNOT;
+					clickCounterNot = 0;
+					curTaskState = 'A';
+				default:
+					break;
+				}
+				switch (lastLParam)
+				{
+				case 0x01:
+					m_InputCell.OP = CMTerm1View::typeNC; break;
+				case 0x02:
+					m_InputCell.OP = CMTerm1View::typeNC;
+					m_InputCell.bLeftLineUp = true;
+					m_InputCell.brightLineUp = true;
+					break;
+				default:
+					break;
+				}
+				lastLParam = LParam;
+				m_InputCell.bnot = true;
+				break;
+			case 0x14:
+				m_InputCell.bnot = false;
+				break;
+			case 0x15:
+				m_InputCell.bDouble = true;
+				m_InputCell.bDouble1 = false;
+				m_InputCell.bFloat = false;
+				m_InputCell.bFloat1 = false;
+				lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
+				break;
+			case 0x17:
+				m_InputCell.bDouble = false;
+				m_InputCell.bDouble1 = true;
+				m_InputCell.bFloat = false;
+				m_InputCell.bFloat1 = false;
+				lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
+				break;
+			case 0x16:
+				m_InputCell.bDouble = false;
+				m_InputCell.bDouble1 = false;
+				m_InputCell.bFloat = true;
+				m_InputCell.bFloat1 = false;
+				lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
+				break;
+			case 0x18:
+				m_InputCell.bDouble = false;
+				m_InputCell.bDouble1 = false;
+				m_InputCell.bFloat = false;
+				m_InputCell.bFloat1 = true;
+				lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
+				break;
+			default:
+				break;
+			}
+		}
+
+		str = strOp;
+		break;
+	case 'B':
+		str = strOp;
+		if (HParam == 0x1)                      //operator 1
+		{
+			m_InputCell.bnot = false;
+			m_InputCell.bpp = false;
+			m_InputCell.bpn = false;
+			m_InputCell.bcmpEq = false;
+			m_InputCell.bcmpLt = false;
+			m_InputCell.bcmpGt = false;
+			m_InputCell.bDouble = false;
+			m_InputCell.bDouble1 = false;
+			m_InputCell.bFloat = false;
+			m_InputCell.bFloat1 = false;
+			m_InputCell.bLeftLineUp = false;
+			m_InputCell.brightLineUp = false;
+			if ((LParam >= 0x0) && (LParam <= 0x0f))
+			{
+
+				if ((LParam == 0x08) || (LParam == 0x09))
+				{
+					clickCounter = 0;
+					clickCounterNot = 0;
+					clickCounterCMP = 0;
+					clickCounterD = 0;
+					clickCounterF = 0;
+				}
+				else
+				{
+					if (lastLParam != LParam)
+					{
+						clickCounter = 0;
+						clickCounterNot = 0;
+						clickCounterDF = 0;
+						clickCounterCMP = 0;
+						clickCounterD = 0;
+						clickCounterF = 0;
+					}
+				}
+
+			}
+			if ((lastLParam == 0x13) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //from not to updown
+			{
+				clickCounter = 1;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+
+			}
+			if ((lastLParam == 0x14) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //from not to updown
+			{
+				clickCounter = 1;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+
+			}
+			if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //from up to not
+			{
+				clickCounter = 0;
+				clickCounterNot = 1;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+
+			}
+			if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //from down to not
+			{
+				clickCounter = 0;
+				clickCounterNot = 1;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+			}
+			if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18)))
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 1;
+			}
+			if ((lastLParam == 0x17) && ((LParam == 0x16) || (LParam == 0x18)))
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 1;
+			}
+			if ((lastLParam == 0x16) && ((LParam == 0x15) || (LParam == 0x17)))
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 1;
+				clickCounterF = 0;
+			}
+			if ((lastLParam == 0x18) && ((LParam == 0x15) || (LParam == 0x17)))
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 1;
+				clickCounterF = 0;
+			}
+			switch (LParam)
+			{
+			case 0x01:
+				m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;      //0x10 define para null 
+
+				lastLParam = LParam;
+				curTaskState = 'B';
+				break;
+			case 0x02:
+				m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;
+				m_InputCell.bLeftLineUp = true;
+				m_InputCell.brightLineUp = true;
+				lastLParam = LParam;
+				curTaskState = 'B';
+				break;
+			case 0x03:
+				m_InputCell.OP = CMTerm1View::typeOUT; m_InputCell.param = 0x10;
+
+				lastLParam = LParam;
+				curTaskState = 'B';
+				break;
+				/*case 4:
+					strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
+				case 5:
+					strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;*/
+			case 0x06:
+				m_InputCell.OP = CMTerm1View::typeSET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break;
+			case 0x07:
+				m_InputCell.OP = CMTerm1View::typeRESET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break;
+			case 0x08:
+				m_InputCell.OP = CMTerm1View::typeDF;; m_InputCell.param = 0x10;
+
+				lastLParam = LParam;
+				curTaskState = 'A';
+				break;
+			case 0x9:
+				m_InputCell.OP = CMTerm1View::typeDF_; m_InputCell.param = 0x10;
+
+				lastLParam = LParam;
+				curTaskState = 'A';
+				break;
+			case 0x0a:
+				strOp = _T("(ED)"); strParam = ""; lastLParam = LParam; curTaskState = 'A'; break;
+			case 0x0b:
+				m_InputCell.OP = CMTerm1View::typeTM; m_InputCell.param = 0x10;
+
+				lastLParam = LParam;
+				curTaskState = 'B';
+				break;
+			case 0x10:
+				m_InputCell.bpp = true;
+				m_InputCell.bpn = false;
+				lastLParam = LParam;
+				break;
+			case 0x11:
+				m_InputCell.bpp = false;
+				m_InputCell.bpn = true;
+				lastLParam = LParam;
+				break;
+			case 0x12:
+				m_InputCell.bpp = false;
+				m_InputCell.bpn = false;
+				lastLParam = LParam;
+				break;
+			case 0x13:
+				switch (lastLParam)
+				{
+				case 0x03:
+				case 0x06:
+				case 0x07:
+				case 0x15:
+				case 0x17:
+				case 0x16:
+				case 0x18:
+				case 0x20:
+				case 0x21:
+				case 0x22:
+					m_InputCell.OP = CMTerm1View::typeNOT;
+					clickCounterNot = 0;
+					curTaskState = 'A';
+				default:
+					break;
+				}
+
+				switch (lastLParam)
+				{
+				case 0x01:
+					m_InputCell.OP = CMTerm1View::typeNC; break;
+				case 0x02:
+					m_InputCell.OP = CMTerm1View::typeNC;
+					m_InputCell.bLeftLineUp = true;
+					m_InputCell.brightLineUp = true;
+					break;
+				default:
+					break;
+				}
+
+				lastLParam = LParam;
+				m_InputCell.bnot = true;
+				break;
+			case 0x14:
+				m_InputCell.bnot = false;
+				break;
+			case 0x15:
+				m_InputCell.bDouble = true;
+				m_InputCell.bDouble1 = false;
+				m_InputCell.bFloat = false;
+				m_InputCell.bFloat1 = false;
+				m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B';
+				break;
+			case 0x17:
+				m_InputCell.bDouble = false;
+				m_InputCell.bDouble1 = true;
+				m_InputCell.bFloat = false;
+				m_InputCell.bFloat1 = false;
+				m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B';
+				break;
+			case 0x16:
+				m_InputCell.bDouble = false;
+				m_InputCell.bDouble1 = false;
+				m_InputCell.bFloat = true;
+				m_InputCell.bFloat1 = false;
+				lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
+				break;
+			case 0x18:
+				m_InputCell.bDouble = false;
+				m_InputCell.bDouble1 = false;
+				m_InputCell.bFloat = false;
+				m_InputCell.bFloat1 = true;
+				lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
+				break;
+			default:
+				break;
+			}
+		}
+		else if (HParam == 0x2)
+		{
+			switch (LParam)
+			{
+			case 1:
+				m_InputCell.param = KLCoilTypeX; curTaskState = 'C'; break;
+			case 2:
+				m_InputCell.param = KLCoilTypeY; curTaskState = 'C'; break;
+			case 3:
+				m_InputCell.param = KLCoilTypeR; curTaskState = 'C'; break;
+			case 4:
+				m_InputCell.param = KLCoilTypeLR; curTaskState = 'C'; break;
+			case 5:
+				strParam = _T(" P"); curTaskState = 'C'; break;
+			case 6:
+				m_InputCell.param = KLCoilTypeT; curTaskState = 'C'; break;
+			case 7:
+				m_InputCell.param = KLCoilTypeC; curTaskState = 'C'; break;
+			case 8:
+				strParam = _T(" E"); curTaskState = 'C'; break;
+			case 9:
+				m_InputCell.param = OP_TMX; curTaskState = 'C'; break;
+			case 0x0a:
+				m_InputCell.param = OP_TMY; curTaskState = 'C'; break;
+			case 0x0b:
+				m_InputCell.param = OP_TMR; curTaskState = 'C'; break;
+			case 0x0c:
+				m_InputCell.param = OP_TML; curTaskState = 'C'; break;
+			case 0x0d:
+				if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
+				{
+					m_InputCell.OP = CMTerm1View::typeNO;
+					m_InputCell.bnot = false;
+					m_InputCell.bpp = false;
+					m_InputCell.bpn = false;
+					clickCounter = 0;
+					clickCounterNot = 0;
+					clickCounterDF = 0;
+					clickCounterD = 0;
+					clickCounterF = 0;
+				}
+				lastLParam = 0x20;
+				m_InputCell.bcmpEq = true;
+				if (lastCMP != LParam)
+				{
+					clickCounterCMP++;
+				}
+				else
+				{
+					clickCounterCMP = 1;
+					m_InputCell.bcmpGt = false;
+					m_InputCell.bcmpLt = false;
+				}
+
+				if (clickCounterCMP > 2)
+				{
+					clickCounterCMP = 1;
+					m_InputCell.bcmpGt = false;
+					m_InputCell.bcmpLt = false;
+				}
+				lastCMP = LParam;
+				curTaskState = 'B'; break;
+			case 0x0e:
+				if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
+				{
+					m_InputCell.OP = CMTerm1View::typeNO;
+					m_InputCell.bnot = false;
+					m_InputCell.bpp = false;
+					m_InputCell.bpn = false;
+					clickCounter = 0;
+					clickCounterNot = 0;
+					clickCounterDF = 0;
+					clickCounterD = 0;
+					clickCounterF = 0;
+				}
+				lastLParam = 0x21;
+				m_InputCell.bcmpGt = true;
+				if (lastCMP != LParam)
+				{
+					clickCounterCMP++;
+				}
+				else
+				{
+					clickCounterCMP = 1;
+					m_InputCell.bcmpEq = false;
+					m_InputCell.bcmpLt = false;
+				}
+
+				if (clickCounterCMP > 2)
+				{
+					clickCounterCMP = 1;
+					m_InputCell.bcmpEq = false;
+					m_InputCell.bcmpLt = false;
+				}
+				lastCMP = LParam;
+				curTaskState = 'B'; break;
+			case 0x0f:
+				if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
+				{
+					m_InputCell.OP = CMTerm1View::typeNO;
+					m_InputCell.bnot = false;
+					m_InputCell.bpp = false;
+					m_InputCell.bpn = false;
+					clickCounter = 0;
+					clickCounterNot = 0;
+					clickCounterDF = 0;
+					clickCounterD = 0;
+					clickCounterF = 0;
+				}
+				lastLParam = 0x22;                //  define op para; for translate to -/-
+				m_InputCell.bcmpLt = true;
+				if (lastCMP != LParam)
+				{
+					clickCounterCMP++;
+				}
+				else
+				{
+					clickCounterCMP = 1;
+					m_InputCell.bcmpEq = false;
+					m_InputCell.bcmpGt = false;
+				}
+
+				if (clickCounterCMP > 2)
+				{
+					clickCounterCMP = 1;
+					m_InputCell.bcmpEq = false;
+					m_InputCell.bcmpGt = false;
+				}
+				lastCMP = LParam;             //record key num = > <
+				curTaskState = 'B'; break;
+			default:
+				break;
+			}
+		}
+
+		break;
+	case 'C':
+		//	str = strOp + _T(" ") + strParam;
+		if (HParam == 0x01)                      //operator 1
+		{
+			m_InputCell.bnot = false;
+			m_InputCell.bpp = false;
+			m_InputCell.bpn = false;
+			m_InputCell.bcmpEq = false;
+			m_InputCell.bcmpLt = false;
+			m_InputCell.bcmpGt = false;
+			m_InputCell.bDouble = false;
+			m_InputCell.bFloat1 = false;
+			m_InputCell.bFloat = false;
+			m_InputCell.bFloat1 = false;
+			m_InputCell.bLeftLineUp = false;
+			m_InputCell.brightLineUp = false;
+
+			if ((LParam >= 0x01) && (LParam <= 0x0f))
+			{
+
+				if ((LParam == 0x08) || (LParam == 0x09))
+				{
+					clickCounter = 0;
+					clickCounterNot = 0;
+					clickCounterCMP = 0;
+					clickCounterD = 0;
+					clickCounterF = 0;
+				}
+				else
+				{
+					if (lastLParam != LParam)
+					{
+						clickCounter = 0;
+						clickCounterNot = 0;
+						clickCounterDF = 0;
+						clickCounterCMP = 0;
+						clickCounterD = 0;
+						clickCounterF = 0;
+					}
+				}
+
+			}
+			if ((lastLParam == 0x14) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //from not to updown
+			{
+				clickCounter = 1;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+
+			}
+			if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //from up to not
+			{
+				clickCounter = 0;
+				clickCounterNot = 1;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+
+			}
+			if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //from down to not
+			{
+				clickCounter = 0;
+				clickCounterNot = 1;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+			}
+			if ((lastLParam == 0x13) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //not
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+
+			}
+			if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+
+			}
+			if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+			}
+			if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18)))
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 1;
+			}
+			if ((lastLParam == 0x17) && ((LParam == 0x16) || (LParam == 0x18)))
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 1;
+			}
+			if ((lastLParam == 0x16) && ((LParam == 0x15) || (LParam == 0x17)))
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 1;
+				clickCounterF = 0;
+			}
+			if ((lastLParam == 0x18) && ((LParam == 0x15) || (LParam == 0x17)))
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 1;
+				clickCounterF = 0;
+			}
+			switch (LParam)
+			{
+			case 0x01:
+				m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;      //0x10 define para null 
+
+				lastLParam = LParam;
+				curTaskState = 'B';
+				break;
+			case 0x02:
+				m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;
+				m_InputCell.bLeftLineUp = true;
+				m_InputCell.brightLineUp = true;
+				lastLParam = LParam;
+				curTaskState = 'B';
+				break;
+			case 0x03:
+				m_InputCell.OP = CMTerm1View::typeOUT; m_InputCell.param = 0x10;
+				lastLParam = LParam;
+				curTaskState = 'B';
+				break;
+				/*case 4:
+					strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
+				case 5:
+					strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;*/
+			case 0x06:
+				m_InputCell.OP = CMTerm1View::typeSET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break;
+			case 0x07:
+				m_InputCell.OP = CMTerm1View::typeRESET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break;
+			case 0x08:
+				m_InputCell.OP = CMTerm1View::typeDF;; m_InputCell.param = 0x10;
+				lastLParam = LParam;
+				curTaskState = 'A';
+				break;
+			case 0x09:
+				m_InputCell.OP = CMTerm1View::typeDF_; m_InputCell.param = 0x10;
+
+				lastLParam = LParam;
+				curTaskState = 'A';
+				break;
+			case 0x0a:
+				strOp = _T("(ED)"); strParam = ""; lastLParam = LParam; curTaskState = 'A'; break;
+			case 0x0b:
+				m_InputCell.OP = CMTerm1View::typeTM; m_InputCell.param = 0x10;
+
+				lastLParam = LParam;
+				curTaskState = 'B';
+				break;
+			case 0x10:
+				m_InputCell.bpp = true;
+				m_InputCell.bpn = false;
+				break;
+			case 0x11:
+				m_InputCell.bpp = false;
+				m_InputCell.bpn = true;
+				break;
+			case 0x12:
+				m_InputCell.bpp = false;
+				m_InputCell.bpn = false;
+				break;
+			case 0x13:
+				switch (lastLParam)
+				{
+				case 0x03:
+				case 0x06:
+				case 0x07:
+				case 0x15:
+				case 0x17:
+				case 0x16:
+				case 0x18:
+				case 0x20:
+				case 0x21:
+				case 0x22:
+					m_InputCell.OP = CMTerm1View::typeNOT;
+					clickCounterNot = 0;
+
+					curTaskState = 'A';
+				default:
+					break;
+				}
+				switch (lastLParam)
+				{
+				case 0x01:
+					m_InputCell.OP = CMTerm1View::typeNC; break;
+				case 0x02:
+					m_InputCell.OP = CMTerm1View::typeNC;
+					m_InputCell.bLeftLineUp = true;
+					m_InputCell.brightLineUp = true;
+					break;
+				default:
+					break;
+				}
+				lastLParam = LParam;
+				m_InputCell.bnot = true;
+
+				break;
+			case 0x14:
+				m_InputCell.bnot = false;
+				break;
+			case 0x15:
+				m_InputCell.bDouble = true;
+				m_InputCell.bDouble1 = false;
+				m_InputCell.bFloat = false;
+				m_InputCell.bFloat1 = false;
+				m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B';
+				break;
+			case 0x17:
+				m_InputCell.bDouble = false;
+				m_InputCell.bDouble1 = true;
+				m_InputCell.bFloat = false;
+				m_InputCell.bFloat1 = false;
+				m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B';
+				break;
+			case 0x16:
+				m_InputCell.bDouble = false;
+				m_InputCell.bDouble1 = false;
+				m_InputCell.bFloat = true;
+				m_InputCell.bFloat1 = false;
+				lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
+				break;
+			case 0x18:
+				m_InputCell.bDouble = false;
+				m_InputCell.bDouble1 = false;
+				m_InputCell.bFloat = false;
+				m_InputCell.bFloat1 = true;
+				lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
+				break;
+			default:
+				break;
+			}
+		}
+		else if (HParam == 0x2)
+		{
+			switch (LParam)
+			{
+			case 1:
+				m_InputCell.param = KLCoilTypeX; curTaskState = 'C'; break;
+			case 2:
+				m_InputCell.param = KLCoilTypeY; curTaskState = 'C'; break;
+			case 3:
+				m_InputCell.param = KLCoilTypeR; curTaskState = 'C'; break;
+			case 4:
+				m_InputCell.param = KLCoilTypeLR; curTaskState = 'C'; break;
+			case 5:
+				strParam = _T(" P"); curTaskState = 'C'; break;
+			case 6:
+				m_InputCell.param = KLCoilTypeT; curTaskState = 'C'; break;
+			case 7:
+				m_InputCell.param = KLCoilTypeC; curTaskState = 'C'; break;
+			case 8:
+				strParam = _T(" E"); curTaskState = 'C'; break;
+			case 9:
+				m_InputCell.param = OP_TMX; curTaskState = 'C'; break;
+			case 0x0a:
+				m_InputCell.param = OP_TMY; curTaskState = 'C'; break;
+			case 0x0b:
+				m_InputCell.param = OP_TMR; curTaskState = 'C'; break;
+			case 0x0c:
+				m_InputCell.param = OP_TML; curTaskState = 'C'; break;
+			case 0x0d:
+				if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
+				{
+					m_InputCell.OP = CMTerm1View::typeNO;
+					m_InputCell.bnot = false;
+					m_InputCell.bpp = false;
+					m_InputCell.bpn = false;
+					clickCounter = 0;
+					clickCounterNot = 0;
+					clickCounterDF = 0;
+					clickCounterD = 0;
+					clickCounterF = 0;
+				}
+				lastLParam = 0x20;
+				m_InputCell.bcmpEq = true;
+				if (lastCMP != LParam)
+				{
+					clickCounterCMP++;
+				}
+				else
+				{
+					clickCounterCMP = 1;
+					m_InputCell.bcmpGt = false;
+					m_InputCell.bcmpLt = false;
+				}
+				if (clickCounterCMP > 2)
+				{
+					clickCounterCMP = 1;
+					m_InputCell.bcmpGt = false;
+					m_InputCell.bcmpLt = false;
+				}
+				lastCMP = LParam;
+				curTaskState = 'B'; break;
+			case 0x0e:
+				if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
+				{
+					m_InputCell.OP = CMTerm1View::typeNO;
+					m_InputCell.bnot = false;
+					m_InputCell.bpp = false;
+					m_InputCell.bpn = false;
+					clickCounter = 0;
+					clickCounterNot = 0;
+					clickCounterDF = 0;
+					clickCounterD = 0;
+					clickCounterF = 0;
+				}
+				lastLParam = 0x21;
+				m_InputCell.bcmpGt = true;
+				if (lastCMP != LParam)
+				{
+					clickCounterCMP = 1;
+					clickCounterCMP++;
+				}
+				else
+				{
+					m_InputCell.bcmpEq = false;
+					m_InputCell.bcmpLt = false;
+				}
+				if (clickCounterCMP > 2)
+				{
+					clickCounterCMP = 1;
+					m_InputCell.bcmpEq = false;
+					m_InputCell.bcmpLt = false;
+				}
+				lastCMP = LParam;
+				curTaskState = 'B'; break;
+			case 0x0f:
+				if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
+				{
+					m_InputCell.OP = CMTerm1View::typeNO;
+					m_InputCell.bnot = false;
+					m_InputCell.bpp = false;
+					m_InputCell.bpn = false;
+					clickCounter = 0;
+					clickCounterNot = 0;
+					clickCounterDF = 0;
+					clickCounterD = 0;
+					clickCounterF = 0;
+				}
+				lastLParam = 0x22;
+				m_InputCell.bcmpLt = true;
+				if (lastCMP != LParam)
+				{
+					clickCounterCMP++;
+				}
+				else
+				{
+					clickCounterCMP = 1;
+					m_InputCell.bcmpEq = false;
+					m_InputCell.bcmpGt = false;
+				}
+				if (clickCounterCMP > 2)
+				{
+					clickCounterCMP = 1;
+					m_InputCell.bcmpEq = false;
+					m_InputCell.bcmpGt = false;
+				}
+				lastCMP = LParam;
+				curTaskState = 'B'; break;
+			default:
+				break;
+			}
+		}
+		else if (HParam == 0x3)
+		{
+			switch (LParam)
+			{
+			case 0:
+				strNumTemp = _T("0"); curTaskState = 'D'; break;
+			case 1:
+				strNumTemp = _T("1"); curTaskState = 'D'; break;
+			case 2:
+				strNumTemp = _T("2"); curTaskState = 'D'; break;
+			case 3:
+				strNumTemp = _T("3"); curTaskState = 'D'; break;
+			case 4:
+				strNumTemp = _T("4"); curTaskState = 'D'; break;
+			case 5:
+				strNumTemp = _T("5"); curTaskState = 'D'; break;
+			case 6:
+				strNumTemp = _T("6"); curTaskState = 'D'; break;
+			case 7:
+				strNumTemp = _T("7"); curTaskState = 'D'; break;
+			case 8:
+				strNumTemp = _T("8"); curTaskState = 'D'; break;
+			case 9:
+				strNumTemp = _T("9"); curTaskState = 'D'; break;
+			case 0x0A:
+				if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
+					;                        //state not change
+				else
+				{
+					strNumTemp = _T("A"); curTaskState = 'D';
+				}
+				break;
+			case 0x0B:
+				if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
+					;
+				else
+				{
+					strNumTemp = _T("B"); curTaskState = 'D';
+				}
+				break;
+			case 0x0C:
+				if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
+					;
+				else
+				{
+					strNumTemp = _T("C"); curTaskState = 'D';
+				}
+				break;
+			case 0x0D:
+				if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
+					;
+				else
+				{
+					strNumTemp = _T("D"); curTaskState = 'D';
+				}
+				break;
+
+			case 0x0E:
+				if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
+					;
+				else
+				{
+					strNumTemp = _T("E"); curTaskState = 'D';
+				}
+				break;
+			case 0x0F:
+				if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
+					;
+				else
+				{
+					strNumTemp = _T("F"); curTaskState = 'D';
+				}
+				break;
+			default:
+				break;
+			}
+
+			if (m_InputCell.num.GetLength() < 4)
+			{
+				m_InputCell.num.Append(strNumTemp);
+			}
+			else
+			{
+				m_InputCell.num = m_InputCell.num.Right(m_InputCell.num.GetLength() - 1);
+				m_InputCell.num.Append(strNumTemp);
+			}
+		}
+
+		break;
+	case 'D':
+		if (HParam == 0x1)                      //operator 1
+		{
+			m_InputCell.bnot = false;
+			m_InputCell.bpp = false;
+			m_InputCell.bpn = false;
+			m_InputCell.bcmpEq = false;
+			m_InputCell.bcmpLt = false;
+			m_InputCell.bcmpGt = false;
+			m_InputCell.bDouble = false;
+			m_InputCell.bDouble1 = false;
+			m_InputCell.bFloat = false;
+			m_InputCell.bFloat1 = false;
+			m_InputCell.bLeftLineUp = false;
+			m_InputCell.brightLineUp = false;
+
+
+			if ((LParam >= 0x01) && (LParam <= 0x0f))
+			{
+
+				m_InputCell.num.Empty();
+				if ((LParam == 0x08) || (LParam == 0x09))
+				{
+					clickCounter = 0;
+					clickCounterNot = 0;
+					clickCounterCMP = 0;
+					clickCounterD = 0;
+					clickCounterF = 0;
+				}
+				else
+				{
+					if (lastLParam != LParam)
+					{
+						clickCounter = 0;
+						clickCounterNot = 0;
+						clickCounterDF = 0;
+						clickCounterCMP = 0;
+						clickCounterD = 0;
+						clickCounterF = 0;
+					}
+				}
+			}
+			if ((lastLParam == 0x14) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //from not to updown
+			{
+				clickCounter = 1;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+
+			}
+			if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //from up to not
+			{
+				clickCounter = 0;
+				clickCounterNot = 1;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+
+			}
+			if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //from down to not
+			{
+				clickCounter = 0;
+				clickCounterNot = 1;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+			}
+
+			if ((lastLParam == 0x13) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //not
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+
+			}
+			if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+
+			}
+			if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 0;
+			}
+			if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18)))
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 1;
+			}
+			if ((lastLParam == 0x17) && ((LParam == 0x16) || (LParam == 0x18)))
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 0;
+				clickCounterF = 1;
+			}
+			if ((lastLParam == 0x16) && ((LParam == 0x15) || (LParam == 0x17)))
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 1;
+				clickCounterF = 0;
+			}
+			if ((lastLParam == 0x18) && ((LParam == 0x15) || (LParam == 0x17)))
+			{
+				clickCounter = 0;
+				clickCounterNot = 0;
+				clickCounterDF = 0;
+				clickCounterCMP = 0;
+				clickCounterD = 1;
+				clickCounterF = 0;
+			}
+			switch (LParam)
+			{
+			case 0x01:
+				m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;      //0x10 define para null 
+
+				lastLParam = LParam;
+				curTaskState = 'B';
+				break;
+			case 0x02:
+				m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;
+				m_InputCell.bLeftLineUp = true;
+				m_InputCell.brightLineUp = true;
+				lastLParam = LParam;
+				curTaskState = 'B';
+				break;
+			case 0x03:
+				m_InputCell.OP = CMTerm1View::typeOUT; m_InputCell.param = 0x10;
+
+				lastLParam = LParam;
+				curTaskState = 'B';
+				break;
+				/*case 4:
+					strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
+				case 5:
+					strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;*/
+			case 0x06:
+				m_InputCell.OP = CMTerm1View::typeSET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break;
+			case 0x07:
+				m_InputCell.OP = CMTerm1View::typeRESET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break;
+			case 0x08:
+				m_InputCell.OP = CMTerm1View::typeDF; m_InputCell.param = 0x10;
+
+				lastLParam = LParam;
+				curTaskState = 'A';
+				break;
+			case 0x09:
+				m_InputCell.OP = CMTerm1View::typeDF_; m_InputCell.param = 0x10;
+
+				lastLParam = LParam;
+				curTaskState = 'A';
+				break;
+			case 0x0a:
+				strOp = _T("(ED)"); strParam = ""; lastLParam = LParam; curTaskState = 'A'; break;
+			case 0x0b:
+				m_InputCell.OP = CMTerm1View::typeTM; m_InputCell.param = 0x10;
+
+				lastLParam = LParam;
+				curTaskState = 'B';
+				break;
+			case 0x10:
+				m_InputCell.bpp = true;
+				m_InputCell.bpn = false;
+				break;
+			case 0x11:
+				m_InputCell.bpp = false;
+				m_InputCell.bpn = true;
+				break;
+			case 0x12:
+				m_InputCell.bpp = false;
+				m_InputCell.bpn = false;
+				break;
+			case 0x13:
+				switch (lastLParam)
+				{
+				case 3:
+				case 6:
+				case 7:
+				case 0x15:
+				case 0x17:
+				case 0x16:
+				case 0x18:
+				case 0x20:
+				case 0x21:
+				case 0x22:
+					m_InputCell.OP = CMTerm1View::typeNOT;
+					clickCounterNot = 0;
+					curTaskState = 'A';
+				default:
+					break;
+				}
+				switch (lastLParam)
+				{
+				case 0x01:
+					m_InputCell.OP = CMTerm1View::typeNC; break;
+				case 0x02:
+					m_InputCell.OP = CMTerm1View::typeNC;
+					m_InputCell.bLeftLineUp = true;
+					m_InputCell.brightLineUp = true;
+					break;
+				default:
+					break;
+				}
+				lastLParam = LParam;
+				m_InputCell.bnot = true;
+
+				break;
+			case 0x14:
+				m_InputCell.bnot = false;
+				break;
+			case 0x15:
+				m_InputCell.bDouble = true;
+				m_InputCell.bDouble1 = false;
+				m_InputCell.bFloat = false;
+				m_InputCell.bFloat1 = false;
+				m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B';
+				break;
+			case 0x17:
+				m_InputCell.bDouble = false;
+				m_InputCell.bDouble1 = true;
+				m_InputCell.bFloat = false;
+				m_InputCell.bFloat1 = false;
+				m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B';
+				break;
+			case 0x16:
+				m_InputCell.bDouble = false;
+				m_InputCell.bDouble1 = false;
+				m_InputCell.bFloat = true;
+				m_InputCell.bFloat1 = false;
+				lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
+				break;
+			case 0x18:
+				m_InputCell.bDouble = false;
+				m_InputCell.bDouble1 = false;
+				m_InputCell.bFloat = false;
+				m_InputCell.bFloat1 = true;
+				lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
+				break;
+			default:
+				break;
+			}
+			if (curTaskState != 'D')
+			{
+				m_InputCell.num.Empty();
+			}
+		}
+		else if (HParam == 0x2)
+		{
+			switch (LParam)
+			{
+			case 1:
+				m_InputCell.param = KLCoilTypeX; curTaskState = 'C'; break;
+			case 2:
+				m_InputCell.param = KLCoilTypeY; curTaskState = 'C'; break;
+			case 3:
+				m_InputCell.param = KLCoilTypeR; curTaskState = 'C'; break;
+			case 4:
+				m_InputCell.param = KLCoilTypeLR; curTaskState = 'C'; break;
+			case 5:
+				strParam = _T(" P"); curTaskState = 'C'; break;
+			case 6:
+				m_InputCell.param = KLCoilTypeT; curTaskState = 'C'; break;
+			case 7:
+				m_InputCell.param = KLCoilTypeC; curTaskState = 'C'; break;
+			case 8:
+				strParam = _T(" E"); curTaskState = 'C'; break;
+			case 9:
+				m_InputCell.param = OP_TMX; curTaskState = 'C'; break;
+			case 0x0a:
+				m_InputCell.param = OP_TMY; curTaskState = 'C'; break;
+			case 0x0b:
+				m_InputCell.param = OP_TMR; curTaskState = 'C'; break;
+			case 0x0c:
+				m_InputCell.param = OP_TML; curTaskState = 'C'; break;
+			case 0x0d:
+				if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
+				{
+					m_InputCell.OP = CMTerm1View::typeNO;
+					m_InputCell.bnot = false;
+					m_InputCell.bpp = false;
+					m_InputCell.bpn = false;
+					clickCounter = 0;
+					clickCounterNot = 0;
+					clickCounterDF = 0;
+					clickCounterD = 0;
+					clickCounterF = 0;
+				}
+				lastLParam = 0x20;
+				m_InputCell.bcmpEq = true;
+				if (lastCMP != LParam)
+				{
+					clickCounterCMP++;
+				}
+				else
+				{
+					clickCounterCMP = 1;
+					m_InputCell.bcmpGt = false;
+					m_InputCell.bcmpLt = false;
+				}
+
+				if (clickCounterCMP > 2)
+				{
+					clickCounterCMP = 1;
+					m_InputCell.bcmpGt = false;
+					m_InputCell.bcmpLt = false;
+				}
+				lastCMP = LParam;
+				curTaskState = 'B'; break;
+			case 0x0e:
+				if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
+				{
+					m_InputCell.OP = CMTerm1View::typeNO;
+					m_InputCell.bnot = false;
+					m_InputCell.bpp = false;
+					m_InputCell.bpn = false;
+					clickCounter = 0;
+					clickCounterNot = 0;
+					clickCounterDF = 0;
+					clickCounterD = 0;
+					clickCounterF = 0;
+				}
+				lastLParam = 0x21;
+				m_InputCell.bcmpGt = true;
+				if (lastCMP != LParam)
+				{
+					clickCounterCMP++;
+				}
+				else
+				{
+					clickCounterCMP = 1;
+					m_InputCell.bcmpEq = false;
+					m_InputCell.bcmpLt = false;
+				}
+				if (clickCounterCMP > 2)
+				{
+					clickCounterCMP = 1;
+					m_InputCell.bcmpEq = false;
+					m_InputCell.bcmpLt = false;
+				}
+				lastCMP = LParam;
+				curTaskState = 'B'; break;
+			case 0x0f:
+				if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
+				{
+					m_InputCell.OP = CMTerm1View::typeNO;
+					m_InputCell.bnot = false;
+					m_InputCell.bpp = false;
+					m_InputCell.bpn = false;
+					clickCounter = 0;
+					clickCounterNot = 0;
+					clickCounterDF = 0;
+					clickCounterD = 0;
+					clickCounterF = 0;
+				}
+				lastLParam = 0x22;
+				m_InputCell.bcmpLt = true;
+				if (lastCMP != LParam)
+				{
+					clickCounterCMP++;
+				}
+				else
+				{
+					clickCounterCMP = 1;
+					m_InputCell.bcmpEq = false;
+					m_InputCell.bcmpGt = false;
+				}
+				if (clickCounterCMP > 2)
+				{
+					clickCounterCMP = 1;
+					m_InputCell.bcmpEq = false;
+					m_InputCell.bcmpGt = false;
+				}
+				lastCMP = LParam;
+				curTaskState = 'B'; break;
+			default:
+				break;
+			}
+			if (curTaskState != 'D')
+			{
+				m_InputCell.num.Empty();
+			}
+		}
+		else if (HParam == 0x3)
+		{
+			switch (LParam)
+			{
+			case 0:
+				strNumTemp = _T("0"); curTaskState = 'D'; break;
+			case 1:
+				strNumTemp = _T("1"); curTaskState = 'D'; break;
+			case 2:
+				strNumTemp = _T("2"); curTaskState = 'D'; break;
+			case 3:
+				strNumTemp = _T("3"); curTaskState = 'D'; break;
+			case 4:
+				strNumTemp = _T("4"); curTaskState = 'D'; break;
+			case 5:
+				strNumTemp = _T("5"); curTaskState = 'D'; break;
+			case 6:
+				strNumTemp = _T("6"); curTaskState = 'D'; break;
+			case 7:
+				strNumTemp = _T("7"); curTaskState = 'D'; break;
+			case 8:
+				strNumTemp = _T("8"); curTaskState = 'D'; break;
+			case 9:
+				strNumTemp = _T("9"); curTaskState = 'D'; break;
+			case 0x0A:
+				if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
+					;                        //state not change
+				else
+				{
+					strNumTemp = _T("A"); curTaskState = 'D';
+				}
+				break;
+			case 0x0B:
+				if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
+					;
+				else
+				{
+					strNumTemp = _T("B"); curTaskState = 'D';
+				}
+				break;
+			case 0x0C:
+				if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
+					;
+				else
+				{
+					strNumTemp = _T("C"); curTaskState = 'D';
+				}
+				break;
+			case 0x0D:
+				if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
+					;
+				else
+				{
+					strNumTemp = _T("D"); curTaskState = 'D';
+				}
+				break;
+
+			case 0x0E:
+				if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
+					;
+				else
+				{
+					strNumTemp = _T("E"); curTaskState = 'D';
+				}
+				break;
+			case 0x0F:
+				if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
+					;
+				else
+				{
+					strNumTemp = _T("F"); curTaskState = 'D';
+				}
+				break;
+			default:
+				break;
+			}
+
+			if (m_InputCell.num.GetLength() < 4)
+			{
+				m_InputCell.num.Append(strNumTemp);
+			}
+			else
+			{
+				m_InputCell.num = m_InputCell.num.Right(m_InputCell.num.GetLength() - 1);
+				m_InputCell.num.Append(strNumTemp);
+
+				for (int i = 0; i < m_InputCell.num.GetLength(); i++)
+				{
+					if (m_InputCell.num[i] == _T('0'))
+					{
+						;
+					}
+					else
+					{
+						flag = 1; break;
+					}
+
+				}
+				if (flag == 0)
+				{
+					m_InputCell.num.Empty();
+					m_InputCell.num.Append(_T("0"));
+				}
+			}
+			int num = m_InputCell.num.GetLength();
+			for (int i = 0; i < num; i++)
+			{
+				int len1 = m_InputCell.num.GetLength();
+				if (len1 > 1 && m_InputCell.num[0] == _T('0')) m_InputCell.num = m_InputCell.num.Right(m_InputCell.num.GetLength() - 1);
+			}
+
+		}
+
+
+		break;
+	}    //end switch
+	if (HParam == 0x14)
+	{
+		bool editEndFlag = false;                                              //********************************************************************************************************
+
+		switch (m_InputCell.OP)
+		{
+		case CMTerm1View::typeNO:
+		case CMTerm1View::typeNC:
+		case CMTerm1View::typeOUT:
+		case CMTerm1View::typeSET:
+		case CMTerm1View::typeRESET:
+		case CMTerm1View::typeTM:
+			if (curTaskState == 'D')
+			{
+				editEndFlag = true;
+			}
+		case CMTerm1View::typeDF:
+		case CMTerm1View::typeDF_:
+			if (curTaskState == 'A')
+			{
+				editEndFlag = true;
+			}
+		default:
+			break;
+		}
+
+		if ((m_InputCell.bcmpEq) || (m_InputCell.bcmpGt) || (m_InputCell.bcmpLt))
+		{
+			editEndFlag = true;
+		}
+
+		if (editEndFlag)
+		{
+			CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+			p1->GetInputCell(m_InputCell);
+		}
+		else
+		{
+			CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+			CString str = _T("无法确定指令输入");
+			//p1->m_wndStatusBar.GetStatusBarCtrl().SetBkColor(RGB(255, 0, 0)); 
+			p1->m_wndStatusBar.SetPaneText(0, str);
+		}
+
+	}
+
+	display(m_InputCell);
+	return 0;
+}
+
+int CMyFormInputShow::SetDisplay1(int inputInfo)
+{
+	// TODO: 在此处添加实现代码.
+
+	return 0;
+}
+
+
+void CMyFormInputShow::OnBnClickedBtnAnd()
+{
+
+	SetDisplay(0x00010001);
+
+	SetBtnDisplay(1);
+}
+
+void CMyFormInputShow::OnBnClickedBtnOr()
+{
+
+	//	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//	p1->GetInputInfo(0x00010002);
+
+	SetDisplay(0x00010002);
+	SetBtnDisplay(1);
+}
+
+void CMyFormInputShow::OnBnClickedBtnVline()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("|"));
+}
+
+void CMyFormInputShow::OnBnClickedBtnOut()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x00010003);
+
+	SetDisplay(0x00010003);
+	SetBtnDisplay(1);
+}
+void CMyFormInputShow::OnBnClickedBtnTmCt()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x0001000b);
+
+	SetDisplay(0x0001000b);
+
+	SetBtnDisplay(5);
+}
+void CMyFormInputShow::OnBnClickedBtnFun()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("Fun "));
+}
+void CMyFormInputShow::OnBnClickedBtnHLine()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("——"));
+}
+void CMyFormInputShow::OnBnClickedBtnNot()                  /****************************************************************************/
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x00010013);
+
+	SetDisplay(0x00010013);
+
+	SetBtnDisplay(1);
+}
+void CMyFormInputShow::OnBnClickedBtnIndex()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("Index "));
+	SetBtnDisplay(4);
+}
+void CMyFormInputShow::OnBnClickedBtnMc()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x00010004);
+
+	SetDisplay(0x00010004);
+}
+void CMyFormInputShow::OnBnClickedBtnMce()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x00010005);
+
+	SetDisplay(0x00010005);
+}
+void CMyFormInputShow::OnBnClickedBtnSet()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x00010006);
+
+	SetDisplay(0x00010006);
+	SetBtnDisplay(1);
+}
+void CMyFormInputShow::OnBnClickedBtnReset()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x00010007);
+
+	SetDisplay(0x00010007);
+
+	SetBtnDisplay(1);
+}
+void CMyFormInputShow::OnBnClickedBtnDf()
+{
+
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x00010008);
+
+	SetDisplay(0x00010008);
+
+
+	//p1->GetInputInfo(_T("(DF)"));
+}
+void CMyFormInputShow::OnBnClickedBtnEnd()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x0001000A);
+
+	SetDisplay(0x0001000A);
+}
+void CMyFormInputShow::OnBnClickedBtnCompare()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("Compare"));
+	SetBtnDisplay(2);
+}
+void CMyFormInputShow::OnBnClickedBtnPFun()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("PFun"));
+}
+void CMyFormInputShow::OnBnClickedBtnUpDown()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x00010010);
+
+	SetDisplay(0x00010010);
+
+	SetBtnDisplay(1);
+}
+void CMyFormInputShow::OnBnClickedBtnBit()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("Bit"));
+	SetBtnDisplay(1);
+}
+void CMyFormInputShow::OnBnClickedBtnWord()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("Word"));
+	SetBtnDisplay(3);
+}
+void CMyFormInputShow::OnBnClickedBtnInc1()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("Inc1"));
+}
+void CMyFormInputShow::OnBnClickedBtnInc2()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("Inc2"));
+}
+
+
+void CMyFormInputShow::OnBnClickedBtnPgConvert()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("PgConvert"));
+}
+void CMyFormInputShow::OnBnClickedBtnOnline()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("Online"));
+}
+void CMyFormInputShow::OnBnClickedBtnOffline()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("Offline"));
+}
+void CMyFormInputShow::OnBnClickedBtnClose()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("Close"));
+}
+void CMyFormInputShow::OnBnClickedBtnFind()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("Find"));
+}
+void CMyFormInputShow::OnBnClickedBtnNextWin()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("NextWin"));
+}
+void CMyFormInputShow::OnBnClickedBtnMonitor()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("Monitor"));
+}
+void CMyFormInputShow::OnBnClickedBtnStatus()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("Status"));
+}
+void CMyFormInputShow::OnBnClickedBtnRunProg()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("RunProg"));
+}
+void CMyFormInputShow::OnBnClickedBtnPlcRead()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("PlcRead"));
+}
+void CMyFormInputShow::OnBnClickedBtnPlcWrite()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	//p1->GetInputInfo(_T("PlcWrite"));
+}
+
+
+void CMyFormInputShow::OnBnClickedBtnX()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x00020001);
+
+	SetDisplay(0x00020001);
+}
+void CMyFormInputShow::OnBnClickedBtnY()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x00020002);
+
+	SetDisplay(0x00020002);
+}
+void CMyFormInputShow::OnBnClickedBtnR()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x00020003);
+
+	SetDisplay(0x00020003);
+}
+void CMyFormInputShow::OnBnClickedBtnL()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x00020004);
+
+	SetDisplay(0x00020004);
+}
+void CMyFormInputShow::OnBnClickedBtnP()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x00020005);
+
+	SetDisplay(0x00020005);
+}
+
+void CMyFormInputShow::OnBnClickedBtnCompare1()
+{
+	SetBtnDisplay(2);
+}
+void CMyFormInputShow::OnBnClickedBtnT()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x00020006);
+
+	SetDisplay(0x00020006);
+}
+void CMyFormInputShow::OnBnClickedBtnC()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x00020007);
+
+	SetDisplay(0x00020007);
+}
+void CMyFormInputShow::OnBnClickedBtnE()
+{
+
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x00020008);
+
+	SetDisplay(0x00020008);
+}
+
+
+void CMyFormInputShow::OnBnClickedBtnTmx()
+{
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x00020009);
+
+	SetDisplay(0x00020009);
+	SetBtnDisplay(0);
+}
+void CMyFormInputShow::OnBnClickedBtnTmy()
+{
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x0002000A);
+
+	SetDisplay(0x0002000A);
+	SetBtnDisplay(1);
+}
+void CMyFormInputShow::OnBnClickedBtnTmr()
+{
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x0002000B);
+
+	SetDisplay(0x0002000B);
+	SetBtnDisplay(0);
+}
+void CMyFormInputShow::OnBnClickedBtnTml()
+{
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x0002000C);
+
+	SetDisplay(0x0002000C);
+	SetBtnDisplay(0);
+}
+void CMyFormInputShow::OnBnClickedBtnCt()
+{
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x0002000D);
+
+	SetDisplay(0x0002000D);
+
+	SetBtnDisplay(0);
+}
+
+
+void CMyFormInputShow::OnBnClickedBtnD()
+{
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x00010015);
+
+	SetDisplay(0x00010015);
+
+}
+void CMyFormInputShow::OnBnClickedBtnF()
+{
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x00010016);
+
+	SetDisplay(0x00010016);
+
+}
+void CMyFormInputShow::OnBnClickedBtnNEQ()
+{
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x0002000D);
+
+	SetDisplay(0x0002000D);
+}
+
+void CMyFormInputShow::OnBnClickedBtnGT()
+{
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x0002000E);
+
+	SetDisplay(0x0002000E);
+}
+void CMyFormInputShow::OnBnClickedBtnLT()
+{
+	CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
+	p1->GetInputInfo(0x0002000F);
+
+	SetDisplay(0x0002000F);
+}
+
+
+void CMyFormInputShow::OnBtn0()
+{
+	// TODO: 在此添加命令处理程序代码
+	SetDisplay(0x00030000);
+}
+void CMyFormInputShow::OnBtn1()
+{
+	// TODO: 在此添加命令处理程序代码
+	SetDisplay(0x00030001);
+}
+void CMyFormInputShow::OnBtn2()
+{
+	// TODO: 在此添加命令处理程序代码
+	SetDisplay(0x00030002);
+}
+void CMyFormInputShow::OnBtn3()
+{
+	// TODO: 在此添加命令处理程序代码
+	SetDisplay(0x00030003);
+}
+void CMyFormInputShow::OnBtn4()
+{
+	// TODO: 在此添加命令处理程序代码
+	SetDisplay(0x00030004);
+}
+void CMyFormInputShow::OnBtn5()
+{
+	// TODO: 在此添加命令处理程序代码
+	SetDisplay(0x00030005);
+}
+void CMyFormInputShow::OnBtn6()
+{
+	// TODO: 在此添加命令处理程序代码
+	SetDisplay(0x00030006);
+}
+void CMyFormInputShow::OnBtn7()
+{
+	// TODO: 在此添加命令处理程序代码
+	SetDisplay(0x00030007);
+}
+void CMyFormInputShow::OnBtn8()
+{
+	// TODO: 在此添加命令处理程序代码
+	SetDisplay(0x00030008);
+}
+void CMyFormInputShow::OnBtn9()
+{
+	// TODO: 在此添加命令处理程序代码
+	SetDisplay(0x00030009);
+}
+void CMyFormInputShow::OnBtnA()
+{
+	// TODO: 在此添加命令处理程序代码
+	SetDisplay(0x0003000A);
+}
+void CMyFormInputShow::OnBtnB()
+{
+	// TODO: 在此添加命令处理程序代码
+	SetDisplay(0x0003000B);
+}
+void CMyFormInputShow::OnBtnC()
+{
+	// TODO: 在此添加命令处理程序代码
+	SetDisplay(0x0003000C);
+}
+
+void CMyFormInputShow::OnBtnD()
+{
+	// TODO: 在此添加命令处理程序代码
+	SetDisplay(0x0003000D);
+}
+void CMyFormInputShow::OnBtnE()
+{
+	// TODO: 在此添加命令处理程序代码
+	SetDisplay(0x0003000E);
+}
+void CMyFormInputShow::OnBtnF()
+{
+	// TODO: 在此添加命令处理程序代码
+
+	SetDisplay(0x0003000F);
+}
+void CMyFormInputShow::OnBtnMinus()
+{
+	// TODO: 在此添加命令处理程序代码
+	//m_wndDlgBar_InputShow.SetDisplay(_T("-"));
+}
+void CMyFormInputShow::OnBtnDot()
+{
+	// TODO: 在此添加命令处理程序代码
+	//m_wndDlgBar_InputShow.SetDisplay(_T("."));
+}
+
+
+void CMyFormInputShow::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+	if (nChar == 13) { OnBtnRet(); }
+	CFormView::OnChar(nChar, nRepCnt, nFlags);
+}
diff --git a/MTerm1/MyFormInputShow.h b/MTerm1/MyFormInputShow.h
new file mode 100644
index 0000000..5680a86
--- /dev/null
+++ b/MTerm1/MyFormInputShow.h
@@ -0,0 +1,242 @@
+#pragma once
+#include "afxwin.h"
+#include "afxcmn.h"
+#include "MTerm1View.h"
+
+
+// CMyFormLog 窗体视图
+#define IDC_BUTTON_AND                     33101
+#define IDC_BUTTON_OR                      33102
+#define IDC_BUTTON_VLINE                   33103
+#define IDC_BUTTON_OUT                     33104
+#define IDC_BUTTON_TMCT                    33105
+#define IDC_BUTTON_FUN                     33106
+#define IDC_BUTTON_HLINE                   33107
+#define IDC_BUTTON_NOT                     33108
+#define IDC_BUTTON_INDEX                   33109
+#define IDC_BUTTON_MC                      33110
+#define IDC_BUTTON_MCE                     33111
+
+#define IDC_BUTTON_SET                     33201
+#define IDC_BUTTON_RESET                   33202
+#define IDC_BUTTON_DF                      33203
+#define IDC_BUTTON_END                     33204
+#define IDC_BUTTON_COMPARE                 33205
+#define IDC_BUTTON_PFUN                    33206
+#define IDC_BUTTON_UPDOWN                  33207
+#define IDC_BUTTON_BIT                     33208
+#define IDC_BUTTON_WORD                    33209
+#define IDC_BUTTON_INSTRUCTION1            33210
+#define IDC_BUTTON_INSTRUCTION2            33211
+
+#define IDC_BUTTON_PGCONVERT              33301
+#define IDC_BUTTON_ONLINE                33302
+#define IDC_BUTTON_OFFLINE               33303
+#define IDC_BUTTON_COLSE                 33304
+#define IDC_BUTTON_FIND                  33305
+#define IDC_BUTTON_NEXTWIN               33306
+#define IDC_BUTTON_MONITOR               33307
+#define IDC_BUTTON_STATUS                33308
+#define IDC_BUTTON_RUNPROG               33309
+#define IDC_BUTTON_PLCREAD               33310
+#define IDC_BUTTON_PLCWRITE              33311
+
+#define IDC_BUTTON_X                    33401
+#define IDC_BUTTON_Y                    33402
+#define IDC_BUTTON_R                    33403
+#define IDC_BUTTON_L                    33404
+#define IDC_BUTTON_P                    33405
+#define IDC_BUTTON_COMPARE1             33406
+#define IDC_BUTTON_NOT1                 33408
+#define IDC_BUTTON_T                    33501
+#define IDC_BUTTON_C                    33502
+#define IDC_BUTTON_E                    33503
+#define IDC_BUTTON_UPDOWN1              33507
+
+#define IDC_BUTTON_D                     33701
+#define IDC_BUTTON_F                     33702
+#define IDC_BUTTON_NEQ                    33706
+#define IDC_BUTTON_GT                    33707
+#define IDC_BUTTON_LT                    33708
+
+#define IDC_BUTTON_TMX                  34701
+#define IDC_BUTTON_TMY                  34702
+#define IDC_BUTTON_TMR                  34703
+#define IDC_BUTTON_TML                  34704
+#define IDC_BUTTON_CT                   34706
+
+typedef struct tagStructButton {
+	int nID;
+	CString sCaption;
+
+}structButton;
+
+struct tagInputCell
+{
+	char OP = CMTerm1View::typeNO;
+	bool bnot = false;
+	bool bpp = false;
+	bool bpn = false;
+	bool bcmpEq = false;
+	bool bcmpLt = false;
+	bool bcmpGt = false;
+	bool bDouble = false;
+	bool bDouble1 = false;  //for  -||-D and -||- turn
+	bool bFloat = false;
+	bool bFloat1 = false;
+	bool bLeftLineUp = false;
+	bool brightLineUp = false;
+	int param = 0;
+	CString sCellName;
+	CString sParamName;
+	CString num = _T("");
+	void clear() { OP = 0; bnot = 0; bpp = 0; bpn = 0; bcmpEq = 0; bcmpLt = 0;
+	bcmpGt = 0; bDouble = 0; bDouble1 = 0; bFloat = 0; bFloat1 = 0; bLeftLineUp = 0; brightLineUp = 0;
+	param = 0; sCellName.Empty(); num.Empty();
+	}
+};
+
+
+class CMyFormInputShow : public CFormView
+{
+	DECLARE_DYNCREATE(CMyFormInputShow)
+
+protected:
+	CMyFormInputShow();           // 动态创建所使用的受保护的构造函数
+	virtual ~CMyFormInputShow();
+
+public:
+	enum { IDD = IDD_FORM_INPUTSHOW};
+#ifdef _DEBUG
+	virtual void AssertValid() const;
+#ifndef _WIN32_WCE
+	virtual void Dump(CDumpContext& dc) const;
+#endif
+#endif
+	CButton m_buttons[6][3][11];
+	CButton m_NumButtons[18];
+	CButton m_CmdButtons[4];
+	int m_Lines = 3;
+	CFont font1;
+	int current_btn_window = 0;
+
+	tagInputCell m_InputCell;
+
+	CEdit m_edit_input;
+
+//	tagInputCell localInputCell;
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+public:
+	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	afx_msg void OnDestroy();
+	afx_msg void OnSize(UINT nType, int cx, int cy);
+	virtual void OnInitialUpdate();
+	afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message);
+//	CEdit m_edit_log;
+//	CRichEditCtrl m_richedit_log;
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+
+//	virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHandler);
+	void SetBtnDisplay(int n = 0);
+	void SetBtnDisplayESC(int n=0);
+
+
+	afx_msg void OnBnClickedButton1();
+	afx_msg void OnBnClickedBtnAnd();
+	afx_msg void OnBnClickedBtnOr();
+	afx_msg void OnBnClickedBtnVline();
+	afx_msg void OnBnClickedBtnOut();
+	afx_msg void OnBnClickedBtnTmCt();
+	afx_msg void OnBnClickedBtnFun();
+	afx_msg void OnBnClickedBtnHLine();
+	afx_msg void OnBnClickedBtnNot();
+	afx_msg void OnBnClickedBtnIndex();
+	afx_msg void OnBnClickedBtnMc();
+	afx_msg void OnBnClickedBtnMce();
+
+	afx_msg void OnBnClickedBtnSet();
+	afx_msg void OnBnClickedBtnReset();
+	afx_msg void OnBnClickedBtnDf();
+	afx_msg void OnBnClickedBtnEnd();
+	afx_msg void OnBnClickedBtnCompare();
+	afx_msg void OnBnClickedBtnPFun();
+	afx_msg void OnBnClickedBtnUpDown();
+	afx_msg void OnBnClickedBtnBit();
+	afx_msg void OnBnClickedBtnWord();
+	afx_msg void OnBnClickedBtnInc1();
+	afx_msg void OnBnClickedBtnInc2();
+
+	afx_msg void OnBnClickedBtnPgConvert();
+	afx_msg void OnBnClickedBtnOnline();
+	afx_msg void OnBnClickedBtnOffline();
+	afx_msg void OnBnClickedBtnClose();
+	afx_msg void OnBnClickedBtnFind();
+	afx_msg void OnBnClickedBtnNextWin();
+	afx_msg void OnBnClickedBtnMonitor();
+	afx_msg void OnBnClickedBtnStatus();
+	afx_msg void OnBnClickedBtnRunProg();
+	afx_msg void OnBnClickedBtnPlcRead();
+	afx_msg void OnBnClickedBtnPlcWrite();
+
+	afx_msg void OnBnClickedBtnX();
+	afx_msg void OnBnClickedBtnY();
+	afx_msg void OnBnClickedBtnR();
+	afx_msg void OnBnClickedBtnL();
+	afx_msg void OnBnClickedBtnP();
+	afx_msg void OnBnClickedBtnCompare1();
+	afx_msg void OnBnClickedBtnT();
+	afx_msg void OnBnClickedBtnC();
+	afx_msg void OnBnClickedBtnE();
+
+	afx_msg void OnBnClickedBtnTmx();
+	afx_msg void OnBnClickedBtnTmy();
+	afx_msg void OnBnClickedBtnTmr();
+	afx_msg void OnBnClickedBtnTml();
+	afx_msg void OnBnClickedBtnCt();
+
+	afx_msg void OnBnClickedBtnD();
+	afx_msg void OnBnClickedBtnF();
+	afx_msg void OnBnClickedBtnNEQ();
+	afx_msg void OnBnClickedBtnGT();
+	afx_msg void OnBnClickedBtnLT();
+
+	afx_msg void OnBtn0();
+	afx_msg void OnBtn1();
+	afx_msg void OnBtn2();
+	afx_msg void OnBtn3();
+	afx_msg void OnBtn4();
+	afx_msg void OnBtn5();
+	afx_msg void OnBtn6();
+	afx_msg void OnBtn7();
+	afx_msg void OnBtn8();
+	afx_msg void OnBtn9();
+	afx_msg void OnBtnA();
+	afx_msg void OnBtnB();
+	afx_msg void OnBtnC();
+	afx_msg void OnBtnD();
+	afx_msg void OnBtnE();
+	afx_msg void OnBtnF();
+	afx_msg void OnBtnMinus();
+	afx_msg void OnBtnDot();
+	afx_msg void OnBtnRet();
+	afx_msg void OnBtnInsert();
+	afx_msg void OnBtnDelete();
+	afx_msg void OnBtnEsc();
+
+	int SetDisplay(int inputInfo);
+	int SetDisplay1(int inputInfo);
+//	int UpdateDisplay();
+	int display(tagInputCell stDisplayCell);
+	int SetCurCellPos(int nRow, int nCol, CMTerm1View::stCell theCell);
+
+	void stInit();
+
+
+	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
+};
+
+
diff --git a/MTerm1/Resource.h b/MTerm1/Resource.h
index 0279e9e..483b541 100644
--- a/MTerm1/Resource.h
+++ b/MTerm1/Resource.h
@@ -77,6 +77,7 @@
 #define IDD_DIALOGBAR                   351
 #define IDD_DIALOGBAR_INPUT_SHOW        351
 #define IDD_PROP_OUTPUT_MAPPING         352
+#define IDD_FORM_INPUTSHOW              353
 #define IDC_EDIT1                       1000
 #define IDC_BUTTON1                     1001
 #define IDC_BUTTON_LOAD                 1001
@@ -640,6 +641,10 @@
 #define ID_BUTTON33086                  33086
 #define ID_33088                        33088
 #define ID_MENU_SHOW_DEV                33089
+#define ID_33091                        33091
+#define ID_SHOW_LOG                     33092
+#define ID_33093                        33093
+#define ID_MENU_SHOWNAV                 33094
 #define IDS_STRING101                   33101
 #define ID_INDICATOR_SEL_TYPE           59135
 #define ID_INDICATOR_MACHINE_TYPE       59142
@@ -655,7 +660,7 @@
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        359
-#define _APS_NEXT_COMMAND_VALUE         33091
+#define _APS_NEXT_COMMAND_VALUE         33095
 #define _APS_NEXT_CONTROL_VALUE         1087
 #define _APS_NEXT_SYMED_VALUE           319
 #endif
diff --git a/MTerm2/MTerm2.vcxproj b/MTerm2/MTerm2.vcxproj
index 5e0fb48..79c8f70 100644
--- a/MTerm2/MTerm2.vcxproj
+++ b/MTerm2/MTerm2.vcxproj
@@ -23,21 +23,21 @@
     <ProjectGuid>{521DEE85-086F-4A6F-B926-135FC1F65267}</ProjectGuid>
     <Keyword>MFCProj</Keyword>
     <RootNamespace>MTerm2</RootNamespace>
-    <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
     <ProjectName>MTerm2</ProjectName>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
@@ -45,14 +45,14 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
diff --git a/MultiTerminal1/MultiTerminal1.vcxproj b/MultiTerminal1/MultiTerminal1.vcxproj
index 6b8113a..a4c4a33 100644
--- a/MultiTerminal1/MultiTerminal1.vcxproj
+++ b/MultiTerminal1/MultiTerminal1.vcxproj
@@ -23,20 +23,20 @@
     <ProjectGuid>{FB609F6E-0B21-4133-BF35-B4A79AE2F043}</ProjectGuid>
     <Keyword>MFCProj</Keyword>
     <RootNamespace>MultiTerminal1</RootNamespace>
-    <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
@@ -44,14 +44,14 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
     <UseOfMfc>Dynamic</UseOfMfc>

--
Gitblit v1.9.1