I am in need of some assistance

Discussion in 'C' started by boschow, May 28, 2007.

  1. boschow

    boschow New Member

    Joined:
    Feb 22, 2007
    Messages:
    32
    Likes Received:
    0
    Trophy Points:
    0
    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; /[COLOR="Red"]/ what does this part of the code do ? i dont get it . . . [/COLOR] :(
        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); // // [COLOR="Red"]what does this part of the code do ? i dont get it . . .[/COLOR]  :(
        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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice