소스 검색

ADC DATA Value 평균 취하는 기능 추가 /Table EEPROM WRITE 기능 추가

PYJ 5 년 전
부모
커밋
4037bcda79

BIN
.vs/Jdas_Mbic/v15/.suo


BIN
.vs/Jdas_Mbic/v15/Server/sqlite3/storage.ide


BIN
.vs/Jdas_Mbic/v15/Server/sqlite3/storage.ide-shm


BIN
.vs/Jdas_Mbic/v15/Server/sqlite3/storage.ide-wal


+ 37 - 3
Jdas_Mbic/Func/Bluecell_BootProtocol.cs

@@ -120,8 +120,39 @@ namespace Jdas_Mbic
120 120
         byte ATT_ALC4_L;
121 121
         byte bluecell_crc;        
122 122
     };
123
+
123 124
     class Bluecell_BootProtocol
124 125
     {
126
+        public enum DATATYPE
127
+        {
128
+            ATTSET = 0x11,
129
+            ATT_DL1_PATH = 0x12,
130
+            ATT_UL1_PATH = 0x16,
131
+            ATT_SelfTest1 = 0x18,
132
+            ATT_DL2_PATH = 0x22,
133
+            ATT_UL2_PATH = 0x26,
134
+            ATT_SelfTest2 = 0x28,
135
+            ATT_DL3_PATH = 0x32,
136
+            ATT_UL3_PATH = 0x36,
137
+            ATT_SelfTest3 = 0x38,
138
+            ATT_DL4_PATH = 0x42,
139
+            ATT_UL4_PATH = 0x46,
140
+            ATT_SelfTest4 = 0x48,
141
+            ALC1_EN = 0x51,
142
+            ALC2_EN = 0x52,
143
+            ALC3_EN = 0x53,
144
+            ALC4_EN = 0x54,
145
+            AGC1_EN = 0x61,
146
+            AGC2_EN = 0x62,
147
+            AGC3_EN = 0x63,
148
+            AGC4_EN = 0x64,
149
+            ATT_TableSet = 0x70,
150
+            ATT_TableGet = 0x71,
151
+            Bluecell_StatusReq = 0x77,
152
+            Bluecell_StatusSave = 0x78,
153
+
154
+        };
155
+
125 156
         Serial serial;
126 157
         /*bluecell Header*/
127 158
         public const byte Bluecell_Header0 = 0x42;//ASCII : B
@@ -137,7 +168,7 @@ namespace Jdas_Mbic
137 168
         public const byte BLUECELL_TAILER = 0xEB;
138 169
         const byte BLUECELL_RESET_LENGTH = 6;
139 170
         const byte BLUECELL_FIX_DATA_LENGTH = 3;
140
-        const byte Bluecell_StatusReq = 0x77;
171
+        
141 172
         public void Bluecell_Reset(object serial)
142 173
         {
143 174
             this.serial = (Serial)serial;
@@ -157,7 +188,7 @@ namespace Jdas_Mbic
157 188
             byte[] temp_buf = new byte[6];
158 189
 
159 190
             temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
160
-            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = Bluecell_StatusReq;
191
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = (int)DATATYPE.Bluecell_StatusReq;
161 192
             temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length] = Convert.ToByte(temp_buf.Length - 3);
162 193
             temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = Convert.ToByte(temp_buf.Length - 2);
163 194
             temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 0] = crc16.STH30_CreateCrc(temp_buf, temp_buf[2]);
@@ -180,10 +211,13 @@ namespace Jdas_Mbic
180 211
             //  main_Form.Invoke(new ByteSend(this.main_Form.ReSetting_Values),(temp_buf));
181 212
             switch (type)
182 213
             {
183
-                case (byte)Bluecell_BootProtocol.Bluecell_StatusReq:
214
+                case (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_StatusReq:
184 215
 
185 216
                     this.main_Form.GUIDataStatusSet(temp_buf);
186 217
                     break;
218
+                case (byte)Bluecell_BootProtocol.DATATYPE.ATT_TableGet:
219
+                    this.main_Form.TableDataStatusSet(temp_buf);
220
+                    break;
187 221
                 //case (byte)Bluecell_Prot_t.TYPE_BLUECELL_ACK:
188 222
                     //this.main_Form.Message_Box_Open();
189 223
                  //   break;

+ 53 - 5
Jdas_Mbic/Main.Designer.cs

@@ -213,6 +213,7 @@
213 213
             this.Column_Offset = new System.Windows.Forms.DataGridViewTextBoxColumn();
214 214
             this.timer_JdasMbic = new System.Windows.Forms.Timer(this.components);
215 215
             this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
216
+            this.button_Save = new System.Windows.Forms.Button();
216 217
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
217 218
             this.tabControl1.SuspendLayout();
218 219
             this.tabPage_Main.SuspendLayout();
@@ -328,6 +329,7 @@
328 329
             // 
329 330
             // tabPage_Main
330 331
             // 
332
+            this.tabPage_Main.Controls.Add(this.button_Save);
331 333
             this.tabPage_Main.Controls.Add(this.checkBox_Fix);
332 334
             this.tabPage_Main.Controls.Add(this.groupBox_Temp);
333 335
             this.tabPage_Main.Controls.Add(this.groupBox5);
@@ -348,7 +350,7 @@
348 350
             // checkBox_Fix
349 351
             // 
350 352
             this.checkBox_Fix.AutoSize = true;
351
-            this.checkBox_Fix.Location = new System.Drawing.Point(7, 435);
353
+            this.checkBox_Fix.Location = new System.Drawing.Point(4, 517);
352 354
             this.checkBox_Fix.Name = "checkBox_Fix";
353 355
             this.checkBox_Fix.Size = new System.Drawing.Size(70, 16);
354 356
             this.checkBox_Fix.TabIndex = 147;
@@ -2341,10 +2343,10 @@
2341 2343
             this.numericUpDown9.Location = new System.Drawing.Point(150, 87);
2342 2344
             this.numericUpDown9.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
2343 2345
             this.numericUpDown9.Maximum = new decimal(new int[] {
2344
-            30,
2346
+            3125,
2345 2347
             0,
2346 2348
             0,
2347
-            0});
2349
+            131072});
2348 2350
             this.numericUpDown9.Name = "numericUpDown9";
2349 2351
             this.numericUpDown9.Size = new System.Drawing.Size(120, 21);
2350 2352
             this.numericUpDown9.TabIndex = 106;
@@ -2370,10 +2372,10 @@
2370 2372
             this.numericUpDown10.Location = new System.Drawing.Point(150, 55);
2371 2373
             this.numericUpDown10.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
2372 2374
             this.numericUpDown10.Maximum = new decimal(new int[] {
2373
-            30,
2375
+            3125,
2374 2376
             0,
2375 2377
             0,
2376
-            0});
2378
+            131072});
2377 2379
             this.numericUpDown10.Name = "numericUpDown10";
2378 2380
             this.numericUpDown10.Size = new System.Drawing.Size(120, 21);
2379 2381
             this.numericUpDown10.TabIndex = 107;
@@ -2424,21 +2426,54 @@
2424 2426
             // 
2425 2427
             // numericUpDown11
2426 2428
             // 
2429
+            this.numericUpDown11.DecimalPlaces = 1;
2430
+            this.numericUpDown11.Increment = new decimal(new int[] {
2431
+            5,
2432
+            0,
2433
+            0,
2434
+            65536});
2427 2435
             this.numericUpDown11.Location = new System.Drawing.Point(150, 86);
2436
+            this.numericUpDown11.Maximum = new decimal(new int[] {
2437
+            3125,
2438
+            0,
2439
+            0,
2440
+            131072});
2428 2441
             this.numericUpDown11.Name = "numericUpDown11";
2429 2442
             this.numericUpDown11.Size = new System.Drawing.Size(120, 21);
2430 2443
             this.numericUpDown11.TabIndex = 6;
2431 2444
             // 
2432 2445
             // numericUpDown_MultiOffset
2433 2446
             // 
2447
+            this.numericUpDown_MultiOffset.DecimalPlaces = 1;
2448
+            this.numericUpDown_MultiOffset.Increment = new decimal(new int[] {
2449
+            5,
2450
+            0,
2451
+            0,
2452
+            65536});
2434 2453
             this.numericUpDown_MultiOffset.Location = new System.Drawing.Point(150, 53);
2454
+            this.numericUpDown_MultiOffset.Maximum = new decimal(new int[] {
2455
+            3125,
2456
+            0,
2457
+            0,
2458
+            131072});
2435 2459
             this.numericUpDown_MultiOffset.Name = "numericUpDown_MultiOffset";
2436 2460
             this.numericUpDown_MultiOffset.Size = new System.Drawing.Size(120, 21);
2437 2461
             this.numericUpDown_MultiOffset.TabIndex = 6;
2438 2462
             // 
2439 2463
             // numericUpDown_MultiSet
2440 2464
             // 
2465
+            this.numericUpDown_MultiSet.DecimalPlaces = 1;
2466
+            this.numericUpDown_MultiSet.Increment = new decimal(new int[] {
2467
+            5,
2468
+            0,
2469
+            0,
2470
+            65536});
2441 2471
             this.numericUpDown_MultiSet.Location = new System.Drawing.Point(150, 23);
2472
+            this.numericUpDown_MultiSet.Maximum = new decimal(new int[] {
2473
+            3125,
2474
+            0,
2475
+            0,
2476
+            131072});
2442 2477
             this.numericUpDown_MultiSet.Name = "numericUpDown_MultiSet";
2443 2478
             this.numericUpDown_MultiSet.Size = new System.Drawing.Size(120, 21);
2444 2479
             this.numericUpDown_MultiSet.TabIndex = 6;
@@ -2559,6 +2594,7 @@
2559 2594
             this.button_FileLoad.TabIndex = 0;
2560 2595
             this.button_FileLoad.Text = "File Load";
2561 2596
             this.button_FileLoad.UseVisualStyleBackColor = true;
2597
+            this.button_FileLoad.Click += new System.EventHandler(this.button_FileLoad_Click);
2562 2598
             // 
2563 2599
             // button_FileSave
2564 2600
             // 
@@ -2568,6 +2604,7 @@
2568 2604
             this.button_FileSave.TabIndex = 0;
2569 2605
             this.button_FileSave.Text = "File Save";
2570 2606
             this.button_FileSave.UseVisualStyleBackColor = true;
2607
+            this.button_FileSave.Click += new System.EventHandler(this.button_FileSave_Click);
2571 2608
             // 
2572 2609
             // button_Initalize
2573 2610
             // 
@@ -2614,6 +2651,16 @@
2614 2651
             this.timer_JdasMbic.Interval = 500;
2615 2652
             this.timer_JdasMbic.Tick += new System.EventHandler(this.timer1_Tick);
2616 2653
             // 
2654
+            // button_Save
2655
+            // 
2656
+            this.button_Save.Location = new System.Drawing.Point(6, 431);
2657
+            this.button_Save.Name = "button_Save";
2658
+            this.button_Save.Size = new System.Drawing.Size(203, 68);
2659
+            this.button_Save.TabIndex = 148;
2660
+            this.button_Save.Text = "SAVE";
2661
+            this.button_Save.UseVisualStyleBackColor = true;
2662
+            this.button_Save.Click += new System.EventHandler(this.button_Save_Click);
2663
+            // 
2617 2664
             // JdasMbic
2618 2665
             // 
2619 2666
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
@@ -2927,6 +2974,7 @@
2927 2974
         public System.Windows.Forms.PictureBox pictureBox_AGC2_OFF;
2928 2975
         public System.Windows.Forms.PictureBox pictureBox_AGC2_ON;
2929 2976
         private System.Windows.Forms.CheckBox checkBox_Fix;
2977
+        private System.Windows.Forms.Button button_Save;
2930 2978
     }
2931 2979
 }
2932 2980
 

+ 114 - 56
Jdas_Mbic/Main.cs

@@ -15,8 +15,7 @@ using System.Windows.Forms;
15 15
 //Add
16 16
 using System.Reflection;
17 17
 using Excel = Microsoft.Office.Interop.Excel;
18
-
19
-
18
+using static Jdas_Mbic.Bluecell_BootProtocol;
20 19
 
21 20
 namespace Jdas_Mbic
22 21
 {
@@ -626,37 +625,13 @@ namespace Jdas_Mbic
626 625
 
627 626
 
628 627
       
629
-        enum DATATYPE
630
-        {
631
-            ATTSET  = 0x11,
632
-            ATT_DL1_PATH = 0x12,
633
-            ATT_UL1_PATH = 0x16,
634
-            ATT_SelfTest1 = 0x18,
635
-            ATT_DL2_PATH = 0x22,
636
-            ATT_UL2_PATH = 0x26,
637
-            ATT_SelfTest2 = 0x28,
638
-            ATT_DL3_PATH = 0x32,
639
-            ATT_UL3_PATH = 0x36,
640
-            ATT_SelfTest3 = 0x38,
641
-            ATT_DL4_PATH = 0x42,
642
-            ATT_UL4_PATH = 0x46,
643
-            ATT_SelfTest4 = 0x48,
644
-            ALC1_EN = 0x51,
645
-            ALC2_EN = 0x52,
646
-            ALC3_EN = 0x53,
647
-            ALC4_EN = 0x54,
648
-            AGC1_EN = 0x61,
649
-            AGC2_EN = 0x62,
650
-            AGC3_EN = 0x63,
651
-            AGC4_EN = 0x64,
652 628
 
653
-        };
654 629
         const byte BLUECELL_ATTEN_LENGTH = 32 + 5;
655 630
         private void button_ATT_Click_1(object sender, EventArgs e)
656 631
         {
657 632
             byte[] temp_buf = new byte[BLUECELL_ATTEN_LENGTH];
658 633
             Button btn = (Button)sender;
659
-            DATATYPE datatype = DATATYPE.ATTSET;
634
+            byte datatype = (byte)Bluecell_BootProtocol.DATATYPE.ATTSET;
660 635
             Int16[] DL = new Int16[4];
661 636
             Int16[] UL = new Int16[4];
662 637
             Int16[] ALC = new Int16[4];
@@ -1235,22 +1210,22 @@ namespace Jdas_Mbic
1235 1210
             ATT_ALC3_ONOFF,
1236 1211
             ATT_AGC4_ONOFF,
1237 1212
             ATT_ALC4_ONOFF,
1238
-            ATT_AGC1_H,
1239
-            ATT_AGC1_L,
1240 1213
             ATT_ALC1_H,
1241 1214
             ATT_ALC1_L,
1242
-            ATT_AGC2_H,
1243
-            ATT_AGC2_L,
1244 1215
             ATT_ALC2_H,
1245 1216
             ATT_ALC2_L,
1246
-            ATT_AGC3_H,
1247
-            ATT_AGC3_L,
1248 1217
             ATT_ALC3_H,
1249 1218
             ATT_ALC3_L,
1250
-            ATT_AGC4_H,
1251
-            ATT_AGC4_L,
1252 1219
             ATT_ALC4_H,
1253 1220
             ATT_ALC4_L,
1221
+            ATT_AGC1_H,
1222
+            ATT_AGC1_L,
1223
+            ATT_AGC2_H,
1224
+            ATT_AGC2_L,
1225
+            ATT_AGC3_H,
1226
+            ATT_AGC3_L,
1227
+            ATT_AGC4_H,
1228
+            ATT_AGC4_L,
1254 1229
             bluecell_crc,
1255 1230
         };
1256 1231
         const byte Reqdatastartindex = 4;
@@ -1265,6 +1240,10 @@ namespace Jdas_Mbic
1265 1240
             TextBox Temp_label = (TextBox)label;
1266 1241
             Temp_label.Text = str;
1267 1242
         }
1243
+        private void Table_Text_Set(object label, String str)
1244
+        {
1245
+            label = str;
1246
+        }
1268 1247
         private void PicVisible_Text_Set(object label, bool set)
1269 1248
         {
1270 1249
             PictureBox Temp_pic = (PictureBox)label;
@@ -1277,6 +1256,7 @@ namespace Jdas_Mbic
1277 1256
         }
1278 1257
         public void GUIDataStatusSet(byte[] buf)
1279 1258
         {
1259
+            double Volt_Calc_val = 3.3 / 4095;
1280 1260
             double adcdata = 0;
1281 1261
             if (buf[(int)BluecellReqIndex.Selftest0] == 0)
1282 1262
             {
@@ -1413,6 +1393,7 @@ namespace Jdas_Mbic
1413 1393
                 adcdata = 0;
1414 1394
                 adcdata += ((buf[(int)BluecellReqIndex.ATT_DL1_H] << 8) & 0xFF00);
1415 1395
                 adcdata += (buf[(int)BluecellReqIndex.ATT_DL1_L] & 0x00FF);
1396
+                
1416 1397
                 adcdata /= 100;
1417 1398
                 this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_DL1, adcdata.ToString("N2"));
1418 1399
                 adcdata = 0;
@@ -1433,22 +1414,22 @@ namespace Jdas_Mbic
1433 1414
                 adcdata = 0;
1434 1415
 
1435 1416
                 adcdata += ((buf[(int)BluecellReqIndex.ATT_UL1_H] << 8) & 0xFF00);
1436
-                adcdata += (buf[(int)BluecellReqIndex.ATT_UL1_H] & 0x00FF);
1417
+                adcdata += (buf[(int)BluecellReqIndex.ATT_UL1_L] & 0x00FF);
1437 1418
                 adcdata /= 100;
1438 1419
                 this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_UL1, adcdata.ToString("N2"));
1439 1420
                 adcdata = 0;
1440 1421
                 adcdata += ((buf[(int)BluecellReqIndex.ATT_UL2_H] << 8) & 0xFF00);
1441
-                adcdata += (buf[(int)BluecellReqIndex.ATT_UL2_H] & 0x00FF);
1422
+                adcdata += (buf[(int)BluecellReqIndex.ATT_UL2_L] & 0x00FF);
1442 1423
                 adcdata /= 100;
1443 1424
                 this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_UL2, adcdata.ToString("N2"));
1444 1425
                 adcdata = 0;
1445 1426
                 adcdata += ((buf[(int)BluecellReqIndex.ATT_UL3_H] << 8) & 0xFF00);
1446
-                adcdata += (buf[(int)BluecellReqIndex.ATT_UL3_H] & 0x00FF);
1427
+                adcdata += (buf[(int)BluecellReqIndex.ATT_UL3_L] & 0x00FF);
1447 1428
                 adcdata /= 100;
1448 1429
                 this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_UL3, adcdata.ToString("N2"));
1449 1430
                 adcdata = 0;
1450 1431
                 adcdata += ((buf[(int)BluecellReqIndex.ATT_UL4_H] << 8) & 0xFF00);
1451
-                adcdata += (buf[(int)BluecellReqIndex.ATT_UL4_H] & 0x00FF);
1432
+                adcdata += (buf[(int)BluecellReqIndex.ATT_UL4_L] & 0x00FF);
1452 1433
                 adcdata /= 100;
1453 1434
                 this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_UL4, adcdata.ToString("N2"));
1454 1435
                 adcdata = 0;
@@ -1502,58 +1483,59 @@ namespace Jdas_Mbic
1502 1483
 
1503 1484
 
1504 1485
             }
1505
-            adcdata += ((buf[(int)BluecellReqIndex.DET_DL1_IN_H] << 8) & 0xFF00);
1486
+            adcdata = 0;
1487
+            adcdata = ((buf[(int)BluecellReqIndex.DET_DL1_IN_H] << 8) & 0xFF00);
1506 1488
             adcdata += (buf[(int)BluecellReqIndex.DET_DL1_IN_L] & 0x00FF);
1507
-            adcdata /= 100;
1489
+            adcdata *= Volt_Calc_val;
1508 1490
             this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_DL1, adcdata.ToString("N2"));
1509 1491
             adcdata = 0;
1510 1492
 
1511
-            adcdata += ((buf[(int)BluecellReqIndex.DET_DL2_IN_H] << 8) & 0xFF00);
1493
+            adcdata = ((buf[(int)BluecellReqIndex.DET_DL2_IN_H] << 8) & 0xFF00);
1512 1494
             adcdata += (buf[(int)BluecellReqIndex.DET_DL2_IN_L] & 0x00FF);
1513
-            adcdata /= 100;
1495
+            adcdata *= Volt_Calc_val;
1514 1496
             this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_DL2, adcdata.ToString("N2"));
1515 1497
             adcdata = 0;
1516 1498
 
1517
-            adcdata += ((buf[(int)BluecellReqIndex.DET_DL3_IN_H] << 8) & 0xFF00);
1499
+            adcdata = ((buf[(int)BluecellReqIndex.DET_DL3_IN_H] << 8) & 0xFF00);
1518 1500
             adcdata += (buf[(int)BluecellReqIndex.DET_DL3_IN_L] & 0x00FF);
1519
-            adcdata /= 100;
1501
+            adcdata *= Volt_Calc_val;
1520 1502
             this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_DL3, adcdata.ToString("N2"));
1521 1503
             adcdata = 0;
1522 1504
 
1523
-            adcdata += ((buf[(int)BluecellReqIndex.DET_DL4_IN_H] << 8) & 0xFF00);
1505
+            adcdata = ((buf[(int)BluecellReqIndex.DET_DL4_IN_H] << 8) & 0xFF00);
1524 1506
             adcdata += (buf[(int)BluecellReqIndex.DET_DL4_IN_L] & 0x00FF);
1525
-            adcdata /= 100;
1507
+            adcdata *= Volt_Calc_val;
1526 1508
             this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_DL4, adcdata.ToString("N2"));
1527 1509
             adcdata = 0;
1528 1510
 
1529 1511
 
1530
-            adcdata += ((buf[(int)BluecellReqIndex.DET_UL1_IN_H] << 8) & 0xFF00);
1512
+            adcdata = ((buf[(int)BluecellReqIndex.DET_UL1_IN_H] << 8) & 0xFF00);
1531 1513
             adcdata += (buf[(int)BluecellReqIndex.DET_UL1_IN_L] & 0x00FF);
1532
-            adcdata /= 100;
1514
+            adcdata *= Volt_Calc_val;
1533 1515
             this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL1, adcdata.ToString("N2"));
1534 1516
             adcdata = 0;
1535 1517
 
1536
-            adcdata += ((buf[(int)BluecellReqIndex.DET_UL2_IN_H] << 8) & 0xFF00);
1518
+            adcdata = ((buf[(int)BluecellReqIndex.DET_UL2_IN_H] << 8) & 0xFF00);
1537 1519
             adcdata += (buf[(int)BluecellReqIndex.DET_UL2_IN_L] & 0x00FF);
1538
-            adcdata /= 100;
1520
+            adcdata *= Volt_Calc_val;
1539 1521
             this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL2, adcdata.ToString("N2"));
1540 1522
             adcdata = 0;
1541 1523
 
1542
-            adcdata += ((buf[(int)BluecellReqIndex.DET_UL3_IN_H] << 8) & 0xFF00);
1524
+            adcdata = ((buf[(int)BluecellReqIndex.DET_UL3_IN_H] << 8) & 0xFF00);
1543 1525
             adcdata += (buf[(int)BluecellReqIndex.DET_UL3_IN_L] & 0x00FF);
1544
-            adcdata /= 100;
1526
+            adcdata *= Volt_Calc_val;
1545 1527
             this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL3, adcdata.ToString("N2"));
1546 1528
             adcdata = 0;
1547 1529
 
1548
-            adcdata += ((buf[(int)BluecellReqIndex.DET_UL4_IN_H] << 8) & 0xFF00);
1530
+            adcdata = ((buf[(int)BluecellReqIndex.DET_UL4_IN_H] << 8) & 0xFF00);
1549 1531
             adcdata += (buf[(int)BluecellReqIndex.DET_UL4_IN_L] & 0x00FF);
1550
-            adcdata /= 100;
1532
+            adcdata *= Volt_Calc_val;
1551 1533
             this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL4, adcdata.ToString("N2"));
1552 1534
             adcdata = 0;
1553 1535
 
1554 1536
             /*adcdata += ((buf[(int)BluecellReqIndex.DET_TEMP_H] << 8) & 0xFF00);
1555 1537
             adcdata += (buf[(int)BluecellReqIndex.DET_TEMP_L] & 0x00FF);
1556
-            adcdata /= 100;
1538
+            adcdata *= Volt_Calc_val;
1557 1539
             this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL1, adcdata.ToString("N2"));
1558 1540
             adcdata = 0;*/
1559 1541
 
@@ -1647,6 +1629,29 @@ namespace Jdas_Mbic
1647 1629
             }
1648 1630
 
1649 1631
         }
1632
+        public void TableDataStatusSet(byte[] buf)
1633
+        {
1634
+#if true
1635
+            Int16 TableValue = 0;
1636
+            double ret = 0;
1637
+            for (int i = 0; i < (buf[(int)Bluecell_ProtIndex_p.Bluecell_Length] - 4)/2; i++) {
1638
+                TableValue = buf[(int)(Bluecell_ProtIndex_p.Bluecell_data + 1 )+ i * 2];
1639
+                TableValue <<= 8;
1640
+
1641
+                TableValue += buf[(int)(Bluecell_ProtIndex_p.Bluecell_data + 1) + i * 2 + 1];
1642
+                ret = Convert.ToDouble(TableValue) / 100;
1643
+                dataGridView_TableSetting[1, i].Value = ret.ToString("N2");
1644
+                //this.Invoke(new StringSend(Table_Text_Set), dataGridView_TableSetting[1, i].Value, TableValue.ToString("N2"));
1645
+            }
1646
+
1647
+            /*dataGridView_TableSetting[1, i].Value
1648
+            this.Invoke(new StringSend(Table_Text_Set), dataGridView_TableSetting, adcdata.ToString("N2"));*/
1649
+
1650
+
1651
+    
1652
+#endif
1653
+
1654
+        }
1650 1655
 
1651 1656
 
1652 1657
         private void ATT_Enter(object sender, KeyEventArgs e)
@@ -1685,6 +1690,59 @@ namespace Jdas_Mbic
1685 1690
         {
1686 1691
 
1687 1692
 
1693
+        }
1694
+
1695
+        const byte TableMaxLength = 128 + 6; // Header + Type + Length + CRCINDEX + TableIndex + .....    +  CRC
1696
+
1697
+        private void button_FileSave_Click(object sender, EventArgs e)
1698
+        {
1699
+            byte[] temp_buf = new byte[TableMaxLength];
1700
+            byte tmp_h = 0 , tmp_l = 0;
1701
+            Int16 ret = 0;
1702
+           //temp_buf[] = dataGridView_TableSetting.Rows[r - 1].Cells[1].Value
1703
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
1704
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = (byte)Bluecell_BootProtocol.DATATYPE.ATT_TableSet;
1705
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length] = TableMaxLength - 2;
1706
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = TableMaxLength - 2;
1707
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = (byte)comboBox_TableName.SelectedIndex;
1708
+
1709
+            for(int i = 0; i < dataGridView_TableSetting.RowCount; i++)
1710
+            {
1711
+                ret = Convert.ToInt16(Convert.ToDouble(dataGridView_TableSetting[1, i].Value ) * 100);
1712
+                tmp_h = Convert.ToByte((ret & 0xFF00) >> 8);
1713
+                tmp_l = Convert.ToByte((ret & 0x00FF));
1714
+                temp_buf[(int)(Bluecell_ProtIndex_p.Bluecell_data + 1) + i * 2 ] = tmp_h;
1715
+                temp_buf[(int)(Bluecell_ProtIndex_p.Bluecell_data + 1) + (i * 2) + 1] = tmp_l;
1716
+            }
1717
+
1718
+
1719
+            serial.Serial_DataSend(temp_buf, temp_buf.Length);
1720
+
1721
+        }
1722
+        const byte TableGetMaxLength =  1 + 6;
1723
+        private void button_FileLoad_Click(object sender, EventArgs e)
1724
+        {
1725
+            byte[] temp_buf = new byte[TableGetMaxLength];
1726
+
1727
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
1728
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = (byte)Bluecell_BootProtocol.DATATYPE.ATT_TableGet;
1729
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length] = TableGetMaxLength - 2;
1730
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = TableGetMaxLength - 2;
1731
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = (byte)comboBox_TableName.SelectedIndex;
1732
+            serial.Serial_DataSend(temp_buf, temp_buf.Length);
1733
+        }
1734
+
1735
+        private void button_Save_Click(object sender, EventArgs e)
1736
+        {
1737
+            byte[] temp_buf = new byte[TableGetMaxLength];
1738
+
1739
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
1740
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_StatusSave;
1741
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length] = TableGetMaxLength - 2;
1742
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = TableGetMaxLength - 2;
1743
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = (byte)1;
1744
+            serial.Serial_DataSend(temp_buf, temp_buf.Length);
1745
+
1688 1746
         }
1689 1747
     }
1690 1748
 }

+ 0 - 6
Jdas_Mbic/Main.resx

@@ -2024,12 +2024,6 @@
2024 2024
   <metadata name="Column_Offset.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
2025 2025
     <value>True</value>
2026 2026
   </metadata>
2027
-  <metadata name="Column_DB.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
2028
-    <value>True</value>
2029
-  </metadata>
2030
-  <metadata name="Column_Offset.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
2031
-    <value>True</value>
2032
-  </metadata>
2033 2027
   <metadata name="timer_JdasMbic.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
2034 2028
     <value>27, 11</value>
2035 2029
   </metadata>

BIN
Jdas_Mbic/bin/Debug/Jdas_Mbic.exe


BIN
Jdas_Mbic/bin/Debug/Jdas_Mbic.pdb


BIN
Jdas_Mbic/obj/Debug/Jdas_Mbic.csproj.GenerateResource.cache


BIN
Jdas_Mbic/obj/Debug/Jdas_Mbic.exe


BIN
Jdas_Mbic/obj/Debug/Jdas_Mbic.pdb