Shop OBEX P1 Docs P2 Docs Learn Events
DAC code — Parallax Forums

DAC code

DriesDries Posts: 23
edited 2009-08-22 05:18 in BASIC Stamp
Recently I bought a 12 bits DAC (MCP4921 / 8-pin) to generate a accurate voltage.
Datasheet of the MCP4921: ww1.microchip.com/downloads/en/DeviceDoc/21897a.pdf

Can anyone help me a little bit with the code to get this DAC running?
Output from DAC has to be 0-5 V.

Thanks.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dries Nelemans, Holland

Comments

  • FranklinFranklin Posts: 4,747
    edited 2009-08-21 20:11
    Well page 16 talks to the formula to find the value to send to the dac and page 18 talks to the 16 bits you need to send with shiftout to the dac and how to connect it to a micro. What is your specific question?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • DriesDries Posts: 23
    edited 2009-08-21 20:45
    The schematic how the DAC is connected to the BS2 and the command or code how to get an output of eg 1.5 volts from the DAC would be helpfull.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dries Nelemans, Holland
  • FranklinFranklin Posts: 4,747
    edited 2009-08-22 01:59
    Connect cs, sck and sdi (pins 2, 3 and 4) to three pins on the stamp. Use shiftout to send the data to the chip. Read the instructions for shiftout in the editor help pages and page 18 of the chip manual for what you need to send. Put this together and write what you think should work and try it. If it does not work attach the code you tried and we can look at it to see if we can find where it needs to be changed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • DriesDries Posts: 23
    edited 2009-08-22 05:18
    Stephen, thanks for the hints.
    I'll try to do and come back with the code if it does not work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    /Dries
Sign In or Register to comment.