Re: MCP48FVB22 SPI DAC code example?
Nevermind. It was pretty straightforward to implement.
I did encounter one problem. To test my code, I wrote a "slanted line" test. This test cycles through all the possible 4096 DAC values repeatedly, which causes a slanted line to be shown on the oscilloscope. I was getting a messed up jagged line instead. Also, only DAC0 was working. DAC1 was not.
The cause of these troubles turned out to be my SPI settings. I had it on clock polarity 0, phase 1 (SPI mode "1"). Changing phase to 0 (SPI mode "0") fixed the problem.