Hey guys,
I need to set up an interrupt which sends a couple bytes out to my DAC at a high rate of speed. I was looking at the Audio Shield source to figure out how to do this since I know nothing about interrupts, and from what I understand it's using timer 1 which is a 16-bit timer. I also understand that the Servo library also uses timer 1.
I am aware that there is a timer 2 which I could also use, but that one is 8-bit.
Here's what I need to know:
- What is the difference between an 8-bit and a 16-bit timer? Does one trigger faster, or with more precision?
I need my DAC to be updated X number of times per second, where that value may be anywhere from 22,000 to 44,000. I have already got hardware SPI code up and running so I can write it as fast as possible, but updating it each time through my main loop doesn't cut it for updating it fast enough and on time. So if 8-bit means I have a coarse selection of speeds to which I can set the timer, that might be okay since I don't need to vary it. But if it means it can't be updated more than 256 times a second or something... that would be bad.
-
TIMER1_COMPA_vect is the constant I need to use to attach to timer 1... is TIMER2_COMPA_vect the constant for timer 2? What does the COMPA_vect bit mean?
-
I think I saw the term vector used somewhere. Is that another word for an interrupt?
-
I think I read you can chain interrupts. Do you suppose I could chain the servo and DAC update code? How does one accomplish that?
-
Do interrupts trigger at a fixed speed? Or is there a way to set how fast the timers trigger? I don't see in the Audio shield code where a speed might be set.
-
What's with the ISR(TIMER1_COMPB_vect) in the Audio shield code which fills the play buffer? Is there more than one interrupt you can attach to for each timer?