Lcd_func.~c
上传用户:xmyjxjd
上传日期:2013-05-04
资源大小:1517k
文件大小:65k
- #define __FUNC__
- #include "reg52.h"
- #include "intrins.h"
- #include "HeaderMAIN_DEF.H"
- #include "HeaderCONFIG.H"
- #include "HeaderACCESS.H"
- #include "HeaderOSD.H"
- #include "HeaderLCD_COEF.H"
- #include "HeaderLCD_MAIN.H"
- #include "HeaderLCD_AUTO.H"
- #include "HeaderLCD_FUNC.H"
- #include "HeaderFRAME_SYNC.H"
- #include "HeaderLCD_OSD.H"
- #if (TV_CHIP != TV_NONE)
- #include "TUNER.H"
- #endif
- void SetVolume()
- {
- stGUD3.VOLUME &= 0x1f;
- #if (AUDIO_TYPE == AUDIO_LM4832)
- Data[0] = 10;
- Data[1] = ADDR_LM4832;
- Data[2] = 0x00;
- Data[3] = 0x02;
- Data[4] = 0x00; // Input Volume - 0 dB
- Data[5] = 0x26; // Bass - 0 dB
- Data[6] = 0x46; // Treble - 0 dB
- Data[7] = 0x60 | stGUD3.VOLUME; // Right Volume
- Data[8] = 0x80 | stGUD3.VOLUME; // Left Volume
- // Mic 1 selected with 20dB when input source is VGA or DVI
- // Both Mic 1 and 2 selected with 20dB when input source is AV or S-Video
- Data[9] = (SOURCE_AV <= (stGUD1.INPUT_SOURCE & 0x07)) ? 0xa6 : 0xa4;
-
- I2CWrite(Data);
- #endif
- #if (AUDIO_TYPE == AUDIO_PWM2)
- Data[0] = 6;
- Data[1] = Y_INC;
- Data[2] = OSD_ROW_90;
- Data[3] = 0x80;
- Data[4] = 0x01;
- #if (INV_VOLUME)
- Data[5] = (0xff -(stGUD3.VOLUME << 3));
- #else
- Data[5] = (stGUD3.VOLUME << 3);
- #endif
- Data[6] = 0;
- RTDWrite(Data);
- #endif
- #if (AUDIO_TYPE == AUDIO_PWM0)
- Data[0] = 6;
- Data[1] = Y_INC;
- Data[2] = OSD_ROW_90;
- Data[3] = 0x00;
- Data[4] = 0x01;
- #if (INV_VOLUME)
- Data[5] = (0xff -(stGUD3.VOLUME << 3));
- #else
- Data[5] = (stGUD3.VOLUME << 3);
- #endif
- Data[6] = 0;
- RTDWrite(Data);
- #endif
- }
- void WriteGamma(unsigned char code *arrayR, unsigned char code *arrayG, unsigned char code *arrayB)
- {
- unsigned char n = 0;
- RTDSetBit(COLOR_CTRL_5D, 0xfb, 0x10); // Disable GAMMA & Enable Access Channel
-
- // GAMMA_RED
- bRTD_SCSB = 0;
- RTDSendAddr(RED_GAMMA_64, WRITE, N_INC);
- do
- {
- RTDSendByte(arrayR[n]);
- }
- while (++n); // if n is 0xff, then n will be 0x00 after increased.
- #if(MCU_TYPE == MCU_WINBOND)
- bRTD_SCLK = 0;
- bRTD_SCLK = 1;
- bRTD_SCSB = 1;
-
- // GAMMA_GREEN
- bRTD_SCSB = 0;
- #else
- MCU_WriteRtdSclk(LOW);
- MCU_WriteRtdSclk(HIGH);
- MCU_WriteRtdScsb(HIGH);
-
- // GAMMA_GREEN
- MCU_WriteRtdScsb(LOW);
- #endif
- RTDSendAddr(GRN_GAMMA_65, WRITE, N_INC);
- do
- {
- RTDSendByte(arrayG[n]);
- }
- while (++n);
- #if(MCU_TYPE == MCU_WINBOND)
- bRTD_SCLK = 0;
- bRTD_SCLK = 1;
- bRTD_SCSB = 1;
-
- //GAMMA_BLUE
- bRTD_SCSB = 0;
- #else
- MCU_WriteRtdSclk(LOW);
- MCU_WriteRtdSclk(HIGH);
- MCU_WriteRtdScsb(HIGH);
-
- //GAMMA_BLUE
- MCU_WriteRtdScsb(LOW);
- #endif
- RTDSendAddr(BLU_GAMMA_66, WRITE, N_INC);
- do
- {
- RTDSendByte(arrayB[n]);
- }
- while (++n);
- #if(MCU_TYPE == MCU_WINBOND)
- bRTD_SCLK = 0;
- bRTD_SCLK = 1;
- bRTD_SCSB = 1;
- #else
- MCU_WriteRtdSclk(_LOW);
- MCU_WriteRtdSclk(_HIGH);
- MCU_WriteRtdScsb(_HIGH);
- #endif
-
- RTDSetBit(COLOR_CTRL_5D, 0xef, 0x04); // Enable GAMMA & Diable Access Channel
- }
- void WriteDither(unsigned char code *array , bit new_dither)
- {
- unsigned char n;
- if(new_dither)
- RTDSetBit(FX_LST_LEN_H_5A,0xff,0x80);
- else
- RTDSetBit(FX_LST_LEN_H_5A,0x7f,0x00);
- RTDSetBit(COLOR_CTRL_5D, 0xb7, 0x68); // Enable DITHER & Enable Access Channels
- #if(MCU_TYPE == MCU_WINBOND)
- bRTD_SCSB = 0;
- RTDSendAddr(DITHER_PORT_67, WRITE, N_INC);
- for (n = 0; n < 8; n++) RTDSendByte(array[n]);
- bRTD_SCLK = 0;
- bRTD_SCLK = 1;
- bRTD_SCSB = 1;
- #else
- MCU_WriteRtdScsb(_LOW);
- RTDSendAddr(DITHER_PORT_67, WRITE, N_INC);
- for (n = 0; n < 8; n++) RTDSendByte(array[n]);
- MCU_WriteRtdSclk(_LOW);
- MCU_WriteRtdSclk(_HIGH);
- MCU_WriteRtdScsb(_HIGH);
- #endif
-
- //RTDSetBit(COLOR_CTRL_5D, 0xdf, 0x48); // Enable DITHER & Disable Access Channels
- RTDSetBit(COLOR_CTRL_5D, 0x1f, 0x88); // Enable DITHER & Disable Access Channels
- }
- void WriteSU_COEF(unsigned char code *arrayH, unsigned char code *arrayV)
- {
- unsigned char n;
-
- RTDSetBit(FILTER_CTRL1_1C, 0xfc, 0x01); // Enable H-Coeff access
- #if(MCU_TYPE == MCU_WINBOND)
- bRTD_SCSB = 0;
- RTDSendAddr(FILTER_PORT_1D, WRITE, N_INC);
- for (n = 0; n < 128; n++) RTDSendByte(arrayH[n]);
- bRTD_SCLK = 0;
- bRTD_SCLK = 1;
- bRTD_SCSB = 1;
- RTDSetBit(FILTER_CTRL1_1C, 0xfc, 0x03); // Enable V-Coeff access
-
- bRTD_SCSB = 0;
- RTDSendAddr(FILTER_PORT_1D, WRITE, N_INC);
- for (n = 0; n < 128; n++) RTDSendByte(arrayV[n]);
- bRTD_SCLK = 0;
- bRTD_SCLK = 1;
- bRTD_SCSB = 1;
- #else
- MCU_WriteRtdScsb(_LOW);
- RTDSendAddr(FILTER_PORT_1D, WRITE, N_INC);
- for (n = 0; n < 128; n++) RTDSendByte(arrayH[n]);
- MCU_WriteRtdSclk(_LOW);
- MCU_WriteRtdSclk(_HIGH);
- MCU_WriteRtdScsb(_HIGH);
- RTDSetBit(FILTER_CTRL1_1C, 0xfc, 0x03); // Enable V-Coeff access
-
- MCU_WriteRtdScsb(_LOW);
- RTDSendAddr(FILTER_PORT_1D, WRITE, N_INC);
- for (n = 0; n < 128; n++) RTDSendByte(arrayV[n]);
- MCU_WriteRtdSclk(_LOW);
- MCU_WriteRtdSclk(_HIGH);
- MCU_WriteRtdScsb(_HIGH);
- #endif
- RTDSetBit(FILTER_CTRL1_1C, 0xfc, 0xc4); // Disable filter coefficient access
- }
- void Set_H_Position(void)
- {
- #if(AS_NON_FRAMESYNC)
- RTDSetBit(ODD_CTRL_8E,0xef,0x00);
- #endif
- // if the backporch is far small then the standard one,
- // it is possibile that even IHS_Delay decrease to zero still can't correct the H position
- // so adjust the usIPH_ACT_STA first and turn back to original value later
- if(stMUD.H_POSITION < ucH_Min_Margin)
- {
- usIPH_ACT_STA = usIPH_ACT_STA - (ucH_Min_Margin - stMUD.H_POSITION);
- stMUD.H_POSITION = ucH_Min_Margin;
- }
- #if(ALIGN_LEFT == CLOCK_ALIGN)
- ((unsigned int*)Data)[4] = usIPH_ACT_STA + (stMUD.CLOCK >> 2) - 32;
- #else
- ((unsigned int*)Data)[4] = usIPH_ACT_STA + (stMUD.CLOCK >> 1) - 64;
- #endif
- Wait_For_Event(EVENT_IEN_STOP);
-
- Data[0] = 5;
- Data[1] = Y_INC;
- Data[2] = IPH_ACT_STA_06;
- Data[3] = (unsigned char)((unsigned int*)Data)[4];
- Data[4] = (unsigned char)(((unsigned int*)Data)[4] >> 8);
- Data[5] = 0;
- RTDWrite(Data);
- // Update IHS delay according to phase
- // Set_Phase(stMUD.PHASE & 0x7c);
- //Data[0] = PROGRAM_HDELAY + (stMUD.H_POSITION - ucH_Min_Margin);
- Data[12] = (stMUD.H_POSITION - ucH_Min_Margin) + PROGRAM_HDELAY;
-
- RTDSetByte(IHS_DELAY_8D, Data[12]);
-
- #if(AS_NON_FRAMESYNC)
- if(bFrameSync && bStable)
- RTDSetBit(ODD_CTRL_8E,0xef,0x10);
- #endif
- }
- #if(PANEL_TYPE == PANEL_HYUNDAI) //hgxxxx 0522 for Hyundai
- #define MAX_MOVE_LINE 2
- bit bSTEP_VPOS = 0;
- static unsigned char idata ucPre_V_POS = 0x80;
- void Set_V_Position4HD(void);
- void Set_V_Position(void)
- {
- unsigned char tempstore;
- tempstore = stMUD.V_POSITION;
- bSTEP_VPOS = 1;
- do
- {
- if(stMUD.V_POSITION > ucPre_V_POS)
- {
- if(stMUD.V_POSITION - ucPre_V_POS > MAX_MOVE_LINE)
- stMUD.V_POSITION = ucPre_V_POS + MAX_MOVE_LINE;
- }
- else
- {
- if(ucPre_V_POS - stMUD.V_POSITION > MAX_MOVE_LINE)
- stMUD.V_POSITION = ucPre_V_POS - MAX_MOVE_LINE;
- }
- Set_V_Position4HD();
- stMUD.V_POSITION = tempstore;
- }
- while(stMUD.V_POSITION != ucPre_V_POS);
- bSTEP_VPOS = 0;
- }
- void Set_V_Position4HD(void)
- #else
- void Set_V_Position(void)
- #endif
- {
- unsigned int usIV_Temp, usDV_Temp;
- #if(AS_NON_FRAMESYNC)
- RTDSetBit(ODD_CTRL_8E,0xef,0x00);
- #endif
- #if(AS_DV_TOTAL)
- RTDSetBit(DV_BKGD_STA_31,0x7f,0x00);
- #endif
- if ((ucV_Max_Margin - 1) < stMUD.V_POSITION)
- {
-
- RTDSetByte(IVS_DELAY_8C, (PROGRAM_VDELAY + stMUD.V_POSITION - (ucV_Max_Margin - 1)));
- usIV_Temp = usIPV_ACT_STA + (ucV_Max_Margin - 1) - 128;
- usDV_Temp = (unsigned int)ucDV_Delay + (ucV_Max_Margin - 1) - 128;
- }
- else
- {
- RTDSetByte(IVS_DELAY_8C, PROGRAM_VDELAY);
- usIV_Temp = usIPV_ACT_STA + stMUD.V_POSITION - 128;
- usDV_Temp = (unsigned int)ucDV_Delay + stMUD.V_POSITION - 128;
- }
- Wait_For_Event(EVENT_IEN_START);
- Data[0] = 4;
- Data[1] = N_INC;
- Data[2] = IV_DV_LINES_38;
- Data[3] = (unsigned char)usDV_Temp;
- Data[4] = 5;
- Data[5] = Y_INC;
- Data[6] = IPV_ACT_STA_0A;
- Data[7] = (unsigned char)usIV_Temp;
- Data[8] = (unsigned char)(usIV_Temp >> 8);
- Data[9] = 0;
- RTDWrite(Data);
- Wait_For_Event(EVENT_IEN_START);
- RTDSetByte(STATUS0_01, 0x00); // Clear status
- RTDSetByte(STATUS1_1F, 0x00); // Clear status
- #if(AS_NON_FRAMESYNC)
- if(bFrameSync && bStable)
- RTDSetBit(ODD_CTRL_8E,0xef,0x10);
- #endif
- #if(AS_DV_TOTAL)
- if(bFrameSync && bStable)
- {
- RTDSetByte(DV_TOTAL_STATUS_3D,0x00); //Write once to clear status
- RTDSetBit(DV_BKGD_STA_31,0x7f,0x80);
- }
- #endif
- #if(PANEL_TYPE == PANEL_HYUNDAI) //hgxxxx 0522 for Hyundai
- ucPre_V_POS = stMUD.V_POSITION;
- #endif
- }
- /*
- void Set_V_Position(void)
- {
- unsigned int usIV_Temp, usDV_Temp;
- #if(PANEL_TYPE == PANEL_HANDAI)
- unsigned int usDHT,usDHTc;
- unsigned char ucIVD0,ucIVD1;
- #endif
- #if(AS_NON_FRAMESYNC)
- RTDSetBit(ODD_CTRL_8E,0xef,0x00);
- #endif
- if (ucV_Max_Margin < stMUD.V_POSITION)
- {
- RTDSetByte(IVS_DELAY_8C, (PROGRAM_VDELAY + stMUD.V_POSITION - ucV_Max_Margin));
- usIV_Temp = usIPV_ACT_STA + ucV_Max_Margin - 128;
- usDV_Temp = (unsigned int)ucDV_Delay + ucV_Max_Margin - 128;
- }
- else
- {
- RTDSetByte(IVS_DELAY_8C, PROGRAM_VDELAY);
- usIV_Temp = usIPV_ACT_STA + stMUD.V_POSITION - 128;
- usDV_Temp = (unsigned int)ucDV_Delay + stMUD.V_POSITION - 128;
- }
- #if(PANEL_TYPE == PANEL_HANDAI)
- //DHT = xxxxxxxx_xxx00000 (0x22) + 00000000_00xxxxx0 (0x2e)
- RTDRead(0x22, 0x02, Y_INC);
- usDHT = 256 * (Data[1]&0x07) + Data[0] + 2;
- RTDRead(0x2E, 0x01, Y_INC);
- //to restore DV_tatal
- Data[15] = Data[0];
- usDHT = usDHT*32 + ((Data[0]>>2) & 0x3e);
- //compensated DH_Total
- RTDRead(IVS_DELAY_8C, 0x01, Y_INC);
- //original IVS delay
- ucIVD0 = Data[0];
- //The IVS delay you are going to set
- ucIVD1 = (ucV_Max_Margin < stMUD.V_POSITION) ? (0x80 | (PROGRAM_VDELAY + stMUD.V_POSITION - ucV_Max_Margin)) : (0x80 | PROGRAM_VDELAY);
- //original IVS_DVS_Delay
- RTDRead(IV_DV_LINES_38, 0x01, Y_INC);
- //usDV_Temp => IVS_DVS_delay you are going to set
- usDHTc = (unsigned long)usDHT * (usVsync + usDV_Temp - Data[0] + ucIVD1 - ucIVD0)/usVsync - 0x40;//-2
-
-
- //modify DH_Total
- Wait_For_Event(EVENT_IEN_STOP);
- Data[0] = 5;
- Data[1] = Y_INC;
- Data[2] = DH_TOTAL_22;
- Data[3] = (unsigned char)((usDHTc>>5) & 0x00fe);
- Data[4] = (unsigned char)((usDHTc>>13) & 0x0007);
- Data[5] = 4;
- Data[6] = Y_INC;
- Data[7] = 0x2e;
- Data[8] = (Data[15] & 0x07) | (((usDHTc+1)<<2) & 0x00f8);
- Data[9] = 0;
- RTDWrite(Data);
- #endif
- Wait_For_Event(EVENT_IEN_START);
- Data[0] = 4;
- Data[1] = N_INC;
- Data[2] = IV_DV_LINES_38;
- Data[3] = (unsigned char)usDV_Temp;
- Data[4] = 5;
- Data[5] = Y_INC;
- Data[6] = IPV_ACT_STA_0A;
- Data[7] = (unsigned char)usIV_Temp;
- Data[8] = (unsigned char)(usIV_Temp >> 8);
- Data[9] = 0;
- RTDWrite(Data);
- #if(PANEL_TYPE == PANEL_HANDAI)
- //restore DH_Total
- usDHT = usDHT - 0x40;
- Wait_For_Event(EVENT_DEN_STOP);
- Data[0] = 5;
- Data[1] = Y_INC;
- Data[2] = 0x22;
- Data[3] = (unsigned char)((usDHT>>5) & 0x00fe);
- Data[4] = (unsigned char)((usDHT>>13) & 0x0007);
- Data[5] = 4;
- Data[6] = Y_INC;
- Data[7] = 0x2e;
- Data[8] = (Data[15] & 0x07) | ((usDHT<<2) & 0x00f8);
- Data[9] = 0;
- RTDWrite(Data);
- #endif
- Wait_For_Event(EVENT_IEN_START);
- RTDSetByte(STATUS0_01, 0x00); // Clear status
- RTDSetByte(STATUS1_1F, 0x00); // Clear status
- #if(AS_NON_FRAMESYNC)
- if(bFrameSync && bStable)
- RTDSetBit(ODD_CTRL_8E,0xef,0x10);
- #endif
- }
- */
- void Set_Clock(void)
- {
- unsigned char ucM_Code, ucN_Code, ucTemp0, ucTemp1, ucResult;
- // Issac :
- // In this F/W, the frequency of PLL1 is fixed to 24.576*19/2=233.472MHz.
- // Our goal is to find the best M/N settings of PLL2 according to the relationship below
- // Best Fav = 233.472 * 32 / 31 = 241.003Mhz, and pixel rate = Fav * M / N
- // Too small or large N code will cause larger jitter of ADC clock.
- // In this F/W, I limite N code value between 16 and 31.
- unsigned int usClock = usADC_Clock + (unsigned int)stMUD.CLOCK - 128; // Pixel clock number
- unsigned long ulRate = (unsigned long)24576 * usClock / usStdHS; // Pixel clock in kHz
- #if(AS_PLL_NONLOCK)
- RTDSetBit(ODD_CTRL_8E,0xdf,0x00);
- #endif
- #if(AS_NON_FRAMESYNC)
- RTDSetBit(ODD_CTRL_8E,0xef,0x00);
- #endif
- #if (TUNE_APLL)
- RTDSetBit(DV_TOTAL_STATUS_3D, 0xdf, 0x00);//Disable PE Max Measurement
- RTDSetByte(DV_TOTAL_STATUS_3D,0x40); //clear PE Max value
- ucPE_Max = 0;
- #endif
- /*
- ((unsigned int *)Data)[0] = 375;
- ucM_Code = 0;
- ucN_Code = 0;
- ucResult = 0;
- ucTemp0 = 7;
- do
- {
- ucTemp1 = ulRate * ucTemp0 / 241003;
- if (2 <= ucTemp1)
- {
- ((unsigned long *)Data)[2] = ulRate * ucTemp0 / ucTemp1;
-
- ((unsigned int *)Data)[1] = (unsigned long)3735552000 / ((unsigned long *)Data)[2];
- if (15500 <= ((unsigned int *)Data)[1])
- {
- if (15700 >= ((unsigned int *)Data)[1])
- {
- if (0 != ucResult || (((unsigned long)usClock * ucTemp0 / ucTemp1) * ucTemp1) != ((unsigned long)usClock * ucTemp0))
- {
- ucN_Code = ucTemp0;
- ucM_Code = ucTemp1;
- break;
- }
- }
- ((unsigned int *)Data)[1] = ((unsigned int *)Data)[1] - 15500;
- }
- else
- {
- if (15375 <= ((unsigned int *)Data)[1])
- {
- if (0 != ucResult || (((unsigned long)usClock * ucTemp0 / ucTemp1) * ucTemp1) != ((unsigned long)usClock * ucTemp0))
- {
- ucN_Code = ucTemp0;
- ucM_Code = ucTemp1;
- break;
- }
- }
-
- ((unsigned int *)Data)[1] = 15500 - ((unsigned int *)Data)[1];
- }
-
- if (((unsigned int *)Data)[0] > ((unsigned int *)Data)[1])
- {
- ((unsigned int *)Data)[0] = ((unsigned int *)Data)[1];
- ucN_Code = ucTemp0;
- ucM_Code = ucTemp1;
- }
- }
- ucTemp1 = ucTemp1 + 1;
- if (2 <= ucTemp1)
- {
- ((unsigned long *)Data)[2] = ulRate * ucTemp0 / ucTemp1;
- ((unsigned int *)Data)[1] = (unsigned long)3735552000 / ((unsigned long *)Data)[2];
- if (15500 <= ((unsigned int *)Data)[1])
- {
- if (15700 >= ((unsigned int *)Data)[1])
- {
- if (0 != ucResult || (((unsigned long)usClock * ucTemp0 / ucTemp1) * ucTemp1) != ((unsigned long)usClock * ucTemp0))
- {
- ucN_Code = ucTemp0;
- ucM_Code = ucTemp1;
- break;
- }
- }
- ((unsigned int *)Data)[1] = ((unsigned int *)Data)[1] - 15500;
- }
- else
- {
- if (15375 <= ((unsigned int *)Data)[1])
- {
- if (0 != ucResult || (((unsigned long)usClock * ucTemp0 / ucTemp1) * ucTemp1) != ((unsigned long)usClock * ucTemp0))
- {
- ucN_Code = ucTemp0;
- ucM_Code = ucTemp1;
- break;
- }
- }
-
- ((unsigned int *)Data)[1] = 15500 - ((unsigned int *)Data)[1];
- }
- if (((unsigned int *)Data)[0] > ((unsigned int *)Data)[1])
- {
- ((unsigned int *)Data)[0] = ((unsigned int *)Data)[1];
- ucN_Code = ucTemp0;
- ucM_Code = ucTemp1;
- }
- }
- if (0 == ucResult)
- {
- if (43 < ucTemp0 && 60000 < ulRate)
- {
- ucTemp0 = 10;
- ucResult = 1;
- ((unsigned int *)Data)[0] = 500;
- }
- }
- else
- {
- if (36 < ucTemp0 && 200 > ((unsigned int *)Data)[0])
- {
- break;
- }
- }
- }
- while (53 >= ++ucTemp0);
- if (8 >= ucN_Code)
- {
- ucN_Code = ucN_Code * 3;
- ucM_Code = ucM_Code * 3;
- }
- else if (12 >= ucN_Code)
- {
- ucN_Code = ucN_Code * 2;
- ucM_Code = ucM_Code * 2;
- }
- usClock = usClock - 1;
- Wait_For_Event(EVENT_IEN_STOP);
- RTDSetByte(I_CODE_MB_CA, 0x18);
- RTDSetByte(I_CODE_LB_C9, 0x00);
- RTDSetByte(P_CODE_CB, 0x18);
- Data[0] = 5;
- Data[1] = Y_INC;
- Data[2] = PLL1_M_D7;
- Data[3] = 0x11;
- Data[4] = 0x00;
- Data[5] = 0;
- RTDWrite(Data);
- */
- ((unsigned int *)Data)[0] = 500;
- ucM_Code = 0;
- ucN_Code = 0;
- ucResult = 0;
- ucTemp0 = 7;
- do
- {
- //Fav * PLL2_M / PLL2_N = ulRate
- //PLL2_M = ulRate * PLL2_N / Fav;
- //ucTemp1 = ulRate * ucTemp0 / 253687;// (20/2 * 24.576 *32/31)
- ucTemp1 = ulRate * ucTemp0 / 215634;// (17/2 * 24.576 *32/31)
- if (2 <= ucTemp1)
- { //Fav = ulRate * PLL2_N / PLL2_M
- ((unsigned long *)Data)[2] = ulRate * ucTemp0 / ucTemp1;
- //(20/2 * 24.576 * 16)
- //((unsigned int *)Data)[1] = (unsigned long)393216000 / ((unsigned long *)Data)[2];
- ((unsigned int *)Data)[1] = (unsigned long)334223600 / ((unsigned long *)Data)[2];
- // > 31/2 = 15.5
- if (1550 <= ((unsigned int *)Data)[1])
- {
- if (1570 >= ((unsigned int *)Data)[1])
- {
- ucN_Code = ucTemp0;
- ucM_Code = ucTemp1;
- break;
- }
- ((unsigned int *)Data)[1] = ((unsigned int *)Data)[1] - 1550;
- }
- else //