using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace KHModbus { static class Program { /// /// 해당 애플리케이션의 주 진입점입니다. /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); DBConnectionSingleton.Instance(); //test(); Application.Run(new FormModbus()); } static void test() { int Addr = 620; int[] Data = new int[] { 65535, 65534, 3, 4, 5, 6, 7, 8, 9, 10 }; string[,] result = new string[Data.Length * 16, 2]; int aa = 0; string Result = ""; for (int i = 0; i < Data.Length; i++) { byte[] a = BitConverter.GetBytes(Convert.ToUInt16(Data[i])); for (int j = 0; j < a.Length; j++) { string s = Convert.ToString(a[j], 2).PadLeft(8, '0'); char[] sa = s.ToCharArray(); Array.Reverse(sa); for (int r = 0; r < sa.Length; r++) { result[((i * a.Length * 8) + (j * 8)) + r, 0] = (Convert.ToInt32(Addr) + i).ToString() + "." + ((j * 8) + r).ToString(); result[((i * a.Length * 8) + (j * 8)) + r, 1] = sa[r].ToString(); } Result += new string(sa); } } } } }