Explorar el Código

CRC Add / File open Dialog 추가

YJ hace 6 años
padre
commit
6abdcce624

+ 16 - 3
Basic_Terminal/Basic_Terminal.csproj

@@ -46,14 +46,27 @@
46 46
     <Reference Include="System.Xml" />
47 47
   </ItemGroup>
48 48
   <ItemGroup>
49
-    <Compile Include="Form1.cs">
49
+    <Compile Include="Crc16.cs" />
50
+    <Compile Include="Download_bar.cs">
50 51
       <SubType>Form</SubType>
51 52
     </Compile>
52
-    <Compile Include="Form1.Designer.cs">
53
-      <DependentUpon>Form1.cs</DependentUpon>
53
+    <Compile Include="Download_bar.Designer.cs">
54
+      <DependentUpon>Download_bar.cs</DependentUpon>
55
+    </Compile>
56
+    <Compile Include="Main_Form.cs">
57
+      <SubType>Form</SubType>
58
+    </Compile>
59
+    <Compile Include="Main_Form.Designer.cs">
60
+      <DependentUpon>Main_Form.cs</DependentUpon>
54 61
     </Compile>
55 62
     <Compile Include="Program.cs" />
56 63
     <Compile Include="Properties\AssemblyInfo.cs" />
64
+    <EmbeddedResource Include="Download_bar.resx">
65
+      <DependentUpon>Download_bar.cs</DependentUpon>
66
+    </EmbeddedResource>
67
+    <EmbeddedResource Include="Main_Form.resx">
68
+      <DependentUpon>Main_Form.cs</DependentUpon>
69
+    </EmbeddedResource>
57 70
     <EmbeddedResource Include="Properties\Resources.resx">
58 71
       <Generator>ResXFileCodeGenerator</Generator>
59 72
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>

+ 125 - 0
Basic_Terminal/Crc16.cs

@@ -0,0 +1,125 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace Basic_Terminal
8
+{
9
+    
10
+
11
+    class Crc16
12
+    {
13
+        private ushort[] Table_CRC16 = {
14
+            0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
15
+            0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
16
+            0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
17
+            0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
18
+            0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
19
+            0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
20
+            0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
21
+            0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
22
+            0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
23
+            0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
24
+            0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
25
+            0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
26
+            0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
27
+            0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
28
+            0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
29
+            0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
30
+            0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
31
+            0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
32
+            0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
33
+            0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
34
+            0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
35
+            0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
36
+            0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
37
+            0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
38
+            0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
39
+            0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
40
+            0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
41
+            0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
42
+            0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
43
+            0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
44
+            0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
45
+            0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
46
+        };
47
+
48
+        public enum etError
49
+        {
50
+            CHECKSUM_ERROR = 0,
51
+            NO_ERROR
52
+        }
53
+        //-----------------------------------------------
54
+        //UART CRC üũ �Լ�
55
+        //-----------------------------------------------
56
+        public ushort CRC16_Generate(byte[] buf_ptr, int len)
57
+        {
58
+            byte dt = 0;
59
+            ushort crc16 = 0;
60
+            ushort index = 0;
61
+            len *= 8;
62
+            for (crc16 = (ushort)0x0000; len >= 8; len -= 8)
63
+            {
64
+                crc16 = (ushort)(Table_CRC16[(crc16 >> 8) ^ (ushort)(buf_ptr[index++])] ^ (crc16 << 8));
65
+            }
66
+
67
+            if (len != 0)
68
+            {
69
+                dt = (byte)( buf_ptr[index] << 8);
70
+
71
+                while (len != 0)
72
+                {
73
+                    len--;
74
+
75
+                    if (((crc16 ^ dt) & ((ushort)1 << 15)) != 0)
76
+                    {
77
+                        crc16 = (ushort)(crc16 << 1);
78
+                        crc16 = (ushort)(crc16 ^ 0x1021);
79
+                    }
80
+                    else
81
+                    {
82
+                        crc16 = (ushort)(crc16 << 1);
83
+                    }
84
+                    dt = (byte)(dt << 1);
85
+                }
86
+            }
87
+            return (crc16);
88
+        }
89
+
90
+        etError CRC16_Check(byte[] buf_ptr, int len, ushort checksum)
91
+        {
92
+            byte dt = 0;
93
+            ushort crc16 = 0;
94
+            ushort index = 0;
95
+
96
+            len *= 8;
97
+            for (crc16 = (ushort)0x0000; len >= 8; len -= 8, index++)
98
+            {
99
+                crc16 = (ushort)(Table_CRC16[(crc16 >> 8) ^ (ushort)(buf_ptr[index])] ^ (crc16 << 8));
100
+            }
101
+
102
+            if (len != 0)
103
+            {
104
+                dt = (byte)(buf_ptr[index] << 8);
105
+
106
+                while (len != 0)
107
+                {
108
+                    len--;
109
+
110
+                    if (((crc16 ^ dt) & ((ushort)1 << 15)) != 0)
111
+                    {
112
+                        crc16 = (ushort)(crc16 << 1);
113
+                        crc16 = (ushort)(crc16 ^ 0x1021);
114
+                    }
115
+                    else
116
+                    {
117
+                        crc16 = (ushort)(crc16 << 1);
118
+                    }
119
+                    dt = (byte)(dt << 1);
120
+                }
121
+            }
122
+            return (crc16 == checksum ? etError.CHECKSUM_ERROR : etError.NO_ERROR);
123
+        }
124
+    }
125
+}

+ 81 - 0
Basic_Terminal/Download_bar.Designer.cs

@@ -0,0 +1,81 @@
1
+namespace Basic_Terminal
2
+{
3
+    partial class Download_bar
4
+    {
5
+        /// <summary>
6
+        /// Required designer variable.
7
+        /// </summary>
8
+        private System.ComponentModel.IContainer components = null;
9
+
10
+        /// <summary>
11
+        /// Clean up any resources being used.
12
+        /// </summary>
13
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14
+        protected override void Dispose(bool disposing)
15
+        {
16
+            if (disposing && (components != null))
17
+            {
18
+                components.Dispose();
19
+            }
20
+            base.Dispose(disposing);
21
+        }
22
+
23
+        #region Windows Form Designer generated code
24
+
25
+        /// <summary>
26
+        /// Required method for Designer support - do not modify
27
+        /// the contents of this method with the code editor.
28
+        /// </summary>
29
+        private void InitializeComponent()
30
+        {
31
+            this.progressBar1 = new System.Windows.Forms.ProgressBar();
32
+            this.Update_label = new System.Windows.Forms.Label();
33
+            this.SuspendLayout();
34
+            // 
35
+            // progressBar1
36
+            // 
37
+            this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
38
+            | System.Windows.Forms.AnchorStyles.Left) 
39
+            | System.Windows.Forms.AnchorStyles.Right)));
40
+            this.progressBar1.Location = new System.Drawing.Point(52, 24);
41
+            this.progressBar1.Name = "progressBar1";
42
+            this.progressBar1.Size = new System.Drawing.Size(398, 46);
43
+            this.progressBar1.Step = 1;
44
+            this.progressBar1.TabIndex = 133;
45
+            // 
46
+            // Update_label
47
+            // 
48
+            this.Update_label.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
49
+            | System.Windows.Forms.AnchorStyles.Left) 
50
+            | System.Windows.Forms.AnchorStyles.Right)));
51
+            this.Update_label.AutoSize = true;
52
+            this.Update_label.BackColor = System.Drawing.Color.Transparent;
53
+            this.Update_label.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
54
+            this.Update_label.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
55
+            this.Update_label.Location = new System.Drawing.Point(245, 9);
56
+            this.Update_label.Name = "Update_label";
57
+            this.Update_label.Size = new System.Drawing.Size(23, 12);
58
+            this.Update_label.TabIndex = 134;
59
+            this.Update_label.Text = "0%";
60
+            // 
61
+            // Download_bar
62
+            // 
63
+            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
64
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
65
+            this.ClientSize = new System.Drawing.Size(502, 94);
66
+            this.Controls.Add(this.Update_label);
67
+            this.Controls.Add(this.progressBar1);
68
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
69
+            this.Name = "Download_bar";
70
+            this.Text = "Download_bar";
71
+            this.ResumeLayout(false);
72
+            this.PerformLayout();
73
+
74
+        }
75
+
76
+        #endregion
77
+
78
+        private System.Windows.Forms.ProgressBar progressBar1;
79
+        public System.Windows.Forms.Label Update_label;
80
+    }
81
+}

+ 2 - 2
Basic_Terminal/Form1.cs

@@ -10,9 +10,9 @@ using System.Windows.Forms;
10 10
 
11 11
 namespace Basic_Terminal
12 12
 {
13
-    public partial class Form1 : Form
13
+    public partial class Download_bar : Form
14 14
     {
15
-        public Form1()
15
+        public Download_bar()
16 16
         {
17 17
             InitializeComponent();
18 18
         }

+ 120 - 0
Basic_Terminal/Download_bar.resx

@@ -0,0 +1,120 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+</root>

+ 0 - 40
Basic_Terminal/Form1.Designer.cs

@@ -1,40 +0,0 @@
1
-namespace Basic_Terminal
2
-{
3
-    partial class Form1
4
-    {
5
-        /// <summary>
6
-        /// 필수 디자이너 변수입니다.
7
-        /// </summary>
8
-        private System.ComponentModel.IContainer components = null;
9
-
10
-        /// <summary>
11
-        /// 사용 중인 모든 리소스를 정리합니다.
12
-        /// </summary>
13
-        /// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
14
-        protected override void Dispose(bool disposing)
15
-        {
16
-            if (disposing && (components != null))
17
-            {
18
-                components.Dispose();
19
-            }
20
-            base.Dispose(disposing);
21
-        }
22
-
23
-        #region Windows Form 디자이너에서 생성한 코드
24
-
25
-        /// <summary>
26
-        /// 디자이너 지원에 필요한 메서드입니다. 
27
-        /// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
28
-        /// </summary>
29
-        private void InitializeComponent()
30
-        {
31
-            this.components = new System.ComponentModel.Container();
32
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
33
-            this.ClientSize = new System.Drawing.Size(800, 450);
34
-            this.Text = "Form1";
35
-        }
36
-
37
-        #endregion
38
-    }
39
-}
40
-

+ 231 - 0
Basic_Terminal/Main_Form.Designer.cs

@@ -0,0 +1,231 @@
1
+namespace Basic_Terminal
2
+{
3
+    partial class Main_Form
4
+    {
5
+        /// <summary>
6
+        /// 필수 디자이너 변수입니다.
7
+        /// </summary>
8
+        private System.ComponentModel.IContainer components = null;
9
+
10
+        /// <summary>
11
+        /// 사용 중인 모든 리소스를 정리합니다.
12
+        /// </summary>
13
+        /// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
14
+        protected override void Dispose(bool disposing)
15
+        {
16
+            if (disposing && (components != null))
17
+            {
18
+                components.Dispose();
19
+            }
20
+            base.Dispose(disposing);
21
+        }
22
+
23
+        #region Windows Form 디자이너에서 생성한 코드
24
+
25
+        /// <summary>
26
+        /// 디자이너 지원에 필요한 메서드입니다. 
27
+        /// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
28
+        /// </summary>
29
+        private void InitializeComponent()
30
+        {
31
+            this.groupBox9 = new System.Windows.Forms.GroupBox();
32
+            this.button3 = new System.Windows.Forms.Button();
33
+            this.Start_button = new System.Windows.Forms.Button();
34
+            this.Ascii_checkBox = new System.Windows.Forms.CheckBox();
35
+            this.cmCom_Port = new System.Windows.Forms.Label();
36
+            this.button1 = new System.Windows.Forms.Button();
37
+            this.PortClose_button = new System.Windows.Forms.Button();
38
+            this.comboBox1 = new System.Windows.Forms.ComboBox();
39
+            this.cmBaudRate = new System.Windows.Forms.Label();
40
+            this.comboBox2 = new System.Windows.Forms.ComboBox();
41
+            this.Crc16_Check = new System.Windows.Forms.Button();
42
+            this.label1 = new System.Windows.Forms.Label();
43
+            this.groupBox9.SuspendLayout();
44
+            this.SuspendLayout();
45
+            // 
46
+            // groupBox9
47
+            // 
48
+            this.groupBox9.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
49
+            | System.Windows.Forms.AnchorStyles.Left) 
50
+            | System.Windows.Forms.AnchorStyles.Right)));
51
+            this.groupBox9.Controls.Add(this.button3);
52
+            this.groupBox9.Controls.Add(this.Start_button);
53
+            this.groupBox9.Controls.Add(this.Ascii_checkBox);
54
+            this.groupBox9.Controls.Add(this.cmCom_Port);
55
+            this.groupBox9.Controls.Add(this.button1);
56
+            this.groupBox9.Controls.Add(this.PortClose_button);
57
+            this.groupBox9.Controls.Add(this.comboBox1);
58
+            this.groupBox9.Controls.Add(this.cmBaudRate);
59
+            this.groupBox9.Controls.Add(this.comboBox2);
60
+            this.groupBox9.Location = new System.Drawing.Point(12, 23);
61
+            this.groupBox9.Name = "groupBox9";
62
+            this.groupBox9.Size = new System.Drawing.Size(225, 223);
63
+            this.groupBox9.TabIndex = 82;
64
+            this.groupBox9.TabStop = false;
65
+            this.groupBox9.Text = "Connection";
66
+            // 
67
+            // button3
68
+            // 
69
+            this.button3.Location = new System.Drawing.Point(14, 180);
70
+            this.button3.Name = "button3";
71
+            this.button3.Size = new System.Drawing.Size(200, 28);
72
+            this.button3.TabIndex = 93;
73
+            this.button3.Text = "Firmware Update";
74
+            this.button3.UseVisualStyleBackColor = true;
75
+            this.button3.Click += new System.EventHandler(this.Firmware_Update_Click);
76
+            // 
77
+            // Start_button
78
+            // 
79
+            this.Start_button.Location = new System.Drawing.Point(13, 146);
80
+            this.Start_button.Name = "Start_button";
81
+            this.Start_button.Size = new System.Drawing.Size(200, 28);
82
+            this.Start_button.TabIndex = 94;
83
+            this.Start_button.Text = "Terminal";
84
+            this.Start_button.UseVisualStyleBackColor = true;
85
+            // 
86
+            // Ascii_checkBox
87
+            // 
88
+            this.Ascii_checkBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
89
+            | System.Windows.Forms.AnchorStyles.Left) 
90
+            | System.Windows.Forms.AnchorStyles.Right)));
91
+            this.Ascii_checkBox.AutoSize = true;
92
+            this.Ascii_checkBox.Location = new System.Drawing.Point(14, 69);
93
+            this.Ascii_checkBox.Name = "Ascii_checkBox";
94
+            this.Ascii_checkBox.Size = new System.Drawing.Size(55, 16);
95
+            this.Ascii_checkBox.TabIndex = 92;
96
+            this.Ascii_checkBox.Text = "ASCII";
97
+            this.Ascii_checkBox.UseVisualStyleBackColor = true;
98
+            // 
99
+            // cmCom_Port
100
+            // 
101
+            this.cmCom_Port.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
102
+            | System.Windows.Forms.AnchorStyles.Left) 
103
+            | System.Windows.Forms.AnchorStyles.Right)));
104
+            this.cmCom_Port.AutoSize = true;
105
+            this.cmCom_Port.Location = new System.Drawing.Point(11, 18);
106
+            this.cmCom_Port.Name = "cmCom_Port";
107
+            this.cmCom_Port.Size = new System.Drawing.Size(58, 12);
108
+            this.cmCom_Port.TabIndex = 89;
109
+            this.cmCom_Port.Text = "Com Port";
110
+            // 
111
+            // button1
112
+            // 
113
+            this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
114
+            | System.Windows.Forms.AnchorStyles.Left) 
115
+            | System.Windows.Forms.AnchorStyles.Right)));
116
+            this.button1.Location = new System.Drawing.Point(13, 95);
117
+            this.button1.Name = "button1";
118
+            this.button1.Size = new System.Drawing.Size(93, 34);
119
+            this.button1.TabIndex = 86;
120
+            this.button1.Text = "Port Open";
121
+            this.button1.UseVisualStyleBackColor = true;
122
+            // 
123
+            // PortClose_button
124
+            // 
125
+            this.PortClose_button.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
126
+            | System.Windows.Forms.AnchorStyles.Left) 
127
+            | System.Windows.Forms.AnchorStyles.Right)));
128
+            this.PortClose_button.Location = new System.Drawing.Point(118, 95);
129
+            this.PortClose_button.Name = "PortClose_button";
130
+            this.PortClose_button.Size = new System.Drawing.Size(93, 34);
131
+            this.PortClose_button.TabIndex = 87;
132
+            this.PortClose_button.Text = "Port Closed";
133
+            this.PortClose_button.UseVisualStyleBackColor = true;
134
+            // 
135
+            // comboBox1
136
+            // 
137
+            this.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
138
+            | System.Windows.Forms.AnchorStyles.Left) 
139
+            | System.Windows.Forms.AnchorStyles.Right)));
140
+            this.comboBox1.Cursor = System.Windows.Forms.Cursors.Default;
141
+            this.comboBox1.FormattingEnabled = true;
142
+            this.comboBox1.Location = new System.Drawing.Point(109, 15);
143
+            this.comboBox1.Name = "comboBox1";
144
+            this.comboBox1.Size = new System.Drawing.Size(101, 20);
145
+            this.comboBox1.TabIndex = 88;
146
+            // 
147
+            // cmBaudRate
148
+            // 
149
+            this.cmBaudRate.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
150
+            | System.Windows.Forms.AnchorStyles.Left) 
151
+            | System.Windows.Forms.AnchorStyles.Right)));
152
+            this.cmBaudRate.AutoSize = true;
153
+            this.cmBaudRate.Location = new System.Drawing.Point(11, 47);
154
+            this.cmBaudRate.Name = "cmBaudRate";
155
+            this.cmBaudRate.Size = new System.Drawing.Size(94, 12);
156
+            this.cmBaudRate.TabIndex = 90;
157
+            this.cmBaudRate.Text = "Baud Rate(bps)";
158
+            // 
159
+            // comboBox2
160
+            // 
161
+            this.comboBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
162
+            | System.Windows.Forms.AnchorStyles.Left) 
163
+            | System.Windows.Forms.AnchorStyles.Right)));
164
+            this.comboBox2.FormattingEnabled = true;
165
+            this.comboBox2.Items.AddRange(new object[] {
166
+            "9600",
167
+            "14400",
168
+            "19200",
169
+            "38400",
170
+            "57600",
171
+            "115200",
172
+            "128000"});
173
+            this.comboBox2.Location = new System.Drawing.Point(110, 45);
174
+            this.comboBox2.Name = "comboBox2";
175
+            this.comboBox2.Size = new System.Drawing.Size(101, 20);
176
+            this.comboBox2.TabIndex = 91;
177
+            this.comboBox2.Text = "115200";
178
+            // 
179
+            // Crc16_Check
180
+            // 
181
+            this.Crc16_Check.Location = new System.Drawing.Point(12, 285);
182
+            this.Crc16_Check.Name = "Crc16_Check";
183
+            this.Crc16_Check.Size = new System.Drawing.Size(96, 23);
184
+            this.Crc16_Check.TabIndex = 83;
185
+            this.Crc16_Check.Text = "Crc16 Check";
186
+            this.Crc16_Check.UseVisualStyleBackColor = true;
187
+            this.Crc16_Check.Click += new System.EventHandler(this.Crc16_Check_Click);
188
+            // 
189
+            // label1
190
+            // 
191
+            this.label1.AutoSize = true;
192
+            this.label1.Location = new System.Drawing.Point(127, 290);
193
+            this.label1.Name = "label1";
194
+            this.label1.Size = new System.Drawing.Size(110, 12);
195
+            this.label1.TabIndex = 84;
196
+            this.label1.Text = "Check Sum Result";
197
+            // 
198
+            // Main_Form
199
+            // 
200
+            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
201
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
202
+            this.ClientSize = new System.Drawing.Size(800, 450);
203
+            this.Controls.Add(this.label1);
204
+            this.Controls.Add(this.Crc16_Check);
205
+            this.Controls.Add(this.groupBox9);
206
+            this.Name = "Main_Form";
207
+            this.Text = "Form1";
208
+            this.groupBox9.ResumeLayout(false);
209
+            this.groupBox9.PerformLayout();
210
+            this.ResumeLayout(false);
211
+            this.PerformLayout();
212
+
213
+        }
214
+
215
+        #endregion
216
+
217
+        private System.Windows.Forms.GroupBox groupBox9;
218
+        private System.Windows.Forms.Button button3;
219
+        private System.Windows.Forms.Button Start_button;
220
+        private System.Windows.Forms.CheckBox Ascii_checkBox;
221
+        private System.Windows.Forms.Label cmCom_Port;
222
+        private System.Windows.Forms.Button button1;
223
+        private System.Windows.Forms.Button PortClose_button;
224
+        private System.Windows.Forms.ComboBox comboBox1;
225
+        private System.Windows.Forms.Label cmBaudRate;
226
+        private System.Windows.Forms.ComboBox comboBox2;
227
+        private System.Windows.Forms.Button Crc16_Check;
228
+        private System.Windows.Forms.Label label1;
229
+    }
230
+}
231
+

+ 64 - 0
Basic_Terminal/Main_Form.cs

@@ -0,0 +1,64 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Data;
5
+using System.Drawing;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+using System.Windows.Forms;
10
+//Add code
11
+
12
+using System.IO;
13
+namespace Basic_Terminal
14
+{
15
+    public partial class Main_Form : Form
16
+    {
17
+        OpenFileDialog ofd = new OpenFileDialog();
18
+      
19
+        public Main_Form()
20
+        {
21
+            InitializeComponent();
22
+        }
23
+
24
+        private void Firmware_Update_Click(object sender, EventArgs e)
25
+        {
26
+            if (Ascii_checkBox.Checked == true)
27
+                Ascii_checkBox.Checked = false;
28
+                ShowFileOpenDialog();
29
+        }
30
+        private string ShowFileOpenDialog()
31
+        {
32
+            byte[] tempdata = new byte[5];
33
+            ofd.Title = "업데이터 파일 탐색기";//파일오픈창 생성 및 설정
34
+            ofd.FileName = "*.bin";
35
+            //ofd.Filter = "bin 파일 (*.bin) | *.bin; | 모든 파일 (*.*) | *.*";
36
+            ofd.Filter = "bin 파일 (*.bin) | *.bin;";
37
+            DialogResult dr = ofd.ShowDialog();            //파일 오픈창 로드
38
+            if (dr == DialogResult.OK)//OK버튼 클릭시
39
+            {
40
+                string fileName = ofd.SafeFileName;                //File명과 확장자를 가지고 온다.
41
+                string fileFullName = ofd.FileName;//File경로와 File명을 모두 가지고 온다.
42
+                string filePath = fileFullName.Replace(fileName, "");//File경로만 가지고 온다.
43
+                UpdateFileSend(File.ReadAllBytes(ofd.FileName));
44
+                return fileFullName;
45
+            }
46
+            else if (dr == DialogResult.Cancel)//취소버튼 클릭시 또는 ESC키로 파일창을 종료 했을경우
47
+            {
48
+                return "";
49
+            }
50
+            return "";
51
+        }
52
+        private void UpdateFileSend(byte[] data)
53
+        {
54
+
55
+        }
56
+
57
+        private void Crc16_Check_Click(object sender, EventArgs e)
58
+        {
59
+            Crc16 crc16 = new Crc16();
60
+            byte[] tempdata = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
61
+            label1.Text = crc16.CRC16_Generate(tempdata, 10).ToString();
62
+        }
63
+    }
64
+}

+ 120 - 0
Basic_Terminal/Main_Form.resx

@@ -0,0 +1,120 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+</root>

+ 1 - 1
Basic_Terminal/Program.cs

@@ -16,7 +16,7 @@ namespace Basic_Terminal
16 16
         {
17 17
             Application.EnableVisualStyles();
18 18
             Application.SetCompatibleTextRenderingDefault(false);
19
-            Application.Run(new Form1());
19
+            Application.Run(new Main_Form());
20 20
         }
21 21
     }
22 22
 }