Go Down

Topic: Help tweaking PCM audio example (Read 308 times) previous topic - next topic

paulsoulsby

I have successfully got the PCM audio example working:
http://playground.arduino.cc/Code/PCMAudio

However I want to use the SPI library to control a MCP23S17 (16bit I/O expander). 
http://arduino.cc/en/Reference/SPI

The SPI library has to use pins 10,11,12 & 13 to connect to the MCP23S17.  However, the PCM audio example also outputs on pin 11.  Does anyone have a link to a reference table for all the constants used in the PCM example to setup the registers (e.g. COM2A1, COM2A0 etc).

Am I correct in thinking that if I change these constants, I should be able to use one of the PCM pins lower down the board (pin 3,5 or 6) instead of 11?

thanks
Paul

Nick Gammon

If you configure it correctly you should be able to user Timer 2 "B" output (pin D3).

Some stuff about timers:

http://www.gammon.com.au/forum/?id=11504


Or you could use the USART in SPI mode to get the SPI going (if you don't mind not using the Serial output).

http://www.gammon.com.au/forum/?id=10892&reply=3#reply3


paulsoulsby

Wow, your page on interrupts is amazing!  I can't use the serial, but I can use pin D3, so guess the quick fix is to swap the COM2As for COM2Bs and vice versa in the Timer 2 setup.  I'll try and use your helper library soon though.  Will make the whole thing a lot easier! :)

Go Up