Scaling PID (Proportional Integral Derivative) Output
You need to handle two issues:


arithmetic overflow
integrator windup


The arithmetic overflow is fairly straightforward -- whenever you're doing integer math, make sure that you use larger-width intermediate values: for example, if a and b are 16-bit, and you add/subtract them, use a 32-bit intermediate value, and limit it to the range of a 16-bit value (0 to 65535 for unsigned, -32768 to 32767 for signed) before casting back down to 16 bits. If you are absolutely sure that you can never get overflow, because you are absolutely sure of the ranges of the input variables, then you can skip this step, but beware.

The integrator windup issue is more subtle. If you have a large error for an extended period of time, so that you reach the saturation limit of your controller output, but the error is still nonzero, then the integrator will keep on accumulating error, possibly getting much larger than it should to achieve steady-state. Once the controller comes out of saturation, the integrator has to come back down, causing unnecessary delay and possibly instability in your controller response.



On another note:

I would strongly recommend (yeah, I know this question is 18 months old, so you're probably done with your task, but for the benefit of readers let's pretend it isn't) that you calculate the integral term differently: Instead of Ki * (integrated error), calculate integral of (Ki*error). 

There are several reasons for doing so; you can read them in a blog post I wrote about how to implement PI controllers correctly.