Thank you very much for your help Guido, but I solved my problem in the afternoon if I had not put pull-up resistor to the SDA and SCL ports on my arduino while I did not need to Max521 one, here is the wiring diagram that works impeccably well now and for me and my code snippet
using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
using NetduinoPlusTesting;
namespace Maxdac
{
public class Maxdacdevice
{
private I2CDevice.Configuration _slaveConfig;
private const int TransactionTimeout = 3000; // ms
private const byte ClockRateKHz = 100;
public byte Address { get; private set; }
public Maxdacdevice(byte address)
{
Address = address;
_slaveConfig = new I2CDevice.Configuration(address, ClockRateKHz);
}
public void write(byte port, byte value)
{
I2CBus.GetInstance().Write(_slaveConfig, new byte[] { (byte)(0x07 & port), value }, TransactionTimeout);
}
public void reset()
{
I2CBus.GetInstance().Write(_slaveConfig, new byte[] { (byte)(0x10) }, TransactionTimeout);
}
public void shutDown(Boolean shutdown)
{
if (shutdown == true)
{
I2CBus.GetInstance().Write(_slaveConfig, new byte[] { (byte)(0x08), (byte)(0x00) }, TransactionTimeout);
}
else
{
I2CBus.GetInstance().Write(_slaveConfig, new byte[] { (byte)(0x00), (byte)(0x00) }, TransactionTimeout);
}
}
}
}
and the progam
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
using Maxdac;
using NetduinoPlusTesting;
namespace NetduinoPlusApplication5
{
public class Program
{
public static void Main()
{
// write your code here
OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
Maxdacdevice Max1 = new Maxdacdevice(0x2A);
Maxdacdevice Max2 = new Maxdacdevice(0x29);
Max1.reset();
Max2.reset();
Thread.Sleep(500);
//Set FULLPOWER to MAX521 Adress(0x2A) DAC04
Max1.write(4,255);
//Set FULLPOWER to MAX521 Adress(0x29) DAC01
Max2.write(1, 255);
Thread.Sleep(5000);
//resets all registers to off
Max1.reset();
Max2.reset();
Thread.Sleep(5000);
//shuts down the DAC into power save mode
Max1.shutDown(true);
Max2.shutDown(true);
Thread.Sleep(5000);
//wakes the DAC. Any write command will also wake the DAC from power save mode
Max1.shutDown(false);
Max2.shutDown(false);
Thread.Sleep(5000);
//Set HALFPOWER to MAX521 Adress(0x2A) DAC04
Max1.write(4, 127);
//Set HALFPOWER to MAX521 Adress(0x2A) DAC01
Max2.write(1, 127);
Thread.Sleep(5000);
while (true)
{
led.Write(true);
Thread.Sleep(250);
led.Write(false);
Thread.Sleep(250);
}
}
}
}