void sspISR(void)
{
unsigned char c;
c = SSPMIS;
SSPICR = 0x03; // Reset INT errors
left.b8[0] = *pcm_play_ptr++;
left.b8[1] = *pcm_play_ptr++;
right.b8[0] = *pcm_play_ptr++;
right.b8[1] = *pcm_play_ptr++;
left1.b8[0] = *pcm_play_ptr++;
left1.b8[1] = *pcm_play_ptr++;
right1.b8[0] = *pcm_play_ptr++;
right1.b8[1] = *pcm_play_ptr++;
SSPDR = left.b16[0];
SSPDR = right.b16[0];
SSPDR = left1.b16[0];
SSPDR = right1.b16[0];
if(pcm_play_ptr > (unsigned char *)PCM_BUFFER_END)
pcm_play_ptr = (unsigned char *)PCM_BUFFER_START;
VICVectAddr = 0; // Update VIC priorities
}
Listing 1—Take a look at
the interrupt service routine for the Tx FIFO half empty interrupt. The sequence
of four 16-bit words is written into the transmit register from the PCM buffer.
The data in the buffer comes either directly from the wave file or from the output
of the MP3 decoding function.