Reason I ask is because I'm thinking about changing timer1 and writing my own code for PWM on pin 9 - OC1A. I know SPI uses OC1B - pin 10. Both are tied t timer1. I haven't looked into the exact SPI code, but I have a feeling that it will get very complex very quick.
Actually the SPI code is quite simple! SPI has nothing to do with the timer, and using pin 10 as slave select is optional, another pin can be used instead. Pin 10 is the input slave select pin for SPI operating in slave mode and that can't be changed, but the Arduino SPI library is an SPI master library only.
So changing ICR1 (interrupt control register 1) won't have any affect on the SPI code? Awesome! That's great news to hear right now!
I've been looking at low level servo stuff for a while, so I figured I'd have to look at low level SPI meant being in registry land for several hours... >.<
Just to make sure, input slave means that if there was a master, I'd connect the slave select to this pin, correct? I'm using an Arduino ethernet and I'm talking to said Arduino via ethernet so I believe I wouldn't want to mess with it.
ukeri:
So changing ICR1 (interrupt control register 1) won't have any affect on the SPI code? Awesome! That's great news to hear right now!
ICR1 is the Input Capture Register, not "interrupt control" ... what are you looking at exactly? Which Arduino do you have?
I've been looking at low level servo stuff for a while, so I figured I'd have to look at low level SPI meant being in registry land for several hours... >.<
Oh less than an hour
Just to make sure, input slave means that if there was a master, I'd connect the slave select to this pin, correct? I'm using an Arduino ethernet and I'm talking to said Arduino via ethernet so I believe I wouldn't want to mess with it.
Assuming you have an Uno or something similar, the SPI hardware can act either as an SPI master device or as an SPI slave device. The Arduino library only implements SPI master, not SPI slave. But a person could write SPI slave code. Every SPI device has a slave select pin. If the Arduino SPI hardware is in slave mode, then its slave select pin must be pin 10 (PB2), that's all I was saying. So most likely it's a non-issue.
I know with timer1 I can use it in several modes. All the modes give a different "top" to the PWM. The neat thing is that you can use ICR1 as one of the tops which can increase/decrease the desired frequency of the servo control. I did some math and found out what I need to set ICR1 to (0x0271) for a 50 Hz pulse train.
I am using an Arduino Ethernet. I posted a while back -http://forum.arduino.cc/index.php/topic,156989.0.html - asking if I needed all the SPI pins or I could overwrite some of them. What I got out of it was don't mess with those pins, just let them be. I solved that problem by using more analog pins as a digital outputs which worked for me.