Try using a for loop with 16 wired to the N terminal and use a shift register (initialized to 0) for the sum. In each iteration, add p[n-k+1]*(16-k+1) to the value of the shift register. As you already have the function p[n], this should be straightforward.
EDIT: a little hint: as the loop counter is 0-based, you might have to add +1 to i in order to get your k.
Message Edited by dan_u on 09-22-2006 12:01 AM