Any library for MAX541 16 bit DAC?

I would like to use the MAX541 16 bit DAC but I could not found a libray:

I found 2 files : MAX541.cpp

and the MAX541.h

but they have not an *.ino sketch sample . From the above files how is difficult to write a demo for the IC ?

The IC datasheet : https://datasheets.maximintegrated.com/en/ds/MAX5417-MAX5419.pdf

Hint: google "arduino max541 library" to find this one.

1 Like

Try reading the *.cpp link you supplied.

You missed a complete example.

The comments in the source files include a demo program showing how to use what the *.cpp and *.h files provide for interface to the DAC.

a7

The MAX541X seems be to different ICs. MAX 5417 , 5418 , 5419 are related to digital potentiometers ....

Ok. I will try.

Sry, I think the example is in the *.h file.

a7

Thanks but it is not clear to me how could I construct the object
... begin() and so on...

Yes, I see that, I was trying to do something with it myself… :frowning:

In the absence of a library ready to go, you are back to the data sheet.

It looks like a fairly straight-ahead SPI part; the code you linked is not so long and should be a useable guide if not ready to go code.

a7

Yes. the SPI protocol must be quite common and I believe it is already resolved in the cpp and h files. I'll only have the chip to test it tomorrow. I'll try something in the sketch calling some function to see if it works... Maybe tomorrow I'll ask something again. Anyway, thank you for your clues

The below was from a very basic SPI DAC device. It did not do any configuring of the chip (defaults were OK), which you might find in the code you linked above, and it assumes the default SPI settings, which you might also verify in that code as well. If the setting are different, you can fix that, see the Arduino SPI document page.

// from basic sketch.

#include <SPI.h>

const int slaveSelectPin = 10;

void setup() {
  pinMode(slaveSelectPin, OUTPUT);
  
  SPI.begin();
}

unsigned int cUp;

void loop() {	

  dacWrite(cUp);
  
  cUp++;
  
  delay(15);  // for now just to see it.
}

void dacWrite(unsigned int value) {

  digitalWrite(slaveSelectPin, LOW);

  SPI.transfer16(value);
  
  digitalWrite(slaveSelectPin, HIGH);
}

HTH

a7

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.