- Netduino Forums
- → gnomathibus's Content
gnomathibus's Content
There have been 13 items by gnomathibus (Search limited from 16-June 23)
#23968 Extend PWM output
Posted by
gnomathibus
on 08 February 2012 - 02:03 PM
in
Netduino 2 (and Netduino 1)
#24012 Extend PWM output
Posted by
gnomathibus
on 09 February 2012 - 10:41 AM
in
Netduino 2 (and Netduino 1)
#27377 Use MAX521 DAC with i2c
Posted by
gnomathibus
on 16 April 2012 - 02:02 PM
in
Netduino Plus 2 (and Netduino Plus 1)
I want to use a MAX521 in I2C with my Netduino, I use the class I2CBus found on the forum, but I am having dificulties with the function to write a value to a regitre
here is my code:
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() { //Send command write Full Power DAC0 I2CBus.GetInstance().Write(_slaveConfig, new byte[] { 0x07 , 0x00 }, TransactionTimeout); I2CBus.GetInstance().Write(_slaveConfig, new byte[] { 0xFF }, TransactionTimeout); } } }
in fact I try to do a translation of an existing library for Arduino, but since I'm a beginner it was not easy for me
The link from the site of the library MAX520 / 1 for Arduino
and the to linkthe documentation of the IC
Sorry for my poor English I use Google to translate if someone could help me it would be super cool!
#27393 Use MAX521 DAC with i2c
Posted by
gnomathibus
on 16 April 2012 - 07:10 PM
in
Netduino Plus 2 (and Netduino Plus 1)
I in my promgram instantiates as:
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 Max = new Maxdacdevice(0x2A); Max.write(); while (true) { led.Write(true); Thread.Sleep(250); led.Write(false); Thread.Sleep(250); } } } }
The first write statement writes zero to DAC7. Is this right?
What should the second write statement do?
I2CBus.GetInstance().Write(_slaveConfig, new byte[] { 0x07 , 0x00 }, TransactionTimeout);
I2CBus.GetInstance().Write(_slaveConfig, new byte[] { 0xFF }, TransactionTimeout);
As I said in my topic I used the existing Arduino library that works fine as an example for me is a 0x07 B00000111 "Bitwise"? , 0x00 DAC0 and 0xFF has a full power
here the example of the library in Arduino Cpp:
maxdac::maxdac(byte address) //address should be 7 bits { Wire.begin(); _address = address; } void maxdac::write(int port, int value) //port is 0-7 for MAX521 and 0-3 for MAX520 { Wire.beginTransmission(_address); //tell the device we are ready to begin transmitting Wire.send((B00000111 & port)); //use some BitWise "&" to combine the command to write to a port with the port you wish to write to Wire.send(value); //send the actual value to the port Wire.endTransmission(); //stop communication }
thank you again !
#27401 Use MAX521 DAC with i2c
Posted by
gnomathibus
on 16 April 2012 - 07:48 PM
in
Netduino Plus 2 (and Netduino Plus 1)
![:(](http://forums.netduino.com/public/style_emoticons/default/sad.png)
#27482 Use MAX521 DAC with i2c
Posted by
gnomathibus
on 17 April 2012 - 07:59 PM
in
Netduino Plus 2 (and Netduino Plus 1)
![:)](http://forums.netduino.com/public/style_emoticons/default/smile.png)
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); } } } }
#28083 NeonMika.Webserver
Posted by
gnomathibus
on 25 April 2012 - 10:50 AM
in
Project Showcase
![:)](http://forums.netduino.com/public/style_emoticons/default/smile.png)
#28097 NeonMika.Webserver
Posted by
gnomathibus
on 25 April 2012 - 07:03 PM
in
Project Showcase
#28104 NeonMika.Webserver
Posted by
gnomathibus
on 25 April 2012 - 09:22 PM
in
Project Showcase
#28291 NeonMika.Webserver
Posted by
gnomathibus
on 29 April 2012 - 12:30 PM
in
Project Showcase
![;)](http://forums.netduino.com/public/style_emoticons/default/wink.png)
#28310 NeonMika.Webserver
Posted by
gnomathibus
on 29 April 2012 - 08:40 PM
in
Project Showcase
#28508 NeonMika.Webserver
Posted by
gnomathibus
on 03 May 2012 - 08:20 PM
in
Project Showcase
#28766 NeonMika.Webserver
Posted by
gnomathibus
on 10 May 2012 - 08:55 AM
in
Project Showcase
- Netduino Forums
- → gnomathibus's Content
- Privacy Policy