|
@@ -39,6 +39,8 @@ namespace RF_TRIO_PLL_ZIG
|
39
|
39
|
TYPE_BLUECELL_RESET = 0,
|
40
|
40
|
TYPE_BLUECELL_SET = 1,
|
41
|
41
|
TYPE_BLUECELL_GET = 2,
|
|
42
|
+ TYPE_BLUECELL_SAVE = 3,
|
|
43
|
+ TYPE_BLUECELL_ACK = 4,
|
42
|
44
|
};
|
43
|
45
|
enum Bluecell_TypeIndex_t
|
44
|
46
|
{
|
|
@@ -449,18 +451,16 @@ namespace RF_TRIO_PLL_ZIG
|
449
|
451
|
temp_buf[(int)Bluecell_TypeIndex_t._T_SYNC_UL] = main_Form.Tdd_T_Sync;//Convert.ToByte(PLL_ON_OFF_3_5G_L_Get_Func());
|
450
|
452
|
|
451
|
453
|
|
452
|
|
-
|
|
454
|
+ /***********************DAC A Sector**********************************/
|
453
|
455
|
double double_temp = Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_A.Text) * 4095;
|
454
|
456
|
UInt16 temp = Convert.ToUInt16(double_temp / 4);
|
455
|
457
|
temp = Convert.ToUInt16(temp & 0x0FFF);
|
456
|
458
|
|
457
|
|
-
|
458
|
459
|
temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_A_H]
|
459
|
460
|
= Convert.ToByte(0x00 + Convert.ToByte((temp & 0xFF00) >> 8));
|
460
|
|
-
|
461
|
|
- temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_A_L]
|
462
|
|
- = Convert.ToByte(Convert.ToUInt16((Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_A.Text) * 4095) / 4) & 0x00FF);
|
463
|
|
-
|
|
461
|
+ temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_A_L]
|
|
462
|
+ = Convert.ToByte(Convert.ToUInt16(temp) & 0x00FF);
|
|
463
|
+ /***********************DAC B Sector**********************************/
|
464
|
464
|
double_temp = Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_B.Text) * 4095;
|
465
|
465
|
temp = Convert.ToUInt16(double_temp / 4);
|
466
|
466
|
temp = Convert.ToUInt16(temp & 0x0FFF);
|
|
@@ -468,8 +468,8 @@ namespace RF_TRIO_PLL_ZIG
|
468
|
468
|
temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_B_H]
|
469
|
469
|
= Convert.ToByte(0x10 + Convert.ToByte((temp & 0xFF00) >> 8));
|
470
|
470
|
temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_B_L]
|
471
|
|
- = Convert.ToByte(Convert.ToUInt16((Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_B.Text) * 4095) / 4) & 0x00FF);
|
472
|
|
-
|
|
471
|
+ = Convert.ToByte(Convert.ToUInt16(temp) & 0x00FF);
|
|
472
|
+ /***********************DAC C Sector**********************************/
|
473
|
473
|
double_temp = Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_C.Text) * 4095;
|
474
|
474
|
temp = Convert.ToUInt16(double_temp / 4);
|
475
|
475
|
temp = Convert.ToUInt16(temp & 0x0FFF);
|
|
@@ -477,9 +477,9 @@ namespace RF_TRIO_PLL_ZIG
|
477
|
477
|
temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_C_H]
|
478
|
478
|
= Convert.ToByte(0x20 + Convert.ToByte((temp & 0xFF00) >> 8));
|
479
|
479
|
temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_C_L]
|
480
|
|
- = Convert.ToByte(Convert.ToUInt16((Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_C.Text) * 4095) / 4) & 0x00FF);
|
481
|
|
-
|
|
480
|
+ = Convert.ToByte(Convert.ToUInt16(temp) & 0x00FF);
|
482
|
481
|
|
|
482
|
+ /***********************DAC D Sector**********************************/
|
483
|
483
|
double_temp = Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_D.Text) * 4095;
|
484
|
484
|
temp = Convert.ToUInt16(double_temp / 4);
|
485
|
485
|
temp = Convert.ToUInt16(temp & 0x0FFF);
|
|
@@ -488,8 +488,8 @@ namespace RF_TRIO_PLL_ZIG
|
488
|
488
|
temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_D_H]
|
489
|
489
|
= Convert.ToByte(0x30 + Convert.ToByte((temp & 0xFF00) >> 8));
|
490
|
490
|
temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_D_L]
|
491
|
|
- = Convert.ToByte(Convert.ToUInt16((Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_D.Text) * 4095) / 4) & 0x00FF); ;
|
492
|
|
-
|
|
491
|
+ = Convert.ToByte(Convert.ToUInt16(temp) & 0x00FF);
|
|
492
|
+ /***********************DAC E Sector**********************************/
|
493
|
493
|
double_temp = Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_E.Text) * 4095;
|
494
|
494
|
temp = Convert.ToUInt16(double_temp / 4);
|
495
|
495
|
temp = Convert.ToUInt16(temp & 0x0FFF);
|
|
@@ -497,19 +497,19 @@ namespace RF_TRIO_PLL_ZIG
|
497
|
497
|
temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_E_H]
|
498
|
498
|
= Convert.ToByte(0x40 + Convert.ToByte((temp & 0xFF00) >> 8));
|
499
|
499
|
temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_E_L]
|
500
|
|
- = Convert.ToByte(Convert.ToUInt16((Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_E.Text) * 4095) / 4) & 0x00FF);
|
501
|
|
-
|
|
500
|
+ = Convert.ToByte(Convert.ToUInt16(temp) & 0x00FF);
|
502
|
501
|
|
|
502
|
+ /***********************DAC F Sector**********************************/
|
503
|
503
|
double_temp = Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_F.Text) * 4095;
|
504
|
504
|
temp = Convert.ToUInt16(double_temp / 4);
|
505
|
505
|
temp = Convert.ToUInt16(temp & 0x0FFF);
|
506
|
506
|
temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_F_H]
|
507
|
507
|
= Convert.ToByte(0x50 + Convert.ToByte((temp & 0xFF00) >> 8));
|
508
|
508
|
temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_F_L]
|
509
|
|
- = Convert.ToByte(Convert.ToUInt16((Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_F.Text) * 4095) / 4) & 0x00FF);
|
510
|
|
-
|
|
509
|
+ = Convert.ToByte(Convert.ToUInt16(temp) & 0x00FF);
|
511
|
510
|
|
512
|
511
|
|
|
512
|
+ /***********************DAC G Sector**********************************/
|
513
|
513
|
double_temp = Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_G.Text) * 4095;
|
514
|
514
|
temp = Convert.ToUInt16(double_temp / 4);
|
515
|
515
|
temp = Convert.ToUInt16(temp & 0x0FFF);
|
|
@@ -517,18 +517,18 @@ namespace RF_TRIO_PLL_ZIG
|
517
|
517
|
|
518
|
518
|
temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_G_H]
|
519
|
519
|
= Convert.ToByte(0x60 + Convert.ToByte((temp & 0xFF00) >> 8));
|
520
|
|
- temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_G_L]
|
521
|
|
- = Convert.ToByte(Convert.ToUInt16((Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_G.Text) * 4095) / 4) & 0x00FF);
|
522
|
|
-
|
|
520
|
+ temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_G_L]
|
|
521
|
+ = Convert.ToByte(Convert.ToUInt16(temp) & 0x00FF);
|
523
|
522
|
|
|
523
|
+ /***********************DAC H Sector**********************************/
|
524
|
524
|
double_temp = Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_H.Text) * 4095;
|
525
|
525
|
temp = Convert.ToUInt16(double_temp / 4);
|
526
|
526
|
temp = Convert.ToUInt16(temp & 0x0FFF);
|
527
|
527
|
|
528
|
528
|
temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_H_H]
|
529
|
529
|
= Convert.ToByte(0x70 + Convert.ToByte((temp & 0xFF00) >> 8));
|
530
|
|
- temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_H_L]
|
531
|
|
- = Convert.ToByte(Convert.ToUInt16((Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_H.Text) * 4095) / 4) & 0x00FF);
|
|
530
|
+ temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_H_L]
|
|
531
|
+ = Convert.ToByte(Convert.ToUInt16(temp) & 0x00FF);
|
532
|
532
|
|
533
|
533
|
|
534
|
534
|
/* * * * * * FIX DATA * * * * * */
|
|
@@ -545,8 +545,19 @@ namespace RF_TRIO_PLL_ZIG
|
545
|
545
|
{
|
546
|
546
|
this.main_Form = (Main_Form)main_form;
|
547
|
547
|
this.serial = (Serial)serial;
|
548
|
|
- // main_Form.Invoke(new ByteSend(this.main_Form.ReSetting_Values),(temp_buf));
|
549
|
|
- this.main_Form.ADC_Voltage_Value_Set(temp_buf);
|
|
548
|
+ byte type = temp_buf[(byte)Bluecell_TypeIndex_t.BLUE_TYPE];
|
|
549
|
+ // main_Form.Invoke(new ByteSend(this.main_Form.ReSetting_Values),(temp_buf));
|
|
550
|
+ switch (type)
|
|
551
|
+ {
|
|
552
|
+ case (byte)Bluecell_Prot_t.TYPE_BLUECELL_GET:
|
|
553
|
+ this.main_Form.ADC_Voltage_Value_Set(temp_buf);
|
|
554
|
+ break;
|
|
555
|
+ case (byte)Bluecell_Prot_t.TYPE_BLUECELL_ACK:
|
|
556
|
+ this.main_Form.Message_Box_Open();
|
|
557
|
+ break;
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+ }
|
550
|
561
|
//Debug.Invoke(new StringSend(Debug.Data_Recv_Str), data);
|
551
|
562
|
//main_Form.label1_8GHz_DL_OUT.Text = Convert.ToString(temp_val);
|
552
|
563
|
|