I2C code to write the DAC MCP4725


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Aug 2011
    Posts
    453


    Did you find this post helpful? Yes | No

    Default Re: I2C code to write the DAC MCP4725

    Code:
    addr var byte
    addr = $C0 ;$60 <<1
    
    writedac4725:
    I2CWRITE sda,scl,addr,[4000] '12 bit value
    PAUSE 10 ' Wait 10ms for write to complete
    That'll do a fast-mode write to the DAC register as long as the "12-bit value" is <4095, so you could remove the 'PAUSE 10'.
    If the upper control bits are '01x' then it'll possibly write to the DAC + EEPROM, depending on the actual value.

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,115


    Did you find this post helpful? Yes | No

    Default Re: I2C code to write the DAC MCP4725

    Isn't necessary the control byte?

    Ioannis

  3. #3
    Join Date
    Aug 2011
    Posts
    453


    Did you find this post helpful? Yes | No

    Default Re: I2C code to write the DAC MCP4725

    In fast mode (with the upper two bits 00) you only need two bytes.
    If you want to use the EEPROM function you need all three bytes.

    Of course, both modes need the address byte too.
    Last edited by tumbleweed; - 13th November 2023 at 16:44.

Similar Threads

  1. PicBasic Pro code to drive MCP4291 DAC?
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 14th July 2015, 03:28
  2. I2C Read and Write
    By DerekMacom in forum mel PIC BASIC
    Replies: 14
    Last Post: - 21st April 2008, 15:44
  3. I2C write - value too big
    By ruijc in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 6th April 2008, 13:20
  4. i2c with a dac
    By fabritio in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 29th March 2006, 17:13
  5. I2C write
    By TonyCNC in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd January 2006, 10:40

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts