Converting floating point number to Q-notation fixed point number in C/Java?
If your floating point number is X, then 

X_Q15 = 32768 * X  

if (X_Q15 > 32767)
    X_Q15 = 32767;  

if (X_Q15 &lt; -32768)
    X_Q15 = -32768;