1 members found this post helpful.
Re: Les's wav player& sd library
When using large arrays. i.e over 256 elements. You will need to access them indirectly using either the FSR0L\H or FSR1L\H or FSR2L\H registers and INDF0, POSTINC0 registers etc...
This is also the most efficient method of using RAM buffers, and without it, the code will take precious time re-calculating the index of the array every time it accesses it.
The method I used within the interrupt is two arrays of 512 bytes each (1 sector), working as a double buffer. I think I chose INDF2 because it is only ever used by the compiler when a stack is created and Push or Pop is used, thus allowing me a little more time saving in not having to context save or restore the register pair FSR2L\H.
The double buffer was required in order to remove the time delay between accessing the bytes of audio via the FAT16 calculation. While the FAT16 calculations is filling one buffer, the other is being played and vice-versa.