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.

TMS320F28035: TMS320F28035 Lab5 example

Part Number: TMS320F28035


I have a question on lab5 example located at "C:\ti\DPS Workshop_release v2\Workshop\DPS_Workshop\Lab5"

Can anybody tell me how Vref is calculated in this example. I see that it is calculated inside the function below but how/why:  Vout1SetSlewed is set to 2093568 , Vout2SlewRate is set to 25600.  

void A2(void)   // Slew Rate
//-----------------------------------------------------------------
{    
// This is an example code for implementing the slew rate control in
// a slower state machine instead of implementing it in the ISR.
// VoutXSlewRate should be set as a positive value
Vout1_slew_temp = Vref1 - Vout1SetSlewed;

if (Vout1_slew_temp >= Vout1SlewRate) // Positive Command
{
    Vout1SetSlewed = Vout1SetSlewed + Vout1SlewRate;
}
else
    {
    if ((-1)*(Vout1_slew_temp) >= Vout1SlewRate) // Negative Command
        {
        Vout1SetSlewed = Vout1SetSlewed - Vout1SlewRate;
        }
    else    Vout1SetSlewed = Vref1;
    }

Vout2_slew_temp = Vref2 - Vout2SetSlewed;

if (Vout2_slew_temp >= Vout2SlewRate) // Positive Command
{
    Vout2SetSlewed = Vout2SetSlewed + Vout2SlewRate;
}
else
    {
    if ((-1)*(Vout2_slew_temp) >= Vout2SlewRate) // Negative Command
        {
        Vout2SetSlewed = Vout2SetSlewed - Vout2SlewRate;
        }
    else    Vout2SetSlewed = Vref2;        
    }

    //-------------------
    //the next time CpuTimer0 'counter' reaches Period value go to A1
    A_Task_Ptr = &A3;
    //-------------------
}

  • Hi Farid,

    Vref is calculated as follows:

    Vref1 = ( (long) Gui_VSet1 * (long) iK_Vout1) >> 5;

    where Gui_VSet1 is the physical voltage in Q11 i.e. for 2V this value = 2*2^11 and iK_Vout1 is specified in the "OutputVoltageScaling" tab of DPSWorkshop-Calculations.xls in the doc folder. 

    Based on the calculations spreadsheet and these values you can work out how the slewrate value of 25600d translates to a physical voltage value.

    I hope this helps.

    Hrishi

  • I would very much appreciate it if someone can give me a copy of Biricha sample code discussed in this app note: "Digital Peak Current Mode Control With Slope Compensation Using the TMS320F2803x"

    Thanks!
  • I would very much appreciate it if someone can give me a copy of Biricha sample code discussed in this app note: "Digital Peak Current Mode Control With Slope Compensation Using the TMS320F2803x"
  • Thank you for your reply!

    I looked at the spreadsheet and I cant see any match between Vout2SetSlewed = 2093568 and V=4V.

    line 266 of lab5.
    volatile long Vout1SetSlewed = 2093568, Vout2SetSlewed = 2093568; // Slewed set point for the FB voltage loop - start from 4V

    Also Vref is supposed to be a fixed value that the user expect, but in this example this Vref value equal to average of 8 sample readings from the ADC raw data. Any comments on this as well?
  • Farid,

    Sorry for the delay in replying. Are you still looking for an answer to this question? I believe the comment in the code of the value 2093568 corresponding to 4V is a typo. 

    Have you tried to run this code on the board yet? A lot of these things will get clear once you do.

    Good luck!

    Hrishi