drocobeth:
now the problem here is. i am unable to understand how should i apply PD controller in such way that i get the exact pwm value required to achieve the rpm i want as my rpm ranges from 0 to 270 but it does not vary linearly with the PWM value? so how can i write the code to get the exact pwm value so that i can achieve the required rpm?
Might need to consider the PWM frequency being used. And may need to consider what wire resistances etc you have between your voltage supply and your motor terminals etc.