MCP48FVB22 SPI DAC code example?

Author
twelve12pm
Super Member
  • Total Posts : 222
  • Reward points : 0
  • Joined: 2012/04/09 17:27:24
  • Location: 0
  • Status: offline
2018/02/14 09:09:52 (permalink)
0

MCP48FVB22 SPI DAC code example?

Is there some example code (doesn't matter which MCU it is for) that shows how to setup the MCP48FVB22 configuration registers and how to output various analog voltages? I'm just looking for a simple example to get started. Thanks.
#1

1 Reply Related Threads

    twelve12pm
    Super Member
    • Total Posts : 222
    • Reward points : 0
    • Joined: 2012/04/09 17:27:24
    • Location: 0
    • Status: offline
    Re: MCP48FVB22 SPI DAC code example? 2018/02/14 15:10:10 (permalink)
    0
    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.
    #2
    Jump to:
    © 2018 APG vNext Commercial Version 4.5