Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   I am in need of some assistance (http://www.go4expert.com/forums/i-assistance-t4451/)

boschow 28May2007 12:45

I am in need of some assistance
 
Hi guys,
i recieved a code from an old programer, the part of the code looks like this:
Code:

void set_PID_i_factor(UINT8 PID_number,UINT16 timeMS)
{
    UINT8 vrsta = PID_number;
    UINT16 barka;
    UINT32 temp_i = (UINT32)izpisi16(nvvar,set_PID_p_factor(PID_number)) * timeMS; // what does this part of the code do ? i dont get it . . . :(
    switch(PID_number){
      case 0:
          barka = aGS_RTKC_I_WP;
          break;
      case 1:
          barka = aGS_RTKH_I_WP;
          break;
      case 2:
          barka = aGS_RTPK_I_WP;
          break;
      case 3:
          barka = aGS_RTPF_I_WP;
          break;
      case 4:
          barka = aGS_RTPC_I_WP;
          break;
      case 5:
          barka = aGS_RTPH_I_WP;
          break;
    }

    barka = izpisi16(nvvar,barka); // // what does this part of the code do ? i dont get it . . .  :(
    if(!barka) pid_data[vrsta].i_fact = 0;
    else {
        temp_i = temp_i * 256 /barka;
        pid_data[vrsta].i_fact = temp_i; // /10;
    }
}

I understood that barke is equal to parameter_I_value and that vrsta is equal to PID_number. I dont understand why he delared vrsta and then set the value of vrsta with the value that has PID_number. Isnt it easyer to use just PID_number?

Thanks for your help,
best regards,
BoSCHoW.


All times are GMT +5.5. The time now is 16:17.