P is defined as byte, but referred as bit?
Edit: what if you display the data you receive, pause a few seconds, then continue. Confirm you're getting data as you expect it.
Edit 2: Does your array start at 0 or 1? (Haven't coded in a while).
Only 17 entries for temp, missing #17.
Robert
Bookmarks