I am trying to implement PI control algorithm in c#. I found some help in internet and i understand the formula how to use. I have measured value(PV)= 20 °C  and set point (SP)= 80°C; I would like to update every 2 sec in time. once the measured value reach to setpoint the controller has to switch off like that.

I found this code [link to pid algorithm][1]

but what i need is how to calculate gain factors Kp and Ki gains as well as what about dt. I am neglecting Derivative. So please can anyone explain me how to calculate those gain factors. I am using shimaden SR90 digital controller(i bought this). I found some factors in the manual but i am not sure can i use those gain factors. 


  [1]: http://www.codeproject.com/Articles/36459/PID-process-control-a-Cruise-Control-example

> Added code according to answer.

    int temperature;
    int setpoint;
    int status = 0;
    int pulses = 0;
    int integral = 4;
    int derivative = 5;
    int upperTemp = 1000; //100.0C
    int upperLimit = 100; //pulses per time frame

    //WITH PULSING
    runtime //make a timer that runs and updates temperature value...lets say every second
    {
      read temperature; //every second
      temperature *= 10; //multiply by 10 for decimal place, but still keeping in integer
      pulses = map(temperature, upperTemp, 0, 0, upperLimit); //when temperature increases, 
															                   
           //pulses decreases...vice versa
	  //take this value of pulses to update the timer interval
	  //timer's interval = pulses per second or minute
     
    }
	
	timer
	{
	  if(Relay On)
		Relay Off;
	  else
	    Relay On;	
	}

    //borrowed from arduino
    long map(long x, long in_min, long in_max, long out_min, long out_max)
    {
      return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
    }