2017-12-19 05:44:03 -05:00
|
|
|
//
|
|
|
|
// FILE: DAC8554_broadcast.ino
|
|
|
|
// AUTHOR: Rob Tillaart
|
|
|
|
// PURPOSE: demo DAC8554 library Arduino with hardware SPI
|
2021-01-29 06:31:58 -05:00
|
|
|
// VERSION: 0.2.0
|
2020-11-27 05:10:47 -05:00
|
|
|
// URL: https://github.com/RobTillaart/Arduino/DAC8554
|
|
|
|
|
|
|
|
|
2017-12-19 05:44:03 -05:00
|
|
|
#include "DAC8554.h"
|
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
|
2017-12-19 05:44:03 -05:00
|
|
|
// note address as param
|
2021-01-29 06:31:58 -05:00
|
|
|
DAC8554 DAC_A(10, 0);
|
|
|
|
DAC8554 DAC_B(11, 1);
|
2017-12-19 05:44:03 -05:00
|
|
|
|
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
Serial.begin(115200);
|
|
|
|
Serial.println(__FILE__);
|
|
|
|
Serial.println(DAC8554_LIB_VERSION);
|
|
|
|
DAC_A.begin();
|
|
|
|
DAC_B.begin();
|
|
|
|
|
|
|
|
Serial.println("Buffer initial values");
|
|
|
|
for (uint8_t channel = 0; channel < 4; channel++)
|
|
|
|
{
|
|
|
|
DAC_A.bufferValue(channel, channel * 1000);
|
|
|
|
DAC_B.bufferValue(channel, 60000 - channel * 1000);
|
|
|
|
}
|
|
|
|
delay(2000);
|
|
|
|
Serial.println("Set initial values");
|
|
|
|
DAC_A.broadcastBuffer();
|
|
|
|
|
|
|
|
Serial.println("Buffer new values");
|
|
|
|
for (uint8_t channel = 0; channel < 4; channel++)
|
|
|
|
{
|
|
|
|
DAC_A.bufferValue(channel, channel * 5000);
|
|
|
|
DAC_B.bufferValue(channel, 60000 - channel * 5000);
|
|
|
|
}
|
|
|
|
delay(2000);
|
|
|
|
Serial.println("Set new values");
|
|
|
|
DAC_A.broadcastBuffer();
|
|
|
|
|
|
|
|
delay(2000);
|
|
|
|
Serial.println("Set all values");
|
|
|
|
DAC_A.broadcastValue(32000);
|
|
|
|
|
|
|
|
delay(2000);
|
|
|
|
Serial.println("PowerDown 100K");
|
|
|
|
DAC_A.broadcastPowerDown(DAC8554_POWERDOWN_100K);
|
|
|
|
|
|
|
|
Serial.println("Done...");
|
|
|
|
}
|
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
|
2017-12-19 05:44:03 -05:00
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
}
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
// -- END OF FILE --
|