PID control the pwm speed question

Hi, If I want to set the PID output from 0 to 100 when error goes from 48 to 0. can I write: PID_output(-100/48*error+kd*(error-last_error)+ki*error_sum)+100? Because I want to decrease the PWM speed by pwm_speed=initial_speed-PID_output

OR just directly set the PID_output to PWM speed? Like:pwm_speed=error*100/48+kd*(error-last_error)+ki*error_sum??