Bit Bang ing a 10 bit DAC

I am trying to control a 10 Bit DAC, BU2505FV-E2. 10 bit data 4 bit address. I can see the clock and data and load pins on a scope, and all seems ok; but the DAC outputs do not change…

Anyone has a suggestion?

Thanks!
Raymond

DAC_SETUP.ino (1.03 KB)

// Pin connected to_DAC
int LoadPin = 9;
int clockPin = 12;
int dataPin = 11;
word DACdata[10] = {0x00F1, 0x00F2, 0x00F3, 0x00F4, 0xFFF5, 0xFFF6, 0xFFF7, 0xFFF8, 0xFFF9, 0xFFFA};
//State of I/O pin
int PinState = 0;


void setup() {

  pinMode(dataPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(LoadPin, OUTPUT);

  digitalWrite(clockPin, 0);
  digitalWrite(dataPin, 0);

  digitalWrite(LoadPin, 0);


  // DAC
  for (int i = 0; i < 10; i++) {
    digitalWrite(clockPin, 0);
    digitalWrite(dataPin, 0);
    digitalWrite(LoadPin, 0);

    for (int j = 13; j >= 0; j--) {
      if (DACdata[i] & (1 << j)) {
        PinState = 1;
      }
      else {
        PinState = 0;
      }


      digitalWrite(dataPin, PinState);
      digitalWrite(clockPin, 1);
      delayMicroseconds(1);
      digitalWrite(dataPin, 0);
      delayMicroseconds(1);
      digitalWrite(clockPin, 0);
      delayMicroseconds(1);
    }
    digitalWrite (LoadPin, 1);
    delayMicroseconds(1);
    digitalWrite(LoadPin, 0);
    delayMicroseconds(2);
  }

}

void loop() {

}

Why is it so hard to help others help you by POSTING YOUR CODE?

The BU2505FV-E2 datasheet would be useful too.

Pete

I am a newbie to this forum. The data sheet is attached. I have also found the the bit order was reverse in my bit bang routine. Here si the updated version:

// DAC
//for (int i = 0; i < 10; i++) {

int i = 8;
digitalWrite(clockPin, 0);
digitalWrite(dataPin, 0);
digitalWrite(LoadPin, 0);

for (int j = 0; j < 14; j++) {
if (DACdata & (1 << j)) {

  • PinState = 1;*
  • }*
  • else {*
  • PinState = 0;*
  • }*
  • digitalWrite(dataPin, PinState);*
  • digitalWrite(clockPin, 1);*
  • digitalWrite(dataPin, 0);*
  • digitalWrite(clockPin, 0);*
  • }*
  • digitalWrite (LoadPin, 1);*
  • digitalWrite(LoadPin, 0);*
  • delayMicroseconds(5);*
    Hard coded to bang just one of the ten DAC resisters.
    Still not working… >:(
    Dada sheet too large to post…

Code tags?
Or didn't you want any help?