This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/LMX2492EVM: Using Linux to drive the LMX2492EVM

Part Number: LMX2492EVM
Other Parts Discussed in Thread: LMX2492, USB2ANY, LMX2581

Tool/software: Linux

Support Path: /Tools & software/Help me with an issue/Design Kits / Evaluation Modules / Boards/Software issue/

Hi All,

Is there a way to program the LMX2492EVM using Linux?

Thanks in advance,

Paul

  • Dear Paul,

    LMX2492EVM is built with 2 seperate PCB's:

    1) the first PCB is a simple USB to serial data PCB based on an MSP430.
    2) LMX2492 with a 10 pin header connected to the SPI interface of the LMX2492.

    We support a PC based evaluation only but nothing is preventing you to program the device with your own software .

    I hope this helps.

    Regards, Simon.
  • I do not understand how to use the USB2ANY Interface Adapter as a generic USB to serial bridge. I see two options depending on whether it has already a code in its flash memory which is launched automatically at startup:

    1) If this is not the case, I will have to code one and to upload it in the MST430 myself. Does this later step require a USB Flash Emulation Tool?

    2) If this is the case, how can I access the bridge properly once it is plugged?

    Do you have any piece of code or some advice to help me start with?

  • Dear Paul,

    I recommend you check with the team supporting the MSP430. I am sure they will a solution for you.

    I will re-assign this thread to the MSP team.

    Regards, Simon.
  • Has the thread been re-assigned to the MSP support team? I have not received any information since your last post.

    Thanks in advance.

  • Hi Paul,

    The MSP430 should already have been flashed, but it may not be up to date. For details on how to access the bridge and update the firmware if necessary, please see the LMX2492EVM Evaluation Module User's Guide (www.ti.com/.../snau160). Specifically, see sections 2.5, 2.6 and Appendix A. For more info on the USB2ANY interface adapter, please see the User's Guide for that device: www.ti.com/.../snau228

    Regards,
    Nathan
  • Thank you for your answer.

    I read these two documents before your post, they do not really help me to do what I have to do.

    You say that there is a firmware in the device. This is good news for me! Now, what I do need is a documentation of the API I should use to work with this firmware under Linux. At the end, I have to manage to configure the LMX2492 automatically with a C++ software. The best would be to have a sample of code... Should I simply use the libusb? If so, do you have a simple sample of code to open the device and edit one configuration register of the LMX2492?

  • LMX2492_rampcalc.py
    from System.Windows.Media import SolidColorBrush, Color, Colors
    from System.Windows.Controls import(ComboBox,ComboBoxItem)
    from System.Windows import TextAlignment,FontWeights
    import math
       
    text_grey = SolidColorBrush(Color.FromArgb(153,153,153,0))
    text_black = SolidColorBrush(Colors.Black)
    
    def System_Update_Run_Once():
    
        UIC_ACC_START.Foreground=text_grey
        UIC_VCO_START_FREQ.Foreground=text_grey
        UIC_FPD_FREQ.Foreground=text_grey
    
        UIC_RAMP_LIMITH_SGN.Foreground=text_grey
        UIC_RAMP_LIMIT_HIGH_dec.Foreground=text_grey
        UIC_RAMP_LIMIT_HIGH.Foreground=text_grey
        UIC_RAMP_LIMITL_SGN.Foreground=text_grey
        UIC_RAMP_LIMIT_LOW_dec.Foreground=text_grey
        UIC_RAMP_LIMIT_LOW.Foreground=text_grey
        
        UIC_RAMP_COMP0_SGN.Foreground=text_grey
        UIC_RAMP_CMP0_dec.Foreground=text_grey
        UIC_RAMP_CMP0.Foreground=text_grey
        UIC_RAMP_COMP1_SGN.Foreground=text_grey
        UIC_RAMP_CMP1_dec.Foreground=text_grey
        UIC_RAMP_CMP1.Foreground=text_grey 
    
        UIC_ACT_END_FREQ0.Foreground=text_grey
        UIC_ACT_END_FREQ1.Foreground=text_grey
        UIC_ACT_END_FREQ2.Foreground=text_grey
        UIC_ACT_END_FREQ3.Foreground=text_grey
        UIC_ACT_END_FREQ4.Foreground=text_grey
        UIC_ACT_END_FREQ5.Foreground=text_grey
        UIC_ACT_END_FREQ6.Foreground=text_grey
        UIC_ACT_END_FREQ7.Foreground=text_grey
       
        UIC_RAMP0_LEN.Foreground=text_grey
        UIC_RAMP1_LEN.Foreground=text_grey
        UIC_RAMP2_LEN.Foreground=text_grey
        UIC_RAMP3_LEN.Foreground=text_grey
        UIC_RAMP4_LEN.Foreground=text_grey
        UIC_RAMP5_LEN.Foreground=text_grey
        UIC_RAMP6_LEN.Foreground=text_grey
        UIC_RAMP7_LEN.Foreground=text_grey
        
        UIC_RAMP0_INC_dec.Foreground=text_grey
        UIC_RAMP1_INC_dec.Foreground=text_grey
        UIC_RAMP2_INC_dec.Foreground=text_grey
        UIC_RAMP3_INC_dec.Foreground=text_grey
        UIC_RAMP4_INC_dec.Foreground=text_grey
        UIC_RAMP5_INC_dec.Foreground=text_grey
        UIC_RAMP6_INC_dec.Foreground=text_grey
        UIC_RAMP7_INC_dec.Foreground=text_grey
    
        UIC_RAMP0_INC.Foreground=text_grey
        UIC_RAMP1_INC.Foreground=text_grey
        UIC_RAMP2_INC.Foreground=text_grey
        UIC_RAMP3_INC.Foreground=text_grey
        UIC_RAMP4_INC.Foreground=text_grey
        UIC_RAMP5_INC.Foreground=text_grey
        UIC_RAMP6_INC.Foreground=text_grey
        UIC_RAMP7_INC.Foreground=text_grey    
        
        UpdateFromPLLTab();
        
        
        
    class GlobalVariables(object):
        def __init__(self):
            self.ACC_ERR = 0.0;
            self.START_ACT_ACC = 0.0;
            self.LAST_ACT_ACC=0.0;
            self.LAST_ACT_FREQ=0.0;
            self.NEXT_RAMP=0;
    
    g = GlobalVariables();
    
    def btn_UpdateFromPLLTab_Update():
        UpdateFromPLLTab();
    
    def DES_END_FREQ0_Update():
        System_Update();
    
    def DES_END_FREQ1_Update():
        System_Update();
    
    def DES_END_FREQ2_Update():
        System_Update();
    
    def DES_END_FREQ3_Update():
        System_Update();
    
    def DES_END_FREQ4_Update():
        System_Update();
    
    def DES_END_FREQ5_Update():
        System_Update();
    
    def DES_END_FREQ6_Update():
        System_Update();
    
    def DES_END_FREQ7_Update():
        System_Update();
    
    def DURATION0_Update():
        System_Update();
    
    def DURATION1_Update():
        System_Update();
    
    def DURATION2_Update():
        System_Update();
     
    def DURATION3_Update():
        System_Update();
    
    def DURATION4_Update():
        System_Update();
        
    def DURATION5_Update():
        System_Update();
    
    def DURATION6_Update():
        System_Update();
      
    def DURATION7_Update():
        System_Update();
    
    def RAMP0_DLY_Update():
        System_Update();
    
    def RAMP1_DLY_Update():
        System_Update();
    
    def RAMP2_DLY_Update():
        System_Update();
        
    def RAMP3_DLY_Update():
        System_Update();
     
    def RAMP4_DLY_Update():
        System_Update();
    
    def RAMP5_DLY_Update():
        System_Update();
    
    def RAMP6_DLY_Update():
        System_Update();
    
    def RAMP7_DLY_Update():
        System_Update();
    
    def RAMP0_NEXT_Update():
        System_Update();
         
    def RAMP1_NEXT_Update():
        System_Update();
    
    def RAMP2_NEXT_Update():
        System_Update();
    
    def RAMP3_NEXT_Update():
        System_Update();
       
    def RAMP4_NEXT_Update():
        System_Update();
    
    def RAMP5_NEXT_Update():
        System_Update();
    
    def RAMP6_NEXT_Update():
        System_Update();
     
    def RAMP7_NEXT_Update():
        System_Update();
    
    def RAMP0_RST_Update():
        System_Update();
     
    def RAMP1_RST_Update():
        System_Update();
    
    def RAMP2_RST_Update():
        System_Update();
    
    def RAMP3_RST_Update():
        System_Update();
    
    def RAMP4_RST_Update():
        System_Update();
      
    def RAMP5_RST_Update():
        System_Update();
    
    def RAMP6_RST_Update():
        System_Update();
    
    def RAMP7_RST_Update():
        System_Update();
    
    def System_Update():
        try:
            FPD_FREQ.dValue=PDF00.dValue
            VCO_START_FREQ.dValue=PDF00.dValue*(PLL_N.iValue+(PLL_NUM.iValue*1.0/16777216));
            ACC_START.dValue=(16777216.0*PLL_N.iValue)+PLL_NUM.iValue;
            if(PDF00.dValue!=0.0): 
                ACT_START_FREQ0.dValue = -1;
                ACT_START_FREQ1.dValue = -1;
                ACT_START_FREQ2.dValue = -1;
                ACT_START_FREQ3.dValue = -1;
                ACT_START_FREQ4.dValue = -1;
                ACT_START_FREQ5.dValue = -1;
                ACT_START_FREQ6.dValue = -1;
                ACT_START_FREQ7.dValue = -1;
                ACT_END_FREQ0.dValue = -1;
                ACT_END_FREQ1.dValue = -1;
                ACT_END_FREQ2.dValue = -1;
                ACT_END_FREQ3.dValue = -1;
                ACT_END_FREQ4.dValue = -1;
                ACT_END_FREQ5.dValue = -1;
                ACT_END_FREQ6.dValue = -1;
                ACT_END_FREQ7.dValue = -1;
                
                PDF = PDF00.dValue
                if (PDF<0.00000001):
                    PDF=1.0
                    
                MaxDelay0 =(RAMP0_DLY.iValue+1)*65535.0/PDF
                if (DURATION0.dValue>MaxDelay0):
                    DURATION0.dValue = MaxDelay0
                    
                MaxDelay1 =(RAMP1_DLY.iValue+1)*65535.0/PDF
                if (DURATION1.dValue>MaxDelay1):
                    DURATION1.dValue = MaxDelay1                
                    
                MaxDelay2 =(RAMP2_DLY.iValue+1)*65535.0/PDF
                if (DURATION2.dValue>MaxDelay2):
                    DURATION2.dValue = MaxDelay2                
                    
                MaxDelay3 =(RAMP3_DLY.iValue+1)*65535.0/PDF
                if (DURATION3.dValue>MaxDelay3):
                    DURATION3.dValue = MaxDelay3
                    
                MaxDelay4 =(RAMP4_DLY.iValue+1)*65535.0/PDF
                if (DURATION4.dValue>MaxDelay4):
                    DURATION4.dValue = MaxDelay4
    
                MaxDelay5 =(RAMP5_DLY.iValue+1)*65535.0/PDF
                if (DURATION5.dValue>MaxDelay5):
                    DURATION5.dValue = MaxDelay5
                    
                MaxDelay6 =(RAMP6_DLY.iValue+1)*65535.0/PDF
                if (DURATION6.dValue>MaxDelay6):
                    DURATION6.dValue = MaxDelay6                
                    
                MaxDelay7 =(RAMP7_DLY.iValue+1)*65535.0/PDF
                if (DURATION7.dValue>MaxDelay7):
                    DURATION7.dValue = MaxDelay7                
                    
    
                RAMP0_LEN.iValue = int(round(PDF00.dValue*DURATION0.dValue/(RAMP0_DLY.iValue+1)));
                RAMP1_LEN.iValue = int(round(PDF00.dValue*DURATION1.dValue/(RAMP1_DLY.iValue+1)));
                RAMP2_LEN.iValue = int(round(PDF00.dValue*DURATION2.dValue/(RAMP2_DLY.iValue+1)));
                RAMP3_LEN.iValue = int(round(PDF00.dValue*DURATION3.dValue/(RAMP3_DLY.iValue+1)));
                RAMP4_LEN.iValue = int(round(PDF00.dValue*DURATION4.dValue/(RAMP4_DLY.iValue+1)));
                RAMP5_LEN.iValue = int(round(PDF00.dValue*DURATION5.dValue/(RAMP5_DLY.iValue+1)));
                RAMP6_LEN.iValue = int(round(PDF00.dValue*DURATION6.dValue/(RAMP6_DLY.iValue+1)));
                RAMP7_LEN.iValue = int(round(PDF00.dValue*DURATION7.dValue/(RAMP7_DLY.iValue+1)));
                g.ACC_ERR=((DES_END_FREQ0.dValue/PDF00.dValue)*16777216)-ACC_START.dValue;
                if(DURATION0.dValue!=0.0):
                    RAMP0_INC_dec.iValue=int(round(g.ACC_ERR/RAMP0_LEN.iValue));
                    if(int(RAMP0_INC_dec.iValue)<0):
                        RAMP0_INC.iValue=int(1073741824.0+RAMP0_INC_dec.iValue);
                    else:
                        RAMP0_INC.iValue= RAMP0_INC_dec.iValue;
                    g.START_ACT_ACC = float(ACC_START.dValue);
                    g.LAST_ACT_ACC = float(float(RAMP0_INC_dec.iValue*RAMP0_LEN.iValue)+float(ACC_START.dValue));
                    g.LAST_ACT_FREQ = float(PDF00.dValue*g.LAST_ACT_ACC/16777216.0);
                    ACT_END_FREQ0.dValue = g.LAST_ACT_FREQ;
                    g.NEXT_RAMP = RAMP0_NEXT.iValue;
                    ACT_START_FREQ0.dValue = VCO_START_FREQ.dValue;
                    print ACT_START_FREQ0.dValue;
                    DIRTY1=0;DIRTY2=0;DIRTY3=0;DIRTY4=0;DIRTY5=0;DIRTY6=0;DIRTY7=0;
                    flag=0;
                    try:
                        while(True):
                            if(g.NEXT_RAMP==0):
                                break;
                            elif(g.NEXT_RAMP==1):
                                if(DIRTY1!=1):
                                    DIRTY1=1;
                                    CALC_RAMP(ACT_START_FREQ1,DES_END_FREQ1,ACT_END_FREQ1,RAMP1_NEXT,RAMP1_RST,RAMP1_LEN,RAMP1_INC_dec,RAMP1_INC);
                                else:
                                    break;
                            elif(g.NEXT_RAMP==2):
                                if(DIRTY2!=1):
                                    DIRTY2=1;
                                    CALC_RAMP(ACT_START_FREQ2,DES_END_FREQ2,ACT_END_FREQ2,RAMP2_NEXT,RAMP2_RST,RAMP2_LEN,RAMP2_INC_dec,RAMP2_INC);
                                else:
                                    break;
                            elif(g.NEXT_RAMP==3):
                                if(DIRTY3!=1):
                                    DIRTY3=1;
                                    CALC_RAMP(ACT_START_FREQ3,DES_END_FREQ3,ACT_END_FREQ3,RAMP3_NEXT,RAMP3_RST,RAMP3_LEN,RAMP3_INC_dec,RAMP3_INC);
                                else:
                                    break;
                            elif(g.NEXT_RAMP==4):
                                if(DIRTY4!=1):
                                    DIRTY4=1;
                                    CALC_RAMP(ACT_START_FREQ4,DES_END_FREQ4,ACT_END_FREQ4,RAMP4_NEXT,RAMP4_RST,RAMP4_LEN,RAMP4_INC_dec,RAMP4_INC);
                                else:
                                    break;
                            elif(g.NEXT_RAMP==5):
                                if(DIRTY5!=1):
                                    DIRTY5=1;
                                    CALC_RAMP(ACT_START_FREQ5,DES_END_FREQ5,ACT_END_FREQ5,RAMP5_NEXT,RAMP5_RST,RAMP5_LEN,RAMP5_INC_dec,RAMP5_INC);
                                else:
                                    break;
                            elif(g.NEXT_RAMP==6):
                                if(DIRTY6!=1):
                                    DIRTY6=1;
                                    CALC_RAMP(ACT_START_FREQ6,DES_END_FREQ6,ACT_END_FREQ6,RAMP6_NEXT,RAMP6_RST,RAMP6_LEN,RAMP6_INC_dec,RAMP6_INC);
                                    print RAMP6_INC.iValue;
                                    print RAMP6_DLY.iValue;
                                else:
                                    break;
                            elif(g.NEXT_RAMP==7):
                                if(DIRTY7!=1):
                                    DIRTY7=1;
                                    CALC_RAMP(ACT_START_FREQ7,DES_END_FREQ7,ACT_END_FREQ7,RAMP7_NEXT,RAMP7_RST,RAMP7_LEN,RAMP7_INC_dec,RAMP7_INC);
                                else:
                                    break;
                    except Exception,e:
                        print e;
            #WriteParameter(RAMP0_LEN.codeloaderName,RAMP0_LEN.iValue);
            #WriteParameter(RAMP1_LEN.codeloaderName,RAMP1_LEN.iValue);
            #WriteParameter(RAMP2_LEN.codeloaderName,RAMP2_LEN.iValue);
            #WriteParameter(RAMP3_LEN.codeloaderName,RAMP3_LEN.iValue);
            #WriteParameter(RAMP4_LEN.codeloaderName,RAMP4_LEN.iValue);
            #WriteParameter(RAMP5_LEN.codeloaderName,RAMP5_LEN.iValue);
            #WriteParameter(RAMP6_LEN.codeloaderName,RAMP6_LEN.iValue);
            # WriteParameter(RAMP7_LEN.codeloaderName,RAMP7_LEN.iValue);
            # WriteParameter(RAMP0_INC.codeloaderName,RAMP0_INC.iValue);
            # WriteParameter(RAMP1_INC.codeloaderName,RAMP1_INC.iValue);
            # WriteParameter(RAMP2_INC.codeloaderName,RAMP2_INC.iValue);
            # WriteParameter(RAMP3_INC.codeloaderName,RAMP3_INC.iValue);
            # WriteParameter(RAMP4_INC.codeloaderName,RAMP4_INC.iValue);
            # WriteParameter(RAMP5_INC.codeloaderName,RAMP5_INC.iValue);
            # WriteParameter(RAMP6_INC.codeloaderName,RAMP6_INC.iValue);
            # WriteParameter(RAMP7_INC.codeloaderName,RAMP7_INC.iValue);
        except Exception,e:
            print e;
        pass;
        if(ACT_START_FREQ0.dValue<0):
            UIC_ACT_START_FREQ0.Foreground = text_grey;
            Dim(ACT_START_FREQ0)
            Dim(DES_END_FREQ0)
            Dim(DURATION0)
            Dim(RAMP0_DLY)
            Dim(RAMP0_INC)
            Dim(RAMP0_RST)
            Dim(RAMP0_NEXT)
            Dim(RAMP0_NEXT_TRIG)
            Dim(RAMP0_FL)
            Dim(RAMP0_FLAG)
        else:
            UIC_ACT_START_FREQ0.Foreground = text_black;
            UnDim(ACT_START_FREQ0)
            UnDim(DES_END_FREQ0)
            UnDim(DURATION0)
            UnDim(RAMP0_DLY)
            UnDim(RAMP0_INC)
            UnDim(RAMP0_RST)
            UnDim(RAMP0_NEXT)
            UnDim(RAMP0_NEXT_TRIG)
            UnDim(RAMP0_FL)
            UnDim(RAMP0_FLAG)
            
        if(ACT_START_FREQ1.dValue<0):
            UIC_ACT_START_FREQ1.Foreground = text_grey;
            Dim(ACT_START_FREQ1)
            Dim(DES_END_FREQ1)
            Dim(DURATION1)
            Dim(RAMP1_DLY)
            Dim(RAMP1_INC)
            Dim(RAMP1_RST)
            Dim(RAMP1_NEXT)
            Dim(RAMP1_NEXT_TRIG)
            Dim(RAMP1_FL)
            Dim(RAMP1_FLAG)
        else:
            UIC_ACT_START_FREQ1.Foreground = text_black;
            UnDim(ACT_START_FREQ1)
            UnDim(DES_END_FREQ1)
            UnDim(DURATION1)
            UnDim(RAMP1_DLY)
            UnDim(RAMP1_INC)
            UnDim(RAMP1_RST)
            UnDim(RAMP1_NEXT)
            UnDim(RAMP1_NEXT_TRIG)
            UnDim(RAMP1_FL)
            UnDim(RAMP1_FLAG)
            
        if(ACT_START_FREQ2.dValue<0):
            UIC_ACT_START_FREQ2.Foreground = text_grey;
            Dim(ACT_START_FREQ2)
            Dim(DES_END_FREQ2)
            Dim(DURATION2)
            Dim(RAMP2_DLY)
            Dim(RAMP2_INC)
            Dim(RAMP2_RST)
            Dim(RAMP2_NEXT)
            Dim(RAMP2_NEXT_TRIG)
            Dim(RAMP2_FL)
            Dim(RAMP2_FLAG)
        else:
            UIC_ACT_START_FREQ2.Foreground = text_black;
            UnDim(ACT_START_FREQ2)
            UnDim(DES_END_FREQ2)
            UnDim(DURATION2)
            UnDim(RAMP2_DLY)
            UnDim(RAMP2_INC)
            UnDim(RAMP2_RST)
            UnDim(RAMP2_NEXT)
            UnDim(RAMP2_NEXT_TRIG)
            UnDim(RAMP2_FL)
            UnDim(RAMP2_FLAG)
            
        if(ACT_START_FREQ3.dValue<0):
            UIC_ACT_START_FREQ3.Foreground = text_grey;
            Dim(ACT_START_FREQ3)
            Dim(DES_END_FREQ3)
            Dim(DURATION3)
            Dim(RAMP3_DLY)
            Dim(RAMP3_INC)
            Dim(RAMP3_RST)
            Dim(RAMP3_NEXT)
            Dim(RAMP3_NEXT_TRIG)
            Dim(RAMP3_FL)
            Dim(RAMP3_FLAG)
        else:
            UIC_ACT_START_FREQ3.Foreground = text_black;
            UnDim(ACT_START_FREQ3)
            UnDim(DES_END_FREQ3)
            UnDim(DURATION3)
            UnDim(RAMP3_DLY)
            UnDim(RAMP3_INC)
            UnDim(RAMP3_RST)
            UnDim(RAMP3_NEXT)
            UnDim(RAMP3_NEXT_TRIG)
            UnDim(RAMP3_FL)
            UnDim(RAMP3_FLAG)
            
        if(ACT_START_FREQ4.dValue<0):
            UIC_ACT_START_FREQ4.Foreground = text_grey;
            Dim(ACT_START_FREQ4)
            Dim(DES_END_FREQ4)
            Dim(DURATION4)
            Dim(RAMP4_DLY)
            Dim(RAMP4_INC)
            Dim(RAMP4_RST)
            Dim(RAMP4_NEXT)
            Dim(RAMP4_NEXT_TRIG)
            Dim(RAMP4_FL)
            Dim(RAMP4_FLAG)
        else:
            UIC_ACT_START_FREQ4.Foreground = text_black;
            UnDim(ACT_START_FREQ4)
            UnDim(DES_END_FREQ4)
            UnDim(DURATION4)
            UnDim(RAMP4_DLY)
            UnDim(RAMP4_INC)
            UnDim(RAMP4_RST)
            UnDim(RAMP4_NEXT)
            UnDim(RAMP4_NEXT_TRIG)
            UnDim(RAMP4_FL)
            UnDim(RAMP4_FLAG)
            
        if(ACT_START_FREQ5.dValue<0):
            UIC_ACT_START_FREQ5.Foreground = text_grey;
            Dim(ACT_START_FREQ5)
            Dim(DES_END_FREQ5)
            Dim(DURATION5)
            Dim(RAMP5_DLY)
            Dim(RAMP5_INC)
            Dim(RAMP5_RST)
            Dim(RAMP5_NEXT)
            Dim(RAMP5_NEXT_TRIG)
            Dim(RAMP5_FL)
            Dim(RAMP5_FLAG)
        else:
            UIC_ACT_START_FREQ5.Foreground = text_black;
            UnDim(ACT_START_FREQ5)
            UnDim(DES_END_FREQ5)
            UnDim(DURATION5)
            UnDim(RAMP5_DLY)
            UnDim(RAMP5_INC)
            UnDim(RAMP5_RST)
            UnDim(RAMP5_NEXT)
            UnDim(RAMP5_NEXT_TRIG)
            UnDim(RAMP5_FL)
            UnDim(RAMP5_FLAG)
            
        if(ACT_START_FREQ6.dValue<0):
            UIC_ACT_START_FREQ6.Foreground = text_grey;
            Dim(ACT_START_FREQ6)
            Dim(DES_END_FREQ6)
            Dim(DURATION6)
            Dim(RAMP6_DLY)
            Dim(RAMP6_INC)
            Dim(RAMP6_RST)
            Dim(RAMP6_NEXT)
            Dim(RAMP6_NEXT_TRIG)
            Dim(RAMP6_FL)
            Dim(RAMP6_FLAG)
        else:
            UIC_ACT_START_FREQ6.Foreground = text_black;
            UnDim(ACT_START_FREQ6)
            UnDim(DES_END_FREQ6)
            UnDim(DURATION6)
            UnDim(RAMP6_DLY)
            UnDim(RAMP6_INC)
            UnDim(RAMP6_RST)
            UnDim(RAMP6_NEXT)
            UnDim(RAMP6_NEXT_TRIG)
            UnDim(RAMP6_FL)
            UnDim(RAMP6_FLAG)
            
        if(ACT_START_FREQ7.dValue<0):
            UIC_ACT_START_FREQ7.Foreground = text_grey;
            Dim(ACT_START_FREQ7)
            Dim(DES_END_FREQ7)
            Dim(DURATION7)
            Dim(RAMP7_DLY)
            Dim(RAMP7_INC)
            Dim(RAMP7_RST)
            Dim(RAMP7_NEXT)
            Dim(RAMP7_NEXT_TRIG)
            Dim(RAMP7_FL)
            Dim(RAMP7_FLAG)
        else:
            UIC_ACT_START_FREQ7.Foreground = text_black;
            UnDim(ACT_START_FREQ7)
            UnDim(DES_END_FREQ7)
            UnDim(DURATION7)
            UnDim(RAMP7_DLY)
            UnDim(RAMP7_INC)
            UnDim(RAMP7_RST)
            UnDim(RAMP7_NEXT)
            UnDim(RAMP7_NEXT_TRIG)
            UnDim(RAMP7_FL)
            UnDim(RAMP7_FLAG)
            
    def RAMP_LIMIT_LOW_FREQ_Update():
        calc(RAMP_LIMIT_LOW_FREQ,RAMP_LIMIT_LOW_dec,RAMP_LIMITL_SGN,RAMP_LIMIT_LOW);
        pass;
    
    def RAMP_LIMIT_HIGH_FREQ_Update():
        calc(RAMP_LIMIT_HIGH_FREQ,RAMP_LIMIT_HIGH_dec,RAMP_LIMITH_SGN,RAMP_LIMIT_HIGH);
        pass;
        
    def RAMP_CMP0_FREQ_Update():
        calc(RAMP_CMP0_FREQ,RAMP_CMP0_dec,RAMP_COMP0_SGN,RAMP_CMP0);
        pass;
    
    def RAMP_CMP1_FREQ_Update():
        calc(RAMP_CMP1_FREQ,RAMP_CMP1_dec,RAMP_COMP1_SGN,RAMP_CMP1);
        pass;
    
    def calc(Freq,DEC,SGN,MAIN):
        if(PDF00.dValue!=0):
            ans = int((round(Freq.dValue/PDF00.dValue,4)-PLL_N.iValue)*16777216.0);
            if( ans < 0 ):
                SGN.iValue = 1;
                DEC.dValue = -1*float(ans);
            else:
                SGN.iValue = 0;
                DEC.dValue =(ans);
            if( ans > 4294967296.0 ):
                DEC.dValue = 4294967296.0;
                
            if(SGN.iValue == 0):
                MAIN.iValue = int(DEC.dValue);
            elif(SGN.iValue == 1):
                MAIN.iValue = int(8589934592-DEC.dValue);
    
        else:
            VCO_START_FREQ.dValue = -1;
        # WriteParameter(MAIN.codeloaderName,MAIN.iValue);
        # WriteParameter(LSB.codeloaderName,LSB.iValue);
        pass;
    
    def CALC_RAMP(ActStartFreq,DesEndFreq,ActEndFreq,Next,Reset,Len,IncDec,Inc):
        try:
            if(Reset.iValue!=0):
                g.LAST_ACT_ACC = float(g.START_ACT_ACC);
                ActStartFreq.dValue = float(VCO_START_FREQ.dValue);
                g.LAST_ACT_FREQ = float(VCO_START_FREQ.dValue);
            ActStartFreq.dValue=float(g.LAST_ACT_FREQ);
            g.ACC_ERR=float(((DesEndFreq.dValue/PDF00.dValue)*16777216)-g.LAST_ACT_ACC);
            if(Len.iValue!=0):
                IncDec.iValue=int(round(g.ACC_ERR/Len.iValue));
                if(IncDec.iValue<0):
                    Inc.iValue=1073741824+IncDec.iValue;
                else:
                    Inc.iValue=IncDec.iValue;
                g.LAST_ACT_ACC=Len.iValue*IncDec.iValue+g.LAST_ACT_ACC;
                g.LAST_ACT_FREQ=(g.LAST_ACT_ACC/16777216)*PDF00.dValue;
                ActEndFreq.dValue=float(g.LAST_ACT_FREQ);
                g.NEXT_RAMP=Next.iValue;
        except Exception, e:
            print e;
        pass;
    
    
    def System_Update_UI():
        if(float(UIC_ACT_START_FREQ1.Text)==-1):
            UIC_ACT_START_FREQ1.Foreground = SolidColorBrush(Colors.Red);
        else:
            UIC_ACT_START_FREQ1.Foreground = SolidColorBrush(Colors.Black);
        if(float(UIC_ACT_START_FREQ2.Text)==-1):
            UIC_ACT_START_FREQ2.Foreground = SolidColorBrush(Colors.Red);
        else:
            UIC_ACT_START_FREQ2.Foreground = SolidColorBrush(Colors.Black);
        if(float(UIC_ACT_START_FREQ3.Text)==-1):
            UIC_ACT_START_FREQ3.Foreground = SolidColorBrush(Colors.Red);
        else:
            UIC_ACT_START_FREQ3.Foreground = SolidColorBrush(Colors.Black);      
        if(float(UIC_ACT_START_FREQ4.Text)==-1):
            UIC_ACT_START_FREQ4.Foreground = SolidColorBrush(Colors.Red);
        else:
            UIC_ACT_START_FREQ4.Foreground = SolidColorBrush(Colors.Black);
        if(float(UIC_ACT_START_FREQ5.Text)==-1):
            UIC_ACT_START_FREQ5.Foreground = SolidColorBrush(Colors.Red);
        else:
            UIC_ACT_START_FREQ5.Foreground = SolidColorBrush(Colors.Black);
        if(float(UIC_ACT_START_FREQ6.Text)==-1):
            UIC_ACT_START_FREQ6.Foreground = SolidColorBrush(Colors.Red);
        else:
            UIC_ACT_START_FREQ6.Foreground = SolidColorBrush(Colors.Black);
        if(float(UIC_ACT_START_FREQ7.Text)==-1):
            UIC_ACT_START_FREQ7.Foreground = SolidColorBrush(Colors.Red);
        else:
            UIC_ACT_START_FREQ7.Foreground = SolidColorBrush(Colors.Black);
        pass   
        '''
        if(float(UIC_ACT_END_FREQ1.Text)==-1):
            UIC_ACT_END_FREQ1.Foreground = SolidColorBrush(Colors.Red);
        else:
            UIC_ACT_END_FREQ1.Foreground = SolidColorBrush(Colors.Black);
        if(float(UIC_ACT_END_FREQ2.Text)==-1):
            UIC_ACT_END_FREQ2.Foreground = SolidColorBrush(Colors.Red);
        else:
            UIC_ACT_END_FREQ2.Foreground = SolidColorBrush(Colors.Black);
        if(float(UIC_ACT_END_FREQ3.Text)==-1):
            UIC_ACT_END_FREQ3.Foreground = SolidColorBrush(Colors.Red);
        else:
            UIC_ACT_END_FREQ3.Foreground = SolidColorBrush(Colors.Black);
        if(float(UIC_ACT_END_FREQ4.Text)==-1):
            UIC_ACT_END_FREQ4.Foreground = SolidColorBrush(Colors.Red);
        else:
            UIC_ACT_END_FREQ4.Foreground = SolidColorBrush(Colors.Black);
        if(float(UIC_ACT_END_FREQ5.Text)==-1):
            UIC_ACT_END_FREQ5.Foreground = SolidColorBrush(Colors.Red);
        else:
            UIC_ACT_END_FREQ5.Foreground = SolidColorBrush(Colors.Black);
        if(float(UIC_ACT_END_FREQ6.Text)==-1):
            UIC_ACT_END_FREQ6.Foreground = SolidColorBrush(Colors.Red);
        else:
            UIC_ACT_END_FREQ6.Foreground = SolidColorBrush(Colors.Black);
        if(float(UIC_ACT_END_FREQ7.Text)==-1):
            UIC_ACT_END_FREQ7.Foreground = SolidColorBrush(Colors.Red);
        else:
            UIC_ACT_END_FREQ7.Foreground = SolidColorBrush(Colors.Black);
        pass;
        '''
    def Modify_ControlProperties():
        try:
            # Accessing the User Control using script   
            # Note: All the User Controls of the flex page can be accessed using the following format:
            # UIC_ControlName where ControlName is the section name in the flex ini
            
            # Trying to add a new item "New" to the ComboBox named RAMP0_FLAG in the flex page
            list = UIC_RAMP0_FLAG.Items;
            list.Add("New");
            
            # Trying to modify the foreground and the text property of control named ACT_END_FREQ7 in the flex page if its values is -1
            if(float(UIC_ACT_START_FREQ7.Text)==-1):
                UIC_ACT_START_FREQ7.Foreground = SolidColorBrush(Colors.Red);
                UIC_ACT_START_FREQ7.Text = "< 0";
                
        except Exception, e:
            print "Exception",e;
        pass;
    
    def UpdateFromPLLTab():
        FPD_FREQ.dValue=PDF00.dValue
        VCO_START_FREQ.dValue=PDF00.dValue*(PLL_N.iValue+(PLL_NUM.iValue*1.0/16777216));
        ACC_START.dValue=16777216.0*PLL_N.iValue;
        RAMP_LIMIT_LOW_FREQ_Update();
        RAMP_LIMIT_HIGH_FREQ_Update();
        RAMP_CMP0_FREQ_Update();
        RAMP_CMP1_FREQ_Update();
        pass;
        
        
    Paul,

    We can not share the whole source code of TICSPro and it is very complicated as it supports all our devices.  For the PLL tab, this is actually inherent in the main program, so that's not very sharable.

    That being said, there are two things I can do:

    1.  I have attached the code for the Ramping functions tab.  The Ramping functions are writtien in Iron Python and are attached.  For some of of the variables,  you can run TICSPro and mouse over various controls and boxes and it will show you then name.  For instance, if you put the cursur in the VCO frequency box fo teh PLL tab, it shows Fvco_FREQ.  

    2.  The LMX2492 PLL tab is hard coded the main program and not sharable.  I don't have raw code for a device with a PLL only, but I do have for the LMX2581, which is a predecessor to the LMX2492.   This is not the same device, and it has some unnecessary features realted to VCO calibration, but maybe it will be helpful.

    LMX2581_PLL.py
    """
    Copyright (C) {2015} Texas Instruments Incorporated - http://www.ti.com/ 
    ALL RIGHTS RESERVED 
    """
    
    from System.Windows.Media import SolidColorBrush, Color, Colors
    
    from System.Windows.Controls import(ComboBox,ComboBoxItem)
    from System.Windows import TextAlignment,FontWeights
    
    import sys
    import clr
    clr.AddReference("System.Windows.Forms")
    from System.Windows.Forms import DialogResult, MessageBox, MessageBoxButtons, MessageBoxIcon
    
    import math
    
    
    brush_warning = SolidColorBrush(Color.FromArgb(255,204,0,0))
    brush_white = SolidColorBrush(Color.FromArgb(255,255,255,255))
    brush_alert = SolidColorBrush(Color.FromArgb(255,253,205,52))
    
    # Note: In some places elements are accessed using UIC_Control (UI Control Element) because of the clash with controls in User Controls Page
    
        
    class GlobalVariables(object):
    	def __init__(self):
    		self.VCO_freq_state = "";
    g = GlobalVariables();
    
    def System_Update():
        UpdateFpdFrequency()
        UpdateVCOFrequency() 
        ValidateFrequencies()
    
    def System_Update_Loaded_Mode():
        UpdateFpdFrequency()
        UpdateVCOFrequency() 
        ValidateFrequencies()
        
    def System_Update_Run_Once():
        UpdateFpdFrequency()
        UpdateVCOFrequency() 
        System_Update_Run_Once_UI()
    
    def System_Update_Run_Once_UI():
        UIC_Fpd_FREQ.TextAlignment = TextAlignment.Right
    
        UIC_Kvco.TextAlignment = TextAlignment.Left
        UIC_Fvco_FREQ.TextAlignment = TextAlignment.Left
        
        UIC_FoutA_FREQ.TextAlignment = TextAlignment.Left
        UIC_FoutB_FREQ.TextAlignment = TextAlignment.Left
        ValidateFrequencies()
        
    def UpdateFpdFrequency():
        R = PLL_R.iValue
        if (R<1):
            R=1
        Fpd = Fosc_FREQ.dValue/R*(1+OSC_2X.iValue)
        Fpd_FREQ.dValue=Fpd
        pass  
        
    
    
    def UpdateVCOGain():
        Fvco=Fvco_FREQ.dValue
            
        if (Fvco<2168):
            VCOCoreSel=1
        elif (Fvco<2290.1):
            if (VCO_SEL.iValue==0):
                VCOCoreSel=1
            else:
                VCOCoreSel=2
        elif (Fvco<2743.1):
            if (VCO_SEL.iValue<3):
                VCOCoreSel=2
            else:
                VCOCoreSel=3
        elif (Fvco<3248.1):
            if (VCO_SEL.iValue<4):
                VCOCoreSel=3
            else:
                VCOCoreSel=4
        else:
            VCOCoreSel=4
            
        if (Fvco<1880):
            KvcoCalc = 12
        elif (Fvco>3760):
            KvcoCalc=37
        elif (VCOCoreSel==1):
            KvcoCalc = 12+(24-12)*(Fvco-1880)/(2290-1880)
        elif (VCOCoreSel==2):
            KvcoCalc = 15+(30-15)*(Fvco-2168)/(2743-2168)        
        elif (VCOCoreSel==3):
            KvcoCalc = 20+(37-20)*(Fvco-2650)/(3248-2650)
        else:
            KvcoCalc = 37+(37-21)*(Fvco-3126)/(3760-3126)
            
        VCOCore.dValue=VCOCoreSel
        Kvco.dValue=KvcoCalc
    
    def ValidateFrequencies():
        Fosc=Fosc_FREQ.dValue
        Fpd =Fpd_FREQ.dValue
        Fvco=Fvco_FREQ.dValue
        
        #   Validate OSCin
        if (Fosc<5):
            UIC_Fosc_FREQ.Background = brush_warning
            UIC_Fosc_FREQ.ToolTip="Minimum Fosc is 5 MHz"
        elif (Fosc>900):
            UIC_Fosc_FREQ.Background = brush_warning
            UIC_Fosc_FREQ.ToolTip="Maximum Fosc is 900 MHz"
        elif (Fosc>250) and (OSC_2X.iValue==1):
            UIC_Fosc_FREQ.Background = brush_warning
            UIC_Fosc_FREQ.ToolTip="Maximum Fosc is 250 MHz with the OSCin doubler enabled."
        else:
            UIC_Fosc_FREQ.Background = brush_white
            UIC_Fosc_FREQ.ToolTip=None  
    
        #   Validate OSC_FREQ
        OldIndex=OSC_FREQ.iValue
        if (Fosc<64.01):
            NewIndex=0
        elif (Fosc<128.01):
            NewIndex=1
        elif (Fosc<256.01):
            NewIndex=2
        elif (Fosc<512.01):
            NewIndex=3
        else:
            NewIndex=4
            
        if (OldIndex==NewIndex):
            UIC_OSC_FREQ.Background = brush_white
            UIC_OSC_FREQ.ToolTip = None
        else:
            UIC_OSC_FREQ.Background = brush_alert
            UIC_OSC_FREQ.ToolTip = "OSC_FREQ Needs to Be adjusted new OSCin Frequency."    
                
        #   Validate OSCin Doubler
        if  (OSC_2X.iValue==1) and (Fosc>250):
            UIC_OSC_2X.Background = brush_warning
            UIC_OSC_2X.ToolTip = "Maximum Input Frequency for the OSCin doubler is 250 MHz."
        else:
            UIC_OSC_2X.Background = brush_white
            UIC_OSC_2X.ToolTip=None
        
        #   Validate Fpd
        if (Fpd_FREQ.dValue>200):
            UIC_Fpd_FREQ.Background = brush_warning
            UIC_Fpd_FREQ.ToolTip="Maximum Phase Detector Frequency is 200 MHz."
        else:
            UIC_Fpd_FREQ.Background = brush_white
            UIC_Fpd_FREQ.ToolTip=None
            
       
        #   Validate N Divider & Order
        N=PLL_N.iValue
        Order=FRAC_ORDER.iValue
        if (Order==0):
            Nmin=7
        elif (Order==1):
            Nmin=7
        elif (Order==2):
            Nmin=8
        elif (Order==3):
            Nmin=10
        elif (Order==4):
            Nmin=14
         
        if (N<7):
            UIC_PLL_N.ToolTip="PLL_N values below 7 are not supported (2016-05-02)"
            UIC_PLL_N.GetTextBox().Background = brush_warning
            UIC_FRAC_ORDER.ToolTip=None
            UIC_FRAC_ORDER.Background=brush_white
        elif (N<Nmin):
            UIC_PLL_N.ToolTip="This PLL_N value is too low for this FRAC_ORDER, but could be supported if the FRAC_ORDER is reduced."
            UIC_PLL_N.GetTextBox().Background = brush_warning 
            UIC_FRAC_ORDER.Background=brush_alert   
            if (N<8):
                UIC_FRAC_ORDER.ToolTip="Try using the 1st Order Modulator."
            elif (N<10):
                UIC_FRAC_ORDER.ToolTip="Try using the 2nd Order Modulator."
            elif (N<14):
                UIC_FRAC_ORDER.ToolTip="Try using the 3rd Order Modulator."
        else:
            UIC_PLL_N.ToolTip= None
            UIC_PLL_N.GetTextBox().Background = brush_white      
            UIC_FRAC_ORDER.ToolTip=None
            UIC_FRAC_ORDER.Background=brush_white
            
        #   Validate FRAC_DITHER
        UIC_FRAC_DITHER.Background=brush_white
        UIC_FRAC_DITHER.ToolTip=None
        
        if (FRAC_DITHER.iValue<3):
            Fnum=PLL_NUM.iValue
            Fden=PLL_DEN.iValue
            if (Fnum==0) or (Fden==0):
                Fden=1
                Fnum=0
            Divisor=2
            while (Divisor<4):
                if (0 == (Fnum%Divisor)) and (0==(Fden%Divisor)):
                    Fnum=Fnum/Divisor
                    Fden=Fden/Divisor
                else:
                    Divisor=Divisor+1
                
            NoDither=0
            if (Fnum==0):
                NoDither=1
            if (FRAC_ORDER.iValue<2):
                NoDither=1
            if (0 < (Fden % 2)) and (FRAC_ORDER.iValue==2):
                NoDither=1
            if (0 <(Fden % 2)) and (0 <(Fden % 3)) and(FRAC_ORDER.iValue>2):
                NoDither=1
    
            if (NoDither==1) and (FRAC_DITHER.iValue<3):
                UIC_FRAC_DITHER.Background=brush_alert
                UIC_FRAC_DITHER.ToolTip="Dithering will likely not improve performance in this situation as there should be no sub-fractional spurs."
            else:
                UIC_FRAC_DITHER.Background=brush_white
                UIC_FRAC_DITHER.ToolTip="None"    
       
        #   Validate VCO Frequency
        UIC_Fvco_FREQ.Background = brush_white
        UIC_Fvco_FREQ.ToolTip=None
        if (Fvco_FREQ.dValue<1880):
            UIC_Fvco_FREQ.ToolTip="Minimum VCO Frequency is 1880 MHz."
            UIC_Fvco_FREQ.Background = brush_warning
        elif (Fvco_FREQ.dValue>3760):
            UIC_Fvco_FREQ.Background = brush_warning
            UIC_Fvco_FREQ.ToolTip="Maximum VCO Frequency is 3760 MHz." 
            
    
    
        #   Validate Outputs
        if ( (FoutA_FREQ.dValue<49.47) or (FoutA_FREQ.dValue>3760.1) ):
            UIC_FoutA_FREQ.ToolTip="Valid Frequency range is 49.47 to 3760 MHz."
            UIC_FoutA_FREQ.Background=brush_warning
        else:
            UIC_FoutA_FREQ.ToolTip=None
            UIC_FoutA_FREQ.Background=brush_white
            
        if ( (FoutB_FREQ.dValue<49.47) or (FoutB_FREQ.dValue>3760.1) ):
            UIC_FoutB_FREQ.ToolTip="Valid Frequency range is 49.47 to 3760 MHz."
            UIC_FoutB_FREQ.Background=brush_warning
        else:
            UIC_FoutB_FREQ.ToolTip=None
            UIC_FoutB_FREQ.Background=brush_white
        
      
        UIC_VCO_SEL.Background=brush_white
        
        #   Re-Validate for External VCO Mode
        if (MODE.iValue>0):
            
                #   Validate VCO Frequency
            UIC_Fvco_FREQ.Background = brush_white
            UIC_Fvco_FREQ.ToolTip=None
            if (Fvco_FREQ.dValue<500):
                UIC_Fvco_FREQ.ToolTip="Minimum VCO Frequency is 5000 MHz."
                UIC_Fvco_FREQ.Background = brush_warning
            elif (Fvco_FREQ.dValue>2200):
                UIC_Fvco_FREQ.Background = brush_warning
                UIC_Fvco_FREQ.ToolTip="Maximum VCO Frequency is 2200 MHz." 
        
        ValidatePFDandDLD()
        UpdatePowerSettings()
    
        
    def btn_SimplifyFraction_Update_UI():
        Fnum=PLL_NUM.iValue
        Fden=PLL_DEN.iValue
    
        if  ((Fnum==0) or (Fden==0)):
            Fden=1
            Fnum=0
        else:
            Divisor = 2      
            while ( Divisor<Fnum+1):
                if (0 == (Fnum % Divisor)) and (0 == (Fden % Divisor)):
                    Fnum=Fnum/Divisor
                    Fden=Fden/Divisor
                else:
                    Divisor=Divisor+1
                    
            if (Fden%Fnum==0):
                Fden=Fden/Fnum
                Fnum=1
                  
        UpdateStatusBar("Fraction Simplified to "+str(Fnum)+"/"+str(Fden))     
        PLL_DEN.iValue=Fden
        PLL_NUM.iValue=Fnum
        
    def btn_SetupFastCal_Update_UI():
        Fvco=Fvco_FREQ.dValue
        if (Fvco<2280):
            VCOCore=0
            VCOCap=int(255.5-255*(Fvco-1827)/(2290-1827))
        elif (Fvco<2680):
            VCOCore=1
            VCOCap=int(255.5-255*(Fvco-2168)/(2743-2168))
        elif (Fvco<3220):
            VCOCore=2
            VCOCap=int(255.5-255*(Fvco-2650)/(3248-2650))
        else:
            VCOCore=3
            VCOCap=int(255.5-255*(Fvco-3126)/(3833-3126))
            
        if (VCOCap<0):
            VCOCap=0
        if (VCOCap>255):
            VCOCap=255
        
        if (VCO_SEL.iValue==VCOCore):
            UIC_VCO_SEL.Background=brush_white
            UIC_VCO_SEL.ToolTip=None
        else:
            VCO_SEL.iValue=VCOCore
            UIC_VCO_SEL.Background=brush_alert
            UIC_VCO_SEL.ToolTip="VCO_SEL was changed."
            UpdateStatusBar("VCO_SEL should be changed to "+str(VCOCore+1))
    
        if (VCO_CAPCODE.iValue==VCOCap):
            UIC_CAPCODE.Background=brush_white
            UIC_VCO_CAPCODE.ToolTip=None
        else:
            VCO_CAPCODE.iValue=VCOCap
            UIC_VCO_CAPCODE.Background=brush_alert
            UIC_VCO_CAPCODE.ToolTip="VCO_CAPCODE was changed."
            UpdateStatusBar("VCO_CAPCODE should be changed to "+str(VCOCap))      
    
        if (VCO_SEL_MODE.iValue<>1):
            UIC_VCO_SEL_MODE.Background=brush_alert
            UIC_VCO_SEL_MODE.ToolTip="Changed this to start at optimal point."
            UpdateStatusBar("Changing VCO_SEL_MODE to start at VCO_SEL Frequency.")
            VCO_SEL_MODE.iValue=1
        else:
            UIC_VCO_SEL_MODE.Background=brush_white
            UIC_VCO_SEL_MODE.ToolTip=None 
    
        UpdatePowerSettings()
    
    def Fosc_FREQ_Update():
        UpdateFpdFrequency()
        UpdateVCOFrequency() 
            
    def Fosc_FREQ_UI():    
        ValidateFrequencies()  
    
    def OSC_2X_Update():
        UpdateFpdFrequency()
        UpdateVCOFrequency() 
        
    def OSC_2X_Update_UI():
        ValidateFrequencies() 
        
    def PLL_R_Update():
        UpdateFpdFrequency()
        UpdateVCOFrequency() 
       
    def PLL_R_Update_UI():
        ValidateFrequencies()
    
    def Fpd_FREQ_Update():
        Fpd = Fpd_FREQ.dValue
        Fosc = Fosc_FREQ.dValue*(OSC_2X.iValue+1)
        if (Fpd<0.000001):
            Fpd = Fosc/PLL_R.iValue
        if (Fpd>Fosc*(OSC_2X.iValue+1)):
            Fpd=Fosc*(OSC_2X.iValue+1)
        Rdiv=Fosc/Fpd
        PLL_R.iValue=int(Rdiv+0.5)
        Fpd_FREQ.dValue=Fosc/PLL_R.iValue
        UpdateNDivider()
        UpdateVCOFrequency() 
        
    def Fpd_FREQ_Update_UI():
        ValidateFrequencies()
        
    def PLL_N_Update():
        UpdateVCOFrequency() 
            
    def PLL_N_Update_UI():
        ValidateFrequencies() 
        
    def PLL_NUM_Update():
        UpdateVCOFrequency() 
    
    def PLL_NUM_Update_UI():
        ValidateFrequencies()
        
    def PLL_DEN_Update():
        UpdateVCOFrequency() 
    
    def PLL_DEN_Update_UI():
        ValidateFrequencies()
            
    def Fvco_FREQ_Update():
        UpdateNDivider() 
        UpdateVCOGain()
            
    def Fvco_FREQ_Update_UI():
        ValidateFrequencies()
    
    def VCO_SEL_Update():
        UpdateVCOGain()
        ValidateFrequencies()
        
    def VCO_DIV_Update():
        UpdateDistribution()
        ValidateFrequencies()
        
    def OUTA_MUX_Update():
        UpdateDistribution()
        ValidateFrequencies()
        
    def OUTB_MUX_Update():
        UpdateDistribution()
        ValidateFrequencies()
           
    def OUTA_PWR_Update():
        ValidateFrequencies()
    
    def OUTB_PWR_Update():
        ValidateFrequencies()
        
    def OUTA_PD_Update():
        ValidateFrequencies()
        
    def OUTB_PD_Update():
        ValidateFrequencies()
        
    
    def FoutA_FREQ_Update():
        Fout = FoutA_FREQ.dValue
        FvcoMin=1880
        FvcoMax=3760
        if (Fout<49.47):
            Fout=50
    
        if (Fout>FvcoMin-0.001):
            OUTA_MUX.iValue=0
            Fvco_FREQ.dValue=Fout
        else:
            OUTA_MUX.iValue=1 
            DIV=2*int( (FvcoMin+FvcoMax)/(4*Fout)+0.5 )
            if (DIV<2):
                DIV=2
            if (DIV>38):
                DIV=38    
    
            Fvco_FREQ.dValue=DIV*Fout
            VCO_DIV.iValue=int(DIV/2)-1
            
        
        UpdateNDivider() 
        UpdateVCOGain()
        UpdateDistribution()
        
    def FoutA_FREQ_Update_UI():
        ValidateFrequencies()
        
    def FoutB_FREQ_Update():
        Fout = FoutB_FREQ.dValue
        FvcoMin=1880
        FvcoMax=3760
        if (Fout<49.47):
            Fout=50
    
        if (Fout>FvcoMin-0.001):
            OUTB_MUX.iValue=0
            Fvco_FREQ.dValue=Fout
        else:
            OUTB_MUX.iValue=1
            DIV=2*int( (FvcoMin+FvcoMax)/(4*Fout)+0.5 )
            if (DIV<2):
                DIV=2
            if (DIV>38):
                DIV=38    
    
            Fvco_FREQ.dValue=DIV*Fout
            VCO_DIV.iValue=int(DIV/2)-1
        
        UpdateNDivider() 
        UpdateVCOGain()
        UpdateDistribution()
    
    def FoutB_FREQ_Update_UI():
        ValidateFrequencies()
    
    def MODE_Update():
        ValidateFrequencies()
        
    def OSC_FREQ_Update():
        ValidateFrequencies()
        
    def DLD_TOL_Update():
        ValidateFrequencies()
        
    def PFD_DLY_Update():
        ValidateFrequencies()
        
    def FRAC_ORDER_Update():
        ValidatePFDandDLD()
        
    def FRAC_DITHER_Update():
        ValidateFrequencies()
        
    def UpdateVCOFrequency():
        Fnum=PLL_NUM.iValue
        Fden=PLL_DEN.iValue
        
        if (Fden<1):
            Fden=1
        N=PLL_N.iValue
        FracN=1.0*N+Fnum*1.0/Fden
        Fvco_FREQ.dValue=round(FracN*Fpd_FREQ.dValue,10)
            
        UpdateVCOGain()
        UpdateDistribution()
        pass
    
    def UpdateNDivider():
        Fvco=Fvco_FREQ.dValue
        Fden=PLL_DEN.iValue
        if (Fden<1):
            Fden=1
            PLL_DEN.iValue=1
        Fpd=Fpd_FREQ.dValue
        if (Fpd<0.0000001):
            Fpd_FREQ.dValue=1
            Fpd=1
            
        FracN=Fvco/Fpd
        N=math.floor(FracN)
        PLL_N.iValue=N
        PLL_NUM.iValue=round(Fden*(FracN-N))
        UpdateVCOFrequency()
        pass
        
        
        
    def UpdateDistribution():
        Fosc=Fosc_FREQ.dValue
        Fvco=Fvco_FREQ.dValue 
        
        CHDIV=2+2*VCO_DIV.iValue  
        Fout = Fvco/CHDIV
        
        if (OUTA_MUX.iValue==0):
            FoutA_FREQ.dValue=Fvco
        elif (OUTA_MUX.iValue==1):
            FoutA_FREQ.dValue=Fout
        else:
            FoutA_FREQ.dValue=Fosc
         
        if (OUTB_MUX.iValue==0):
            FoutB_FREQ.dValue=Fvco
        elif (OUTB_MUX.iValue==1):
            FoutB_FREQ.dValue=Fout
        else:
            FoutB_FREQ.dValue=Fosc
        pass
        
    def ValidatePFDandDLD():
        Fvco=Fvco_FREQ.dValue
        
        if (Fvco<0.001):
            Tvco=0
        else:
            Tvco=1000000/Fvco
            
        Fpd=Fpd_FREQ.dValue
        if (Fpd<0.0001):
            Tpd=0
        else:
            Tpd=1000000.0/Fpd
        
        iPFD=PFD_DLY.iValue
        if (0==iPFD):
            Tpfd=370
        elif (1==iPFD):
            Tpfd=760
        elif (2==iPFD):
            Tpfd=1130
        elif (3==iPFD):
            Tpfd=1460
        elif (4==iPFD):
            Tpfd=1770
        elif (5==iPFD):
            Tpfd=2070
        elif (6==iPFD):
            Tpfd=2350
        else:
            Tpfd=2600
    
        if (Tpfd>Tpd/4):
            UIC_PFD_DLY.ToolTip="PFD_DLY needs to be adjusted to a value less than one-fourth of the phase detector period, which is " + str(Tpfd/4)
            UIC_PFD_DLY.Background=brush_alert
        elif (PFD_DLY.iValue>0) and (FRAC_DITHER.iValue==3):
            UIC_PFD_DLY.ToolTip="Using a PFD_DLY greater than the minimum value with dithering disabled typically has no benefit and may degrade PLL phase noise."
            UIC_PFD_DLY.Background=brush_alert
        else:
            UIC_PFD_DLY.ToolTip=None
            UIC_PFD_DLY.Background=brush_white
    
        #   Validate DLD_TOL
        iDLD=DLD_TOL.iValue
        if (0==iDLD):
            Tdld=1000
        elif (1==iDLD):
            Tdld=1700
        elif (2==iDLD):
            Tdld=3000
        elif (3==iDLD):
            Tdld=6000
        elif (4==iDLD):
            Tdld=10000
        else:
            Tdld=18000
    
        if (FRAC_ORDER.iValue==0):
            Deviation=0
        elif (FRAC_ORDER.iValue==1):
            Deviation=1
        elif (FRAC_ORDER.iValue==2):
            Deviation=2
        elif (FRAC_ORDER.iValue==3):
            Deviation=4
        else:
            Deviation=8
             
        TdldMin=Deviation*Tvco
         
        if (TdldMin<1001):
            MinIndex=0
        elif (TdldMin<1701):
            MinIndex=1
        elif (TdldMin<3001):
            MinIndex=2
        elif (TdldMin<6001):
            MinIndex=3
        elif (TdldMin<10001):
            MinIndex=4
        elif (TdldMin<18001):
            MinIndex=5
        else:
            MinIndex=-1
         
        TdldMax=Tpd/2 
        if (TdldMax>17999):
            MaxIndex=5
        elif (TdldMax>9999):
            MaxIndex=4
        elif (TdldMax>5999):
            MaxIndex=3
        elif (TdldMin>2999):
            MaxIndex=2
        elif (TdldMax>1699):
            MaxIndex=1
        elif (TdldMin>999):
            MaxIndex=0
        else:
            MaxIndex=-1     
        
        BestTime=-1
        if (MinIndex==-1):
            BestIndex=0
        elif (MaxIndex==-1):
            BestIndex=5
        else:
            BestIndex=int( (MinIndex+MaxIndex)/2  )
            if (BestIndex==0):
                BestTime=1
            elif (BestIndex==1):
                BestTime=1.7
            elif (BestIndex==2):
                BestTime=3
            elif (BestIndex==3):
                BestTime=6
            elif (BestIndex==4):
                BestTime=10
            else:
                BestTime=18
                
                 
        if (MinIndex==-1):
            UIC_DLD_TOL.ToolTip="The modulator order must be reduced in order for Digital Lock Detect to work."
            UIC_DLD_TOL.Background=brush_alert
        elif (MaxIndex==-1):
            UIC_DLD_TOL.ToolTip="The phase detector freqeuncy must be reduced in order for Digital Lock Detect to work."
            UIC_DLD_TOL.Background=brush_alert
        elif (iDLD<MinIndex):    
            UIC_DLD_TOL.ToolTip="For FRAC_ORDER="+str(FRAC_ORDER.iValue)+", DLD_TOL should be at least "+str(Deviation)+" VCO Cycles, which is "+str(TdldMin)+" ps."
            UIC_DLD_TOL.Background=brush_alert
        elif (iDLD>MaxIndex):
            UIC_DLD_TOL.ToolTip="For a phase detector of "+str(Fpd)+" MHz, DLD_TOL should be no more than half of a phase detector period which is " +str(TdldMax)+" ps."
            UIC_DLD_TOL.Background=brush_alert
    
        else:
            UIC_DLD_TOL.ToolTip=None
            UIC_DLD_TOL.Background=brush_white
        
    def UpdatePowerSettings():
        if (MODE.iValue==1):
            SumCurrent=85
        else:
            SumCurrent=134
      
        if ((OUTA_MUX.iValue<>0) and (OUTA_PD.iValue==0)) or ((OUTB_MUX.iValue<>0) and (OUTB_PD.iValue==0)):
            SumCurrent=SumCurrent+20
            UnDim(VCO_DIV)
        else:
            Dim(VCO_DIV)
            
        if (OUTA_PD.iValue==0):
            SumCurrent= SumCurrent + 44 + (1.0*OUTA_PWR.iValue-15)
            if (OUTA_PWR.iValue<6):
                SumCurrent=SumCurrent-1
            UnDim(OUTA_MUX)
            UnDim(OUTA_PWR)
            UnDim(FoutA_FREQ)
        else:
            Dim(OUTA_MUX)
            Dim(OUTA_PWR)
            Dim(FoutA_FREQ)
                
        if (OUTB_PD.iValue==0):
            SumCurrent= SumCurrent + 44 + (1.0*OUTB_PWR.iValue-15)
            if (OUTB_PWR.iValue<6):
                SumCurrent=SumCurrent-1
            UnDim(OUTB_MUX)
            UnDim(OUTB_PWR)
            UnDim(FoutB_FREQ)
        else:
            Dim(OUTB_MUX)
            Dim(OUTB_PWR)
            Dim(FoutB_FREQ)
            
        Current.dValue=SumCurrent
    
        
    
    
        
    

    Regards,

    Dean