Przeglądaj źródła

MBIC_PE43711 계산 방식 변경 ,Atten 제어의 전체 적용

PYJ 5 lat temu
rodzic
commit
d8dca48667
2 zmienionych plików z 199 dodań i 116 usunięć
  1. 198 115
      Bluecell_Src/Bluecell_operate.c
  2. 1 1
      Src/main.c

+ 198 - 115
Bluecell_Src/Bluecell_operate.c

@@ -215,15 +215,15 @@ uint8_t PE43711_Calc(uint8_t* Table,uint8_t high_bit,uint8_t low_bit,uint8_t off
215 215
     Result = PE43711_DataToHexConvert(ret);
216 216
     return Result;
217 217
 }
218
-uint8_t MBIC_PE43711_Calc(uint8_t* Table,int16_t MBIC_Val,uint8_t offset_h,uint8_t offset_l){
218
+uint8_t MBIC_PE43711_Calc(uint8_t* Table,int16_t MBIC_Val,int16_t MBIC_UserVal){
219 219
 
220 220
     double ret = 0;
221 221
     uint8_t Result = 0;
222 222
     //ret = PE43711_Double(MBIC_Val); // Hidden Atten Calc
223
-    ret = MBIC_Val * -1;
224
-    ret += PE43711_Double(offset_h,offset_l);//Plus User Atten Calc
225
-    ret += PE43711_Double(0,HIDDENATTEN);//Plus Default Atten 5
226
-    printf("ret1 : %f \r\n",ret); // 2
223
+    ret = (MBIC_Val /10 )* -1;
224
+    ret += (MBIC_UserVal/10)* -1;//Plus User Atten Calc
225
+    ret += HIDDENATTEN/10;//PE43711_Double(0,HIDDENATTEN);//Plus Default Atten 5
226
+//    printf("ret1 : %f \r\n",ret); // 2
227 227
     ret = TableAtteGuarantee(Table,ret);//Table Guarantee
228 228
 //    printf("ret2 : %f \r\n",ret);
229 229
     Result = PE43711_DataToHexConvert(ret);
@@ -309,6 +309,7 @@ int8_t AGC_Table_ref[sizeof(AGC_dBm_t)] = {
309 309
 }; 
310 310
 void Bluecell_AttenInitialize(){
311 311
     uint8_t val = 0;
312
+    int16_t MBIC_Val = 0,MBIC_UserVal = 0;
312 313
     Bluecell_StructCpy(&AutoControl_Save[0],&AGC_Table_ref[0],sizeof(AGC_dBm_t));
313 314
 
314 315
     
@@ -317,44 +318,49 @@ void Bluecell_AttenInitialize(){
317 318
     bluecell_Prevdatastatus.ATT_DL1_L = bluecell_Currdatastatus.ATT_DL1_L;
318 319
     bluecell_Prevdatastatus.bluecell_User_DL1_H = bluecell_Currdatastatus.bluecell_User_DL1_H;
319 320
     bluecell_Prevdatastatus.bluecell_User_DL1_L = bluecell_Currdatastatus.bluecell_User_DL1_L;
320
-    val = PE43711_Calc(&Att_DL1.Table_0_0_dBm, // Table Offset
321
-                        bluecell_Currdatastatus.ATT_DL1_H,         // Hidden Atten High bit
322
-                        bluecell_Currdatastatus.ATT_DL1_L,         // Hidden Atten Low bit
323
-                       bluecell_Currdatastatus.bluecell_User_DL1_H, // User Atten High Bit
324
-                       bluecell_Currdatastatus.bluecell_User_DL1_L);// User Atten Low Bit
321
+
322
+    MBIC_Val = bluecell_Currdatastatus.ATT_DL1_H << 8 | bluecell_Currdatastatus.ATT_DL1_L;
323
+    MBIC_UserVal = bluecell_Currdatastatus.bluecell_User_DL1_H << 8 | bluecell_Currdatastatus.bluecell_User_DL1_L;
324
+    val = MBIC_PE43711_Calc(&Att_DL1.Table_0_0_dBm, // Table Offset
325
+                        MBIC_Val,
326
+                       MBIC_UserVal);// User Atten Low Bit
327
+
325 328
     PE43711_atten_ctrl(ALL_ATT.ATT_DL1,val);
326 329
 
327 330
     bluecell_Prevdatastatus.ATT_DL2_H = bluecell_Currdatastatus.ATT_DL2_H;
328 331
     bluecell_Prevdatastatus.ATT_DL2_L = bluecell_Currdatastatus.ATT_DL2_L;
329 332
     bluecell_Prevdatastatus.bluecell_User_DL2_H = bluecell_Currdatastatus.bluecell_User_DL2_H;
330 333
     bluecell_Prevdatastatus.bluecell_User_DL2_L = bluecell_Currdatastatus.bluecell_User_DL2_L;
331
-    val = PE43711_Calc(&Att_DL2.Table_0_0_dBm, // Table Offset
332
-                        bluecell_Currdatastatus.ATT_DL2_H,         // Hidden Atten High bit
333
-                        bluecell_Currdatastatus.ATT_DL2_L,         // Hidden Atten Low bit
334
-                       bluecell_Currdatastatus.bluecell_User_DL2_H, // User Atten High Bit
335
-                       bluecell_Currdatastatus.bluecell_User_DL2_L);// User Atten Low Bit
334
+    MBIC_Val = bluecell_Currdatastatus.ATT_DL2_H << 8 | bluecell_Currdatastatus.ATT_DL2_L;
335
+    MBIC_UserVal = bluecell_Currdatastatus.bluecell_User_DL2_H << 8 | bluecell_Currdatastatus.bluecell_User_DL2_L;
336
+    val = MBIC_PE43711_Calc(&Att_DL2.Table_0_0_dBm, // Table Offset
337
+                        MBIC_Val,
338
+                       MBIC_UserVal);// User Atten Low Bit
339
+
336 340
     PE43711_atten_ctrl(ALL_ATT.ATT_DL2,val);
337 341
 
338 342
         bluecell_Prevdatastatus.ATT_DL3_H = bluecell_Currdatastatus.ATT_DL3_H;
339 343
     bluecell_Prevdatastatus.ATT_DL3_L = bluecell_Currdatastatus.ATT_DL3_L;
340 344
     bluecell_Prevdatastatus.bluecell_User_DL3_H = bluecell_Currdatastatus.bluecell_User_DL3_H;
341 345
     bluecell_Prevdatastatus.bluecell_User_DL3_L = bluecell_Currdatastatus.bluecell_User_DL3_L;
342
-    val = PE43711_Calc(&Att_DL3.Table_0_0_dBm, // Table Offset
343
-                        bluecell_Currdatastatus.ATT_DL3_H,         // Hidden Atten High bit
344
-                        bluecell_Currdatastatus.ATT_DL3_L,         // Hidden Atten Low bit
345
-                       bluecell_Currdatastatus.bluecell_User_DL3_H, // User Atten High Bit
346
-                       bluecell_Currdatastatus.bluecell_User_DL3_L);// User Atten Low Bit
346
+    MBIC_Val = bluecell_Currdatastatus.ATT_DL2_H << 8 | bluecell_Currdatastatus.ATT_DL2_L;
347
+    MBIC_UserVal = bluecell_Currdatastatus.bluecell_User_DL2_H << 8 | bluecell_Currdatastatus.bluecell_User_DL2_L;
348
+    val = MBIC_PE43711_Calc(&Att_DL2.Table_0_0_dBm, // Table Offset
349
+                        MBIC_Val,
350
+                       MBIC_UserVal);// User Atten Low Bit
351
+
347 352
     PE43711_atten_ctrl(ALL_ATT.ATT_DL3,val);
348 353
 
349 354
         bluecell_Prevdatastatus.ATT_DL4_H = bluecell_Currdatastatus.ATT_DL4_H;
350 355
     bluecell_Prevdatastatus.ATT_DL4_L = bluecell_Currdatastatus.ATT_DL4_L;
351 356
     bluecell_Prevdatastatus.bluecell_User_DL4_H = bluecell_Currdatastatus.bluecell_User_DL4_H;
352 357
     bluecell_Prevdatastatus.bluecell_User_DL4_L = bluecell_Currdatastatus.bluecell_User_DL4_L;
353
-    val = PE43711_Calc(&Att_DL4.Table_0_0_dBm, // Table Offset
354
-                        bluecell_Currdatastatus.ATT_DL4_H,         // Hidden Atten High bit
355
-                        bluecell_Currdatastatus.ATT_DL4_L,         // Hidden Atten Low bit
356
-                       bluecell_Currdatastatus.bluecell_User_DL4_H, // User Atten High Bit
357
-                       bluecell_Currdatastatus.bluecell_User_DL4_L);// User Atten Low Bit
358
+    MBIC_Val = bluecell_Currdatastatus.ATT_DL3_H << 8 | bluecell_Currdatastatus.ATT_DL3_L;
359
+    MBIC_UserVal = bluecell_Currdatastatus.bluecell_User_DL3_H << 8 | bluecell_Currdatastatus.bluecell_User_DL3_L;
360
+    val = MBIC_PE43711_Calc(&Att_DL3.Table_0_0_dBm, // Table Offset
361
+                        MBIC_Val,
362
+                       MBIC_UserVal);// User Atten Low Bit
363
+
358 364
     PE43711_atten_ctrl(ALL_ATT.ATT_DL4,val);
359 365
 
360 366
 
@@ -363,11 +369,12 @@ void Bluecell_AttenInitialize(){
363 369
             bluecell_Prevdatastatus.ATT_UL1_L = bluecell_Currdatastatus.ATT_UL1_L;
364 370
             bluecell_Prevdatastatus.bluecell_User_UL1_H = bluecell_Currdatastatus.bluecell_User_UL1_H;
365 371
             bluecell_Prevdatastatus.bluecell_User_UL1_L = bluecell_Currdatastatus.bluecell_User_UL1_L;
366
-            val = PE43711_Calc(&Att_UL1.Table_0_0_dBm,// Table Offset
367
-                                bluecell_Currdatastatus.ATT_UL1_H,// Hidden Atten High bit
368
-                                bluecell_Currdatastatus.ATT_UL1_L,// Hidden Atten Low bit
369
-                               bluecell_Currdatastatus.bluecell_User_UL1_H,// User Atten High Bit
370
-                               bluecell_Currdatastatus.bluecell_User_UL1_L);// User Atten Low Bit
372
+            MBIC_Val = bluecell_Currdatastatus.ATT_UL1_H << 8 | bluecell_Currdatastatus.ATT_UL1_L;
373
+            MBIC_UserVal = bluecell_Currdatastatus.bluecell_User_UL1_H << 8 | bluecell_Currdatastatus.bluecell_User_UL1_L;
374
+            val = MBIC_PE43711_Calc(&Att_UL1.Table_0_0_dBm, // Table Offset
375
+                                MBIC_Val,
376
+                               MBIC_UserVal);// User Atten Low Bit
377
+
371 378
     //        printf("%d val = %x \r\n",__LINE__,val);
372 379
             PE43711_atten_ctrl(ALL_ATT.ATT_UL1,val);
373 380
 
@@ -375,11 +382,12 @@ void Bluecell_AttenInitialize(){
375 382
             bluecell_Prevdatastatus.ATT_UL2_L = bluecell_Currdatastatus.ATT_UL2_L;
376 383
             bluecell_Prevdatastatus.bluecell_User_UL2_H = bluecell_Currdatastatus.bluecell_User_UL2_H;
377 384
             bluecell_Prevdatastatus.bluecell_User_UL2_L = bluecell_Currdatastatus.bluecell_User_UL2_L;
378
-            val = PE43711_Calc(&Att_UL2.Table_0_0_dBm,// Table Offset
379
-                                bluecell_Currdatastatus.ATT_UL2_H,// Hidden Atten High bit
380
-                                bluecell_Currdatastatus.ATT_UL2_L,// Hidden Atten Low bit
381
-                               bluecell_Currdatastatus.bluecell_User_UL2_H,// User Atten High Bit
382
-                               bluecell_Currdatastatus.bluecell_User_UL2_L);// User Atten Low Bit
385
+            MBIC_Val = bluecell_Currdatastatus.ATT_UL2_H << 8 | bluecell_Currdatastatus.ATT_UL2_L;
386
+            MBIC_UserVal = bluecell_Currdatastatus.bluecell_User_UL2_H << 8 | bluecell_Currdatastatus.bluecell_User_UL2_L;
387
+            val = MBIC_PE43711_Calc(&Att_UL1.Table_0_0_dBm, // Table Offset
388
+                                MBIC_Val,
389
+                               MBIC_UserVal);// User Atten Low Bit
390
+
383 391
     //        printf("%d val = %x \r\n",__LINE__,val);
384 392
             PE43711_atten_ctrl(ALL_ATT.ATT_UL2,val);
385 393
 
@@ -388,11 +396,12 @@ void Bluecell_AttenInitialize(){
388 396
             bluecell_Prevdatastatus.ATT_UL3_L = bluecell_Currdatastatus.ATT_UL3_L;
389 397
             bluecell_Prevdatastatus.bluecell_User_UL3_H = bluecell_Currdatastatus.bluecell_User_UL3_H;
390 398
             bluecell_Prevdatastatus.bluecell_User_UL3_L = bluecell_Currdatastatus.bluecell_User_UL3_L;
391
-            val = PE43711_Calc(&Att_UL3.Table_0_0_dBm,// Table Offset
392
-                                bluecell_Currdatastatus.ATT_UL3_H,// Hidden Atten High bit
393
-                                bluecell_Currdatastatus.ATT_UL3_L,// Hidden Atten Low bit
394
-                               bluecell_Currdatastatus.bluecell_User_UL3_H,// User Atten High Bit
395
-                               bluecell_Currdatastatus.bluecell_User_UL3_L);// User Atten Low Bit
399
+            MBIC_Val = bluecell_Currdatastatus.ATT_UL3_H << 8 | bluecell_Currdatastatus.ATT_UL3_L;
400
+            MBIC_UserVal = bluecell_Currdatastatus.bluecell_User_UL3_H << 8 | bluecell_Currdatastatus.bluecell_User_UL3_L;
401
+            val = MBIC_PE43711_Calc(&Att_UL3.Table_0_0_dBm, // Table Offset
402
+                                MBIC_Val,
403
+                               MBIC_UserVal);// User Atten Low Bit
404
+
396 405
     //        printf("%d val = %x \r\n",__LINE__,val);
397 406
             PE43711_atten_ctrl(ALL_ATT.ATT_UL3,val);
398 407
 
@@ -401,11 +410,12 @@ void Bluecell_AttenInitialize(){
401 410
             bluecell_Prevdatastatus.ATT_UL4_L = bluecell_Currdatastatus.ATT_UL4_L;
402 411
             bluecell_Prevdatastatus.bluecell_User_UL4_H = bluecell_Currdatastatus.bluecell_User_UL4_H;
403 412
             bluecell_Prevdatastatus.bluecell_User_UL4_L = bluecell_Currdatastatus.bluecell_User_UL4_L;
404
-            val = PE43711_Calc(&Att_UL4.Table_0_0_dBm,// Table Offset
405
-                                bluecell_Currdatastatus.ATT_UL4_H,// Hidden Atten High bit
406
-                                bluecell_Currdatastatus.ATT_UL4_L,// Hidden Atten Low bit
407
-                               bluecell_Currdatastatus.bluecell_User_UL4_H,// User Atten High Bit
408
-                               bluecell_Currdatastatus.bluecell_User_UL4_L);// User Atten Low Bit
413
+            MBIC_Val = bluecell_Currdatastatus.ATT_UL4_H << 8 | bluecell_Currdatastatus.ATT_UL4_L;
414
+            MBIC_UserVal = bluecell_Currdatastatus.bluecell_User_UL4_H << 8 | bluecell_Currdatastatus.bluecell_User_UL4_L;
415
+            val = MBIC_PE43711_Calc(&Att_UL4.Table_0_0_dBm, // Table Offset
416
+                                MBIC_Val,
417
+                               MBIC_UserVal);// User Atten Low Bit
418
+
409 419
     //        printf("%d val = %x \r\n",__LINE__,val);
410 420
             PE43711_atten_ctrl(ALL_ATT.ATT_UL4,val);
411 421
 
@@ -413,6 +423,7 @@ void Bluecell_AttenInitialize(){
413 423
 void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
414 424
      uint8_t val = 0;
415 425
      int16_t MBIC_Val = 0;
426
+     int16_t MBIC_UserVal = 0;
416 427
 
417 428
     if((Curr.ATT_DL1_H != Prev.ATT_DL1_H
418 429
      ||Curr.ATT_DL1_L != Prev.ATT_DL1_L)
@@ -424,12 +435,12 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
424 435
             bluecell_Prevdatastatus.bluecell_User_DL1_H = bluecell_Currdatastatus.bluecell_User_DL1_H;
425 436
             bluecell_Prevdatastatus.bluecell_User_DL1_L = bluecell_Currdatastatus.bluecell_User_DL1_L;
426 437
             MBIC_Val = Curr.ATT_DL1_H << 8 | Curr.ATT_DL1_L;
438
+            MBIC_UserVal = Curr.bluecell_User_DL1_H << 8 | Curr.bluecell_User_DL1_L;
427 439
             val = MBIC_PE43711_Calc(&Att_DL1.Table_0_0_dBm, // Table Offset
428 440
                                 MBIC_Val,
429
-                               bluecell_Currdatastatus.bluecell_User_DL1_H, // User Atten High Bit
430
-                               bluecell_Currdatastatus.bluecell_User_DL1_L);// User Atten Low Bit
431
-//            printf("%s : %d \r\n",__func__,__LINE__);   
432
-//            printf("%d val = %x \r\n",__LINE__,val);
441
+                               MBIC_UserVal);// User Atten Low Bit
442
+            printf("%s : %d \r\n",__func__,__LINE__);   
443
+            printf("%d val = %x \r\n",__LINE__,val);
433 444
             PE43711_atten_ctrl(ALL_ATT.ATT_DL1,val);
434 445
      
435 446
     }
@@ -442,10 +453,10 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
442 453
             bluecell_Prevdatastatus.bluecell_User_DL2_H = bluecell_Currdatastatus.bluecell_User_DL2_H;
443 454
             bluecell_Prevdatastatus.bluecell_User_DL2_L = bluecell_Currdatastatus.bluecell_User_DL2_L;
444 455
             MBIC_Val = Curr.ATT_DL2_H << 8 | Curr.ATT_DL2_L;
456
+            MBIC_UserVal = Curr.bluecell_User_DL2_H << 8 | Curr.bluecell_User_DL2_L;
445 457
             val = MBIC_PE43711_Calc(&Att_DL2.Table_0_0_dBm,// Table Offset
446 458
                                 MBIC_Val,// Hidden Atten Low bit
447
-                               bluecell_Currdatastatus.bluecell_User_DL2_H,// User Atten High Bit
448
-                               bluecell_Currdatastatus.bluecell_User_DL2_L);// User Atten Low Bit
459
+                               MBIC_UserVal);// User Atten Low Bit
449 460
 //            printf("%d val = %x \r\n",__LINE__,val);
450 461
             PE43711_atten_ctrl(ALL_ATT.ATT_DL2,val);
451 462
     }
@@ -460,10 +471,11 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
460 471
         bluecell_Prevdatastatus.bluecell_User_DL3_H = bluecell_Currdatastatus.bluecell_User_DL3_H;
461 472
         bluecell_Prevdatastatus.bluecell_User_DL3_L = bluecell_Currdatastatus.bluecell_User_DL3_L;
462 473
             MBIC_Val = Curr.ATT_DL3_H << 8 | Curr.ATT_DL3_L;
474
+            MBIC_UserVal = Curr.bluecell_User_DL3_H << 8 | Curr.bluecell_User_DL3_L;
475
+            
463 476
             val = MBIC_PE43711_Calc(&Att_DL3.Table_0_0_dBm,// Table Offset
464 477
                             MBIC_Val,// Hidden Atten Low bit
465
-                           bluecell_Currdatastatus.bluecell_User_DL3_H,// User Atten High Bit
466
-                           bluecell_Currdatastatus.bluecell_User_DL3_L);// User Atten Low Bit
478
+                           MBIC_UserVal);// User Atten Low Bit
467 479
         printf("%d val = %x \r\n",__LINE__,val);
468 480
         PE43711_atten_ctrl(ALL_ATT.ATT_DL3,val);
469 481
     }
@@ -480,10 +492,10 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
480 492
             bluecell_Prevdatastatus.bluecell_User_DL4_H = bluecell_Currdatastatus.bluecell_User_DL4_H;
481 493
             bluecell_Prevdatastatus.bluecell_User_DL4_L = bluecell_Currdatastatus.bluecell_User_DL4_L;
482 494
             MBIC_Val = Curr.ATT_DL4_H << 8 | Curr.ATT_DL4_L;
495
+            MBIC_UserVal = Curr.bluecell_User_DL4_H << 8 | Curr.bluecell_User_DL4_L;
483 496
             val = MBIC_PE43711_Calc(&Att_DL4.Table_0_0_dBm,// Table Offset
484 497
                                 MBIC_Val,// Hidden Atten Low bit
485
-                               bluecell_Currdatastatus.bluecell_User_DL4_H,// User Atten High Bit
486
-                               bluecell_Currdatastatus.bluecell_User_DL4_L);// User Atten Low Bit
498
+                               MBIC_UserVal);// User Atten Low Bit
487 499
             printf("%d val = %x \r\n",__LINE__,val);
488 500
             PE43711_atten_ctrl(ALL_ATT.ATT_DL4,val);
489 501
     }
@@ -498,11 +510,11 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
498 510
             bluecell_Prevdatastatus.ATT_UL1_L = bluecell_Currdatastatus.ATT_UL1_L;
499 511
             bluecell_Prevdatastatus.bluecell_User_UL1_H = bluecell_Currdatastatus.bluecell_User_UL1_H;
500 512
             bluecell_Prevdatastatus.bluecell_User_UL1_L = bluecell_Currdatastatus.bluecell_User_UL1_L;
501
-            MBIC_Val = Curr.ATT_DL1_H << 8 | Curr.ATT_DL1_L;
513
+            MBIC_Val = Curr.ATT_UL1_H << 8 | Curr.ATT_UL1_L;
514
+            MBIC_UserVal = Curr.bluecell_User_UL1_H << 8 | Curr.bluecell_User_UL1_L;
502 515
             val = MBIC_PE43711_Calc(&Att_UL1.Table_0_0_dBm,// Table Offset
503 516
                                 MBIC_Val,// Hidden Atten Low bit
504
-                               bluecell_Currdatastatus.bluecell_User_UL1_H,// User Atten High Bit
505
-                               bluecell_Currdatastatus.bluecell_User_UL1_L);// User Atten Low Bit
517
+                               MBIC_UserVal);// User Atten Low Bit
506 518
     //        printf("%d val = %x \r\n",__LINE__,val);
507 519
             PE43711_atten_ctrl(ALL_ATT.ATT_UL1,val);
508 520
     }
@@ -514,11 +526,11 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
514 526
             bluecell_Prevdatastatus.ATT_UL2_L = bluecell_Currdatastatus.ATT_UL2_L;
515 527
             bluecell_Prevdatastatus.bluecell_User_UL2_H = bluecell_Currdatastatus.bluecell_User_UL2_H;
516 528
             bluecell_Prevdatastatus.bluecell_User_UL2_L = bluecell_Currdatastatus.bluecell_User_UL2_L;
517
-            MBIC_Val = Curr.ATT_DL2_H << 8 | Curr.ATT_DL2_L;
529
+            MBIC_Val = Curr.ATT_UL2_H << 8 | Curr.ATT_UL2_L;
530
+            MBIC_UserVal = Curr.bluecell_User_UL2_H << 8 | Curr.bluecell_User_UL2_L;
518 531
             val = MBIC_PE43711_Calc(&Att_UL2.Table_0_0_dBm,// Table Offset
519 532
                                 MBIC_Val,// Hidden Atten Low bit
520
-                               bluecell_Currdatastatus.bluecell_User_UL2_H,// User Atten High Bit
521
-                               bluecell_Currdatastatus.bluecell_User_UL2_L);// User Atten Low Bit
533
+                               MBIC_UserVal);// User Atten Low Bit
522 534
     //        printf("%d val = %x \r\n",__LINE__,val);
523 535
             PE43711_atten_ctrl(ALL_ATT.ATT_UL2,val);
524 536
     }
@@ -533,11 +545,11 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
533 545
             bluecell_Prevdatastatus.bluecell_User_UL3_H = bluecell_Currdatastatus.bluecell_User_UL3_H;
534 546
             bluecell_Prevdatastatus.bluecell_User_UL3_L = bluecell_Currdatastatus.bluecell_User_UL3_L;
535 547
             
536
-            MBIC_Val = Curr.ATT_DL3_H << 8 | Curr.ATT_DL3_L;
548
+            MBIC_Val = Curr.ATT_UL3_H << 8 | Curr.ATT_UL3_L;
549
+            MBIC_UserVal = Curr.bluecell_User_UL3_H << 8 | Curr.bluecell_User_UL3_L;
537 550
             val = MBIC_PE43711_Calc(&Att_UL3.Table_0_0_dBm,// Table Offset
538 551
                                 MBIC_Val,// Hidden Atten Low bit
539
-                               bluecell_Currdatastatus.bluecell_User_UL3_H,// User Atten High Bit
540
-                               bluecell_Currdatastatus.bluecell_User_UL3_L);// User Atten Low Bit
552
+                               MBIC_UserVal);// User Atten Low Bit
541 553
     //        printf("%d val = %x \r\n",__LINE__,val);
542 554
             PE43711_atten_ctrl(ALL_ATT.ATT_UL3,val);
543 555
     }
@@ -550,11 +562,11 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
550 562
             bluecell_Prevdatastatus.bluecell_User_UL4_H = bluecell_Currdatastatus.bluecell_User_UL4_H;
551 563
             bluecell_Prevdatastatus.bluecell_User_UL4_L = bluecell_Currdatastatus.bluecell_User_UL4_L;
552 564
             
553
-            MBIC_Val = Curr.ATT_DL4_H << 8 | Curr.ATT_DL4_L;
565
+            MBIC_Val = Curr.ATT_UL4_H << 8 | Curr.ATT_UL4_L;
566
+            MBIC_UserVal = Curr.bluecell_User_UL4_H << 8 | Curr.bluecell_User_UL4_L;
554 567
             val = MBIC_PE43711_Calc(&Att_UL4.Table_0_0_dBm,// Table Offset
555 568
                                 MBIC_Val,// Hidden Atten Low bit
556
-                               bluecell_Currdatastatus.bluecell_User_UL4_H,// User Atten High Bit
557
-                               bluecell_Currdatastatus.bluecell_User_UL4_L);// User Atten Low Bit
569
+                               MBIC_UserVal);// User Atten Low Bit
558 570
     //        printf("%d val = %x \r\n",__LINE__,val);
559 571
             PE43711_atten_ctrl(ALL_ATT.ATT_UL4,val);
560 572
     }
@@ -1911,6 +1923,7 @@ void ALARM_Value_Get(uint8_t datatype,uint8_t* ret){
1911 1923
 uint32_t MBIC_DataSend(uint8_t* data){
1912 1924
     uint32_t i = 0;
1913 1925
     uint32_t Length = 0;
1926
+    int16_t tmpdata = 0;
1914 1927
 
1915 1928
     
1916 1929
     /*ALARM BIT LIST*/
@@ -2215,13 +2228,13 @@ uint32_t MBIC_DataSend(uint8_t* data){
2215 2228
     
2216 2229
      /*DLI_RF_Path1_ON_OFF*/
2217 2230
     data[MBIC_PAYLOADSTART + i++] = MBIC_AID;
2218
-    printf("data[%d]:%x\r\n",MBIC_PAYLOADSTART + i-1,data[MBIC_PAYLOADSTART + i-1]);
2231
+  //  printf("data[%d]:%x\r\n",MBIC_PAYLOADSTART + i-1,data[MBIC_PAYLOADSTART + i-1]);
2219 2232
     data[MBIC_PAYLOADSTART + i++] = DLI_RF_Path1_ON_OFF;
2220
-     printf("data[%d]:%x\r\n",MBIC_PAYLOADSTART + i-1,data[MBIC_PAYLOADSTART + i-1]);
2233
+   //  printf("data[%d]:%x\r\n",MBIC_PAYLOADSTART + i-1,data[MBIC_PAYLOADSTART + i-1]);
2221 2234
     data[MBIC_PAYLOADSTART + i++] = 1; // LENGTH
2222 2235
     Length += 1  ;
2223 2236
     data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ATT_DL1_PATH;
2224
-     printf("data[%d]:%x\r\n",MBIC_PAYLOADSTART + i-1,data[MBIC_PAYLOADSTART + i-1]);
2237
+    // printf("data[%d]:%x\r\n",MBIC_PAYLOADSTART + i-1,data[MBIC_PAYLOADSTART + i-1]);
2225 2238
 //    printf("bluecell_Currdatastatus.ATT_DL1_PATH : %d\r\n",bluecell_Currdatastatus.ATT_DL1_PATH);
2226 2239
      /*DLI_RF_Path2_ON_OFF*/
2227 2240
     data[MBIC_PAYLOADSTART + i++] = MBIC_AID;
@@ -2247,32 +2260,45 @@ uint32_t MBIC_DataSend(uint8_t* data){
2247 2260
     data[MBIC_PAYLOADSTART + i++] = DLI_Gain_Atten1;
2248 2261
     data[MBIC_PAYLOADSTART + i++] = 2; // LENGTH
2249 2262
     Length += 2  ;
2250
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ATT_DL1_H;
2251
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ATT_DL1_L;
2263
+    tmpdata = bluecell_Currdatastatus.ATT_DL1_H << 8 | bluecell_Currdatastatus.ATT_DL1_L;
2264
+//    tmpdata *= 10;
2265
+//    printf("tmpdata : %x \r\n",tmpdata);
2266
+    data[MBIC_PAYLOADSTART + i++] = ((tmpdata & 0xFF00) >> 8);
2267
+    data[MBIC_PAYLOADSTART + i++] = (tmpdata & 0x00FF); 
2268
+
2252 2269
 
2253 2270
     /*DLI_Gain_Atten2*/
2254 2271
     data[MBIC_PAYLOADSTART + i++] = MBIC_AID;
2255 2272
     data[MBIC_PAYLOADSTART + i++] = DLI_Gain_Atten2;
2256 2273
     data[MBIC_PAYLOADSTART + i++] = 2; // LENGTH
2257 2274
     Length += 2        ;  
2258
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ATT_DL2_H;
2259
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ATT_DL2_L;
2275
+    tmpdata = bluecell_Currdatastatus.ATT_DL2_H << 8 | bluecell_Currdatastatus.ATT_DL2_L;
2276
+//    tmpdata *= 10;
2277
+    data[MBIC_PAYLOADSTART + i++] = ((tmpdata & 0xFF00) >> 8);
2278
+    data[MBIC_PAYLOADSTART + i++] = (tmpdata & 0x00FF); 
2279
+
2260 2280
 
2261 2281
     /*DLI_Gain_Atten3*/
2262 2282
     data[MBIC_PAYLOADSTART + i++] = MBIC_AID;
2263 2283
     data[MBIC_PAYLOADSTART + i++] = DLI_Gain_Atten3;
2264 2284
     data[MBIC_PAYLOADSTART + i++] = 2; // LENGTH
2265 2285
     Length += 2          ;
2266
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ATT_DL3_H;
2267
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ATT_DL3_L;
2286
+    tmpdata = bluecell_Currdatastatus.ATT_DL3_H << 8 | bluecell_Currdatastatus.ATT_DL3_L;
2287
+//    tmpdata *= 10;
2288
+    data[MBIC_PAYLOADSTART + i++] = ((tmpdata & 0xFF00) >> 8);
2289
+    data[MBIC_PAYLOADSTART + i++] = (tmpdata & 0x00FF); 
2290
+
2268 2291
 
2269 2292
     /*DLI_Gain_Atten4*/
2270 2293
     data[MBIC_PAYLOADSTART + i++] = MBIC_AID;
2271 2294
     data[MBIC_PAYLOADSTART + i++] = DLI_Gain_Atten4;
2272 2295
     data[MBIC_PAYLOADSTART + i++] = 2; // LENGTH
2273 2296
     Length += 2        ;  
2274
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ATT_DL4_H;
2275
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ATT_DL4_L;
2297
+    tmpdata = bluecell_Currdatastatus.ATT_DL4_H << 8 | bluecell_Currdatastatus.ATT_DL4_L;
2298
+//    tmpdata *= 10;
2299
+    data[MBIC_PAYLOADSTART + i++] = ((tmpdata & 0xFF00) >> 8);
2300
+    data[MBIC_PAYLOADSTART + i++] = (tmpdata & 0x00FF); 
2301
+
2276 2302
 
2277 2303
 
2278 2304
      /*DLI_Gain_Atten_Offset1*/
@@ -2280,29 +2306,41 @@ uint32_t MBIC_DataSend(uint8_t* data){
2280 2306
     data[MBIC_PAYLOADSTART + i++] = DLI_Gain_Atten_Offset1;
2281 2307
     data[MBIC_PAYLOADSTART + i++] = 2; // LENGTH
2282 2308
     Length += 2;
2283
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.bluecell_User_DL1_H;
2284
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.bluecell_User_DL1_L;
2309
+    tmpdata = bluecell_Currdatastatus.bluecell_User_DL1_H << 8 | bluecell_Currdatastatus.bluecell_User_DL1_L;
2310
+//    tmpdata *= 10;    
2311
+    data[MBIC_PAYLOADSTART + i++] = ((tmpdata & 0xFF00) >> 8);
2312
+    data[MBIC_PAYLOADSTART + i++] = (tmpdata & 0x00FF); 
2313
+
2285 2314
      /*DLI_Gain_Atten_Offset2*/
2286 2315
     data[MBIC_PAYLOADSTART + i++] = MBIC_AID;
2287 2316
     data[MBIC_PAYLOADSTART + i++] = DLI_Gain_Atten_Offset2;
2288 2317
     data[MBIC_PAYLOADSTART + i++] = 2; // LENGTH
2289 2318
     Length += 2        ;
2290
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.bluecell_User_DL2_H;
2291
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.bluecell_User_DL2_L;
2319
+    tmpdata = bluecell_Currdatastatus.bluecell_User_DL2_H << 8 | bluecell_Currdatastatus.bluecell_User_DL2_L;
2320
+//    tmpdata *= 10;   
2321
+    data[MBIC_PAYLOADSTART + i++] = ((tmpdata & 0xFF00) >> 8);
2322
+    data[MBIC_PAYLOADSTART + i++] = (tmpdata & 0x00FF); 
2323
+
2292 2324
      /*DLI_Gain_Atten_Offset3*/
2293 2325
     data[MBIC_PAYLOADSTART + i++] = MBIC_AID;
2294 2326
     data[MBIC_PAYLOADSTART + i++] = DLI_Gain_Atten_Offset3;
2295 2327
     data[MBIC_PAYLOADSTART + i++] = 2; // LENGTH
2296 2328
     Length += 2        ;
2297
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.bluecell_User_DL3_H;
2298
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.bluecell_User_DL3_L;
2329
+    tmpdata = bluecell_Currdatastatus.bluecell_User_DL3_H << 8 | bluecell_Currdatastatus.bluecell_User_DL3_L;
2330
+//    tmpdata *= 10;   
2331
+    data[MBIC_PAYLOADSTART + i++] = ((tmpdata & 0xFF00) >> 8);
2332
+    data[MBIC_PAYLOADSTART + i++] = (tmpdata & 0x00FF); 
2333
+
2299 2334
      /*DLI_Gain_Atten_Offset4*/
2300 2335
     data[MBIC_PAYLOADSTART + i++] = MBIC_AID;
2301 2336
     data[MBIC_PAYLOADSTART + i++] = DLI_Gain_Atten_Offset4;
2302 2337
     data[MBIC_PAYLOADSTART + i++] = 2; // LENGTH
2303 2338
     Length += 2        ;
2304
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.bluecell_User_DL4_H;
2305
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.bluecell_User_DL4_L;
2339
+    tmpdata = bluecell_Currdatastatus.bluecell_User_DL4_H << 8 | bluecell_Currdatastatus.bluecell_User_DL4_L;
2340
+//    tmpdata *= 10;   
2341
+    data[MBIC_PAYLOADSTART + i++] = ((tmpdata & 0xFF00) >> 8);
2342
+    data[MBIC_PAYLOADSTART + i++] = (tmpdata & 0x00FF); 
2343
+
2306 2344
 
2307 2345
 
2308 2346
      /*DLI_Level_High_Threshold*/
@@ -2328,14 +2366,26 @@ uint32_t MBIC_DataSend(uint8_t* data){
2328 2366
     data[MBIC_PAYLOADSTART + i++] = DLI_Level;
2329 2367
     data[MBIC_PAYLOADSTART + i++] = 8; // LENGTH
2330 2368
     Length += 8     ;
2331
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.DLI_Level1_H;
2332
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.DLI_Level1_L;
2333
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.DLI_Level2_H;
2334
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.DLI_Level2_L;
2335
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.DLI_Level3_H;
2336
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.DLI_Level3_L;
2337
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.DLI_Level4_H;
2338
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.DLI_Level4_L;
2369
+    tmpdata = bluecell_Currdatastatus.DLI_Level1_H << 8 | bluecell_Currdatastatus.DLI_Level1_L;
2370
+    tmpdata *= 10;
2371
+    data[MBIC_PAYLOADSTART + i++] = ((tmpdata & 0xFF00) >> 8);
2372
+    data[MBIC_PAYLOADSTART + i++] = (tmpdata & 0x00FF); 
2373
+
2374
+    tmpdata = bluecell_Currdatastatus.DLI_Level2_H << 8 | bluecell_Currdatastatus.DLI_Level2_L;
2375
+    tmpdata *= 10;    
2376
+    data[MBIC_PAYLOADSTART + i++] = ((tmpdata & 0xFF00) >> 8);
2377
+    data[MBIC_PAYLOADSTART + i++] = (tmpdata & 0x00FF); 
2378
+
2379
+    tmpdata = bluecell_Currdatastatus.DLI_Level3_H << 8 | bluecell_Currdatastatus.DLI_Level3_L;
2380
+    tmpdata *= 10;
2381
+    data[MBIC_PAYLOADSTART + i++] = ((tmpdata & 0xFF00) >> 8);
2382
+    data[MBIC_PAYLOADSTART + i++] = (tmpdata & 0x00FF); 
2383
+
2384
+    tmpdata = bluecell_Currdatastatus.DLI_Level4_H << 8 | bluecell_Currdatastatus.DLI_Level4_L;
2385
+    tmpdata *= 10;
2386
+    data[MBIC_PAYLOADSTART + i++] = ((tmpdata & 0xFF00) >> 8);
2387
+    data[MBIC_PAYLOADSTART + i++] = (tmpdata & 0x00FF); 
2388
+
2339 2389
 
2340 2390
     
2341 2391
      /*DLI_FRBT_Atten*/
@@ -2482,32 +2532,44 @@ uint32_t MBIC_DataSend(uint8_t* data){
2482 2532
     data[MBIC_PAYLOADSTART + i++] = ULO_Gain_Atten_Offset1;
2483 2533
     data[MBIC_PAYLOADSTART + i++] = 2; // LENGTH
2484 2534
     Length += 2      ;      
2485
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.bluecell_User_UL1_H;
2486
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.bluecell_User_UL1_L;
2535
+
2536
+    tmpdata = bluecell_Currdatastatus.bluecell_User_UL1_H << 8 | bluecell_Currdatastatus.bluecell_User_UL1_L;
2537
+//    tmpdata *= 10;   
2538
+    data[MBIC_PAYLOADSTART + i++] = ((tmpdata & 0xFF00) >> 8);
2539
+    data[MBIC_PAYLOADSTART + i++] = (tmpdata & 0x00FF); 
2487 2540
 
2488 2541
      /*ULO_Gain_Atten_Offset2*/
2489 2542
     data[MBIC_PAYLOADSTART + i++] = MBIC_AID;
2490 2543
     data[MBIC_PAYLOADSTART + i++] = ULO_Gain_Atten_Offset2;
2491 2544
     data[MBIC_PAYLOADSTART + i++] = 2; // LENGTH
2492 2545
     Length += 2     ;         
2493
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.bluecell_User_UL2_H;
2494
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.bluecell_User_UL2_L;
2546
+    tmpdata = bluecell_Currdatastatus.bluecell_User_UL2_H << 8 | bluecell_Currdatastatus.bluecell_User_UL2_L;
2547
+//    tmpdata *= 10;   
2548
+    data[MBIC_PAYLOADSTART + i++] = ((tmpdata & 0xFF00) >> 8);
2549
+    data[MBIC_PAYLOADSTART + i++] = (tmpdata & 0x00FF); 
2550
+
2495 2551
 
2496 2552
      /*ULO_Gain_Atten_Offset3*/
2497 2553
     data[MBIC_PAYLOADSTART + i++] = MBIC_AID;
2498 2554
     data[MBIC_PAYLOADSTART + i++] = ULO_Gain_Atten_Offset3;
2499 2555
     data[MBIC_PAYLOADSTART + i++] = 2; // LENGTH
2500 2556
     Length += 2        ;      
2501
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.bluecell_User_UL3_H;
2502
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.bluecell_User_UL3_L;
2557
+    tmpdata = bluecell_Currdatastatus.bluecell_User_UL3_H << 8 | bluecell_Currdatastatus.bluecell_User_UL3_L;
2558
+//    tmpdata *= 10;
2559
+    data[MBIC_PAYLOADSTART + i++] = ((tmpdata & 0xFF00) >> 8);
2560
+    data[MBIC_PAYLOADSTART + i++] = (tmpdata & 0x00FF); 
2561
+
2503 2562
 
2504 2563
      /*ULO_Gain_Atten_Offset4*/
2505 2564
     data[MBIC_PAYLOADSTART + i++] = MBIC_AID;
2506 2565
     data[MBIC_PAYLOADSTART + i++] = ULO_Gain_Atten_Offset4;
2507 2566
     data[MBIC_PAYLOADSTART + i++] = 2; // LENGTH
2508 2567
     Length += 2    ;          
2509
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.bluecell_User_UL4_H;
2510
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.bluecell_User_UL4_L;
2568
+    tmpdata = bluecell_Currdatastatus.bluecell_User_UL4_H << 8 | bluecell_Currdatastatus.bluecell_User_UL4_L;
2569
+//    tmpdata *= 10;
2570
+    data[MBIC_PAYLOADSTART + i++] = ((tmpdata & 0xFF00) >> 8);
2571
+    data[MBIC_PAYLOADSTART + i++] = (tmpdata & 0x00FF); 
2572
+
2511 2573
 
2512 2574
 
2513 2575
 
@@ -2529,14 +2591,25 @@ uint32_t MBIC_DataSend(uint8_t* data){
2529 2591
     data[MBIC_PAYLOADSTART + i++] = ULO_Level;
2530 2592
     data[MBIC_PAYLOADSTART + i++] = 8; // LENGTH
2531 2593
     Length += 8           ;
2532
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ULO_Level1_H;
2533
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ULO_Level1_L;        
2534
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ULO_Level2_H;
2535
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ULO_Level2_L;
2536
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ULO_Level3_H;
2537
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ULO_Level3_L;
2538
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ULO_Level4_H;
2539
-    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ULO_Level4_L;
2594
+    tmpdata = bluecell_Currdatastatus.ULO_Level1_H << 8 | bluecell_Currdatastatus.ULO_Level1_L;
2595
+    tmpdata *= 10;
2596
+    data[MBIC_PAYLOADSTART + i++] = ((tmpdata & 0xFF00) >> 8);
2597
+    data[MBIC_PAYLOADSTART + i++] = (tmpdata & 0x00FF); 
2598
+    tmpdata = bluecell_Currdatastatus.ULO_Level2_H << 8 | bluecell_Currdatastatus.ULO_Level2_L;
2599
+    tmpdata *= 20;
2600
+    data[MBIC_PAYLOADSTART + i++] = ((tmpdata & 0xFF00) >> 8);
2601
+    data[MBIC_PAYLOADSTART + i++] = (tmpdata & 0x00FF); 
2602
+
2603
+    tmpdata = bluecell_Currdatastatus.ULO_Level3_H << 8 | bluecell_Currdatastatus.ULO_Level3_L;
2604
+    tmpdata *= 10;
2605
+    data[MBIC_PAYLOADSTART + i++] = ((tmpdata & 0xFF00) >> 8);
2606
+    data[MBIC_PAYLOADSTART + i++] = (tmpdata & 0x00FF); 
2607
+
2608
+    tmpdata = bluecell_Currdatastatus.ULO_Level4_H << 8 | bluecell_Currdatastatus.ULO_Level4_L;
2609
+    tmpdata *= 10;
2610
+    data[MBIC_PAYLOADSTART + i++] = ((tmpdata & 0xFF00) >> 8);
2611
+    data[MBIC_PAYLOADSTART + i++] = (tmpdata & 0x00FF); 
2612
+
2540 2613
 
2541 2614
 
2542 2615
 
@@ -2606,6 +2679,7 @@ bool MBIC_Operate(uint8_t* data){
2606 2679
     uint16_t i = 0;
2607 2680
     double temp = 0;
2608 2681
     int16_t Level = 0;
2682
+    int16_t tmpdata = 0;
2609 2683
     uint16_t Length = data[MBIC_LENGTH_0] << 8 | data[MBIC_LENGTH_1];
2610 2684
     uint8_t* Tempdata;
2611 2685
     uint16_t occurlen = Length;
@@ -2788,6 +2862,8 @@ bool MBIC_Operate(uint8_t* data){
2788 2862
             case  DLI_Gain_Atten_Offset1                  :
2789 2863
                 bluecell_Currdatastatus.bluecell_User_DL1_H = data[MBIC_PAYLOADSTART + 3]; 
2790 2864
                 bluecell_Currdatastatus.bluecell_User_DL1_L = data[MBIC_PAYLOADSTART + 4]; 
2865
+//                printf("bluecell_Currdatastatus.bluecell_User_DL1_H : %x\r\n",bluecell_Currdatastatus.bluecell_User_DL1_H);
2866
+//                printf("bluecell_Currdatastatus.bluecell_User_DL1_L : %x\r\n",bluecell_Currdatastatus.bluecell_User_DL1_L); 
2791 2867
                 CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
2792 2868
 
2793 2869
                 break;
@@ -3000,8 +3076,8 @@ bool MBIC_Operate(uint8_t* data){
3000 3076
         }
3001 3077
          data[MBIC_CMD_0] = 0x81;//MBIC_ERRRESPONSE;
3002 3078
         Length = MBIC_DataSend(data);
3003
-//              Bluecell_StructCpy(&DataWrite[0],&bluecell_Currdatastatus.bluecell_header,sizeof(BLUESTATUS_st));
3004
-//              EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_WINDOW_STATUS_ADDRESDS),&DataWrite[0],sizeof(BLUESTATUS_st));
3079
+        Bluecell_StructCpy(&DataWrite[0],&bluecell_Currdatastatus.bluecell_header,sizeof(BLUESTATUS_st));
3080
+        EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_WINDOW_STATUS_ADDRESDS),&DataWrite[0],sizeof(BLUESTATUS_st));
3005 3081
     }
3006 3082
     else if(cmd == MBIC_Table_Get){
3007 3083
         /*Table Get */
@@ -3296,7 +3372,7 @@ void ADC_Check(void){
3296 3372
                 DascendigFunc(&ADC3valuearray[i][0],ADC_AVERAGECNT);
3297 3373
                 MIN_ADC[i] = ADC3valuearray[i][0] - 12;
3298 3374
                 for(int a = 0; a < ADC_AVERAGECNT; a++){
3299
-    //                 printf("ADC3valuearray[%d][%d] : %d \r\n",i,a,ADC3valuearray[i][a]);
3375
+//                     printf("ADC3valuearray[%d][%d] : %d \r\n",i,a,ADC3valuearray[i][a]);
3300 3376
                     if(ADC3valuearray[i][a] < MIN_ADC[i]){
3301 3377
                         cnt[i] = a;
3302 3378
     //                    printf("cnt[i] %d \r\n",cnt[i]);
@@ -3427,7 +3503,7 @@ void ADC_Check(void){
3427 3503
 
3428 3504
 
3429 3505
 //        ret = ((ADC1Ret[0]) * Volt_Calc_val);
3430
-//        printf("UL1 : %f\r\n",ret);
3506
+      //  printf("UL1 : %f\r\n",ret);
3431 3507
 
3432 3508
 //        ret = ((ADC1Ret[1]) * Volt_Calc_val);
3433 3509
 //        printf("UL2 : %f\r\n",ret);
@@ -3480,7 +3556,7 @@ double Bluecell_round( double value )
3480 3556
     }
3481 3557
 //     printf("4: %d\r\n",data);
3482 3558
      ret = data;
3483
-        printf("ret : %f\r\n",ret / 1000);
3559
+       // printf("ret : %f\r\n",ret / 1000);
3484 3560
 
3485 3561
      return ret / 1000;
3486 3562
 }
@@ -4014,6 +4090,9 @@ void ALC_Function(){ //DL
4014 4090
             ResdBm = AutoControl_ADC_Compare(ret,&Det_UL1.Table_Det_15_dBm_H,sizeof(DET_TABLEUL_st));
4015 4091
             bluecell_Currdatastatus.ULO_Level1_H = ((int16_t)ResdBm & 0xFF00) >> 8;
4016 4092
             bluecell_Currdatastatus.ULO_Level1_L = ((int16_t)ResdBm & 0x00FF);
4093
+//            printf("==================START================\r\n");
4094
+//            printf("Current UL ADC VALUE : %f \r\n",ret);
4095
+//            printf("ResdBm : UL1 : %f \r\n",ResdBm);
4017 4096
 
4018 4097
 
4019 4098
             ret  = bluecell_Currdatastatus.ULO_P2_Level2_H << 8;
@@ -4262,6 +4341,10 @@ void AGC_Function(){//DL
4262 4341
             bluecell_Currdatastatus.DLI_Level1_H = (Levelret & 0xFF00) >> 8;
4263 4342
             bluecell_Currdatastatus.DLI_Level1_L = (Levelret & 0x00FF);
4264 4343
 
4344
+//            printf("==================================\r\n");
4345
+//            printf("Current DL1 ADC VALUE : %f \r\n",ret);
4346
+//              printf("ResdBm : DL1 : %d \r\n",ResdBm);
4347
+//            HAL_Delay(1000);
4265 4348
 
4266 4349
             
4267 4350
             ret  = bluecell_Currdatastatus.DLI_P2_Level2_H << 8;

+ 1 - 1
Src/main.c

@@ -162,7 +162,7 @@ uint16_t adc3cnt = 0 ;
162 162
 void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
163 163
 {
164 164
 //?��?��?�� 코드 ?��?��
165
-//諤嵸烄 ?嚙踝蕭?嚙踝蕭 adc?嚙踝蕭嚙???????????? 嚙?????????????嚙踝蕭?嚙踝蕭 ?嚙踝蕭 ?嚙踝蕭?嚙踝蕭嚙???????????? ?嚙踝蕭?嚙踝蕭嚙???????????? ?嚙踝蕭?嚙踝蕭?? 穈軤𦚯 魽國探嚙???????????? ?嚙踝蕭?嚙踝蕭
165
+//만약 ?��?�� adc?���???????????? �?????????????��?�� ?�� ?��?���???????????? ?��?���???????????? ?��?��?? 같이 조건�???????????? ?��?��
166 166
 
167 167
     if(hadc->Instance == hadc1.Instance)
168 168
     {