How to find the fundamental frequency of a discrete signal using partial autocorrelation? I hope you can help me with this question.

I am trying to calculate the fundamental frequency (to know the beats per minute) of a cardiac pulse signal using partial autocorrelation.
I use a 12-bit ADC and taking 4096 samples at Fs=512 Hz.

Heres what I'm trying:

First I do an offset of -2048 to align the signal to 0 (since the ADC gives me values from 0 to 4096).



Then I multiply it by the Hamming window wich I calculated as 

$$ w[n] = 0.54 - 0.46 \cos \left(2 \pi \frac{n}{N} \right) $$



To get this



Then I do the partial autocorrelation like this.

$$ C_{xx}[n] = \frac{1}{N} \sum\limits_{m=0}^{N-1-n} x[m]x[m+n] $$



And finally I look for the maximum peak (that is not in the 0 position).

In this case I'm getting the maximum value at $n$ = 506.

But I don't know what to do with that index of the maximum of 506 if what I'm trying to get are the beats per minute.

Thanks you for your help.
Very simple: your sampling rate is 512Hz and your sample time is the inverse of this: about 1.953 ms. Multiply with 506 and you get the time length of the fundamental: 0.988s.

So you have one beat every 0.988s which is 1.0119Hz or 60.711 beats per minute.