problem with pid output rang

Hi every one
I am having a little problem with a PID code which I tried to implement.
I am trying to control a motor with encoder when my goal is to rotate the motor for 4000 points of the encoder, I want that the movement of the motor during is work will be under pid control, by controlling the value of the pid (kip, ki, kd) I will be able to control the overall time of the Sycle.
My problem is that when I run the code it works ok but the output of the PID to the motor is either 0 or 255 which mean on /off control.
I would be very happy if someone could explain me how I change the output so it will be a range between 0 to 255.
Thank you in advance
eyal rabin

I am having a little problem with a PID code which I tried to implement.

The code you didn't post?

My problem is that when I run the code it works ok

Why is that a problem?

I would be very happy if someone could explain me how I change the output so it will be a range between 0 to 255.

Change line 38.

If we could see your code it would help us to tell you where it needs altering.

I also note that you have started two topics on the same theme, this is frowned upon on this forum.