Firstly your FIR LPF design depends on factors such as sampling rate, maximum frequency, cut off frequency, bandwidth and impulse response. For generating your impulse response, you can use sinc function.
Read about sinc function :- http://www.dspguide.com/ch11/2.htm
Read about Low Pass Filter :- http://www.analog.com/media/en/technical-documentation/dsp-book/dsp_book_Ch16.pdf
Based on your question, I understand that your asking how to select the cut off frequency with respect to the sampling rate. If that's the case, I will give a brief about it with an example.
So, consider an input signal with a sampling rate of 1000sps. Lets assume that we want to pass frequencies only up to 100Hz and block the higher frequencies those are above 100 Hz. So, now your cut off frequency is 100 Hz. Note that your selected cut off frequency must be below the maximum frequency present in the signal. Mathematically:
We know that, Sampling Rate ,
F_s = 1000 sps
Then the maximum frequency is given by,
F_max = F_s/2 = 1000/2 = 500 Hz
So, from above, we know that the maximum frequency present in the signal is 500 Hz, therefore , your selected cut off frequency must be below 500 Hz to avoid aliasing. So, In general, the value of your cut off frequency must be of the value between 0 to 0.5. Since the normalized sampling frequency value is 1 and 0.5 represents half of the sampling rate i.e. 500 in this case.
In our example, we have selected a cut off frequency of 100 Hz, so Mathematically:
cut off frequency, F_c = 100/1000 = 0.1 ---> Less than 0.5 i.e. 500 Hz
And, just for the understanding purpose, what If we had selected the cut of frequency as 600 Hz instead of 100 Hz?. Lets calculate and see.
F_c = 600/1000 = 0.6 -----> Greater than 0.5
In the above, we can see that the cut off frequency selected is greater than 500 Hz and this will create aliasing. So to avoid this, we always select F_c to be less than 0.5.
However, additional factors such as transition bandwidth and impulse response length must also be considered when designing your FIR LPF.
Now coming to down sampling, It basically means your dropping some samples from the existing one's to reduce the number of samples present in your output signal. I will just present a simple down sampling code for you to get some idea:
int M; // sampling factor - integer value
int N = 1024;
double *inputsignal[N]; // generate input signal/data using sin function
double *outputsignal[N]; // To accumulate the downsampled signal
int input_samplerate; // input signal sampling rate
int output_samplerate; // desired output signal sampling rate
int set_input_output_samplerate(); //function to set rate & calc factor
int downconvert();
int set_input_output_samplerate()
{
M = input_samplerate/output_samplerate; // for 100/50 = M = 2
return M;
}
int downconvert()
{
int index = 0;
for(int i =0 ; i<input_samplerate/M ; i++)
{
outputsignal[index++] = inputsignal[i*M]; //drop 2 samples from input for each iteration and copy the data to output array and increment it
}
}
int main()
{
call set_input_output_samplerate(); //call function to set rate & calc M
call downconvert(); // call function to downsample
}
Note : The above code is only for downsampling by integer factors and it does not include for filtering. So, you have to low pass filter your signal before downsampling it using the above. I hope this helps.