Code Monkey home page Code Monkey logo

mcp4725's Introduction

README.md

MCP4725 DAC project in C, C++, C#

This is part of a project I'm working on with a rasberry pi to learn how to utilized and program an MCP4725 12-bit DAC.

I give original credit to Lewis Loflin as he, once again, was able to figure out the registers and write an initial C program.

As opposed to an ADC, this one is much simpler. You simply load your registers and send them out. The current C program runs a loop to increase the output of the DAC from 0 to 4096 (12-bits).

It is interesting to note that in the program, in order for the 12 bits loaded in a 16 bit integer, one must shift it right and then left in order to get the 8-bit MSB and LSB registers to share the number. (or, is that shift left and then right?).

The program works as written. Check there for details.

I am also currently working on porting this same routine to other languages. C# (.NET) will show up soon, followed by C++, and maybe Go, in the future.

The existing C coded program works two ways:

If you don't supply a value between 0 - 4096, it runs a test loop from 0 - 4096 with a test output of values sent to the registers.

If you supply a command line argument, it sets the MCP4725 to that level.

Example: MCP4725set 2048

The actual voltage output is determined by VCC of the board.
For the raspberry pi, that is 3.3VDC. I'll have to work on something to make it do an industry standard of 0-5VDC or 0-10VDC.

mcp4725's People

Contributors

tardisgallifrey avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.