What I'm trying to do is translate the frequencies into the corresponding note and have them displayed over an LCD screen.
That's a different task. That probably involves an array of notes that holds two ASCII values, (one for the note , one for the octave).
You probably need another array that holds the index values of the arrays that hold the note/octave and you probably have to
do a similar thing with those with a FOR loop to COMPARE "D5" with the array that holds the indexes for the note/octave array.
There are a finite number of keys on an eight octave piano keyboard so if you list them from lowest note to highest and assign a number to them then you wind up with an array of 88 (0 to 87) values. Those values hold the location of the 88 two-value arrays that contain the ASCII values (like "D" & "5" (D=0x44)(5=0x35) so "D5" array contains (0x44,0x35). When your freq2note function returns "D5" by checking lower limit and upper limit of a note against the sample, the notecounter variable should be incremented each pass through the FOR loop so when you find a match, the notecounter variable contains the index of the note/ASCII array
(0 to 87).