I am trying to generate a sawtooth wave by providing digital bytes from 0 to 255 to an external DAC. I have successfully done that, but right now I'm trying to be able to dynamically change the frequency of the signal. I'm doing this by shifting out the bits to the DAC using the shiftout() function. The function is called on an interrupt using timer1. The problem is I think this is slowing down my code and once I get to about 600 Hz sawtooth wave, the signal is essentially a mix of a square wave and noise.
I want to write some low level code to map the registers directly rather than using the shiftout() function. Any ideas/suggestions/tips/etc? Been trying to find documentation on how the shiftout() function works from a low level perspective so I can essentially rewrite it.
Thanks in advance,