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;
//-------------------
}