GY-63_MS5611/libraries/DAC8551
2023-09-23 17:02:25 +02:00
..
.github 0.2.6 DAC8551 + github actions 2023-02-09 11:33:52 +01:00
examples 0.2.7 DAC8551 2023-09-23 17:02:25 +02:00
test 0.2.5 DAC8551 2021-12-15 12:34:24 +01:00
.arduino-ci.yml 0.2.6 DAC8551 2022-10-31 16:41:19 +01:00
CHANGELOG.md 0.2.7 DAC8551 2023-09-23 17:02:25 +02:00
DAC8551.cpp 0.2.7 DAC8551 2023-09-23 17:02:25 +02:00
DAC8551.h 0.2.7 DAC8551 2023-09-23 17:02:25 +02:00
keywords.txt 0.2.5 DAC8551 2021-12-15 12:34:24 +01:00
library.json 0.2.7 DAC8551 2023-09-23 17:02:25 +02:00
library.properties 0.2.7 DAC8551 2023-09-23 17:02:25 +02:00
LICENSE 0.2.6 DAC8551 + github actions 2023-02-09 11:33:52 +01:00
README.md 0.2.7 DAC8551 2023-09-23 17:02:25 +02:00

Arduino CI Arduino-lint JSON check GitHub issues

License: MIT GitHub release PlatformIO Registry

DAC8551

Arduino library for DAC8501 DAC8531, DAC8550, DAC8551 SPI Digital Analog Convertor.

Description

The DAC8551 is a SPI based 16 bit DAC with one channel.

The DAC8501, DAC8531 and DAC8550 are drop in compatible. They all have classes derived 1 to 1 from DAC8551.

Warning this library is not tested extensively.

Interface

#include "DAC8551.h"

Core

  • DAC8501(uint8_t slaveSelect) Constructor for DAC8501 with hardware SPI,
  • DAC8531(uint8_t slaveSelect) Constructor for DAC8531 with hardware SPI,
  • DAC8550(uint8_t slaveSelect) Constructor for DAC8550 with hardware SPI,
  • DAC8551(uint8_t slaveSelect) Constructor for DAC8551 with hardware SPI, since 0.2.0 the slaveSelect pin needs to be defined.
  • DAC8501(uint8_t spiData, uint8_t spiClock, uint8_t slaveSelect) Constructor for the software SPI
  • DAC8531(uint8_t spiData, uint8_t spiClock, uint8_t slaveSelect) Constructor for the software SPI
  • DAC8550(uint8_t spiData, uint8_t spiClock, uint8_t slaveSelect) Constructor for the software SPI
  • DAC8551(uint8_t spiData, uint8_t spiClock, uint8_t slaveSelect) Constructor for the software SPI
  • void begin() initializes all pins to default state
  • void setValue(uint16_t value) set the value of the channel to 0 - 65535
  • uint16_t getValue() returns the last value written.

Hardware SPI

To be used only if one needs a specific speed.

  • void setSPIspeed(uint32_t speed) set SPI transfer rate.
  • uint32_t getSPIspeed() returns SPI transfer rate.
  • bool usesHWSPI() returns true if HW SPI is used.

ESP32 specific

  • void selectHSPI() in case hardware SPI, the ESP32 has two options HSPI and VSPI.
  • void selectVSPI() see above.
  • bool usesHSPI() returns true if HSPI is used.
  • bool usesVSPI() returns true if VSPI is used.

The selectVSPI() or the selectHSPI() needs to be called BEFORE the begin() function.

experimental

  • void setGPIOpins(uint8_t clk, uint8_t miso, uint8_t mosi, uint8_t select) overrule GPIO pins of ESP32 for hardware SPI. Needs to be called AFTER the begin() function.

Power down

check datasheet for details.

  • void setPowerDown(uint8_t powerDownMode) sets power down mode. 0 - 3.
  • uint8_t getPowerDownMode() returns last written mode.
Power down mode Value
DAC8551_POWERDOWN_NORMAL 0
DAC8551_POWERDOWN_1K 1
DAC8551_POWERDOWN_100K 2
DAC8551_POWERDOWN_HIGH_IMP 3

Note: DAC8501, DAC8531 and DAC8550 uses the same constants.

Operation

See examples

demo_hw_spi.ino

  • write a sawtooth to channel A followed by a sinus
  • uses HW SPI

demo_sw_spi.ino

  • write a sawtooth to channel A followed by a sinus
  • uses SW SPI

demo_powerdown.ino

  • idem

Future

Must

  • improve documentation

Should

  • testing (DAC8531 is verified, see example)
  • verify replacement chips

Could

Wont

Support

If you appreciate my libraries, you can support the development and maintenance. Improve the quality of the libraries by providing issues and Pull Requests, or donate through PayPal or GitHub sponsors.

Thank you,