digital filter

1. digital filter

Hi
I want to calculate this expression:

y_n=(b0*x_n)+(b1*x_n_1)+(b2*x_n_2)+(b3*x_n_3)

-(a1*y_n_1)-(a2*y_n_2)-(a3*y_n_3)
That:

x_n;x_n_1;x_n_2;x_n_3;y_n;y_n_1;y_n_2;y_n_3;a1;a2; a3;b0;b1;b2;b3
are variables and their type is Word.

Infact I want to use this equation for implementing a digital filter
maximum order of filter is 3.
I must input a1;a2;a3;b0;b1;b2 and b3 from keyboard.These valuse can be
negative or positive.I use PICBasic Pro compiler and PIC16F877 MCU.I am a
beginner therefore I get in to trouble;My problems are:

1-I know that pbp uses unsigned integers but I want to input

2-Suppose that the result of (b0*x_n)+(b1*x_n_1)+(b2*x_n_2)+(b3*x_n_3)
has overflow because type of my variables is word how I can prevent
this event.

3-Suppose that the coefficients are float for example a1=0.2
a2=6;a3=-0.6 In this case how I can calculate above equasion.

Any suggestion would be helpful for me specially number 1 and 3 questions.
Thank you very much.

2. I suggest you to make Moving Average Filter. It is expecially suited for microcontroller application.
It is very fast and very effective.