16 bit DAC with a clock signal

Dmax

Member
I wish to use a Teensy 4.1 and 16 bit DAC to output a control voltage, The DAC is a PCM 56 by Burr brown , I have a few of these IC's so that's the reason for using them, below is information from the data sheet. My question is what would be the best way to go about outputting the data to a pin and a timing clock on another pin in sync ? I've not done any programming for a few years so I'm very rusty so if anyone could point me in the right direction that would be great thank you :)

1000069934.jpg
 
I got it working :)

CODE]
for (int i = 0; i < 16; i++) {

digitalWrite(Out1, (D1 >> (15 - i)) & 0x01);
digitalWrite(Clock1, HIGH);
digitalWrite(Clock1, LOW);
}
digitalWrite( Latch, LOW);
digitalWrite(Clock1, HIGH);
digitalWrite(Clock1, LOW);
digitalWrite( Latch, HIGH);

[/CODE]
 
That looks like regular I2S: the main clock corresponds to BCLK and the Latch Enable signal corresponds to LRCLK.
 
You should be able to do it with the "shiftOut()" function call. Something like
C:
shiftOut(Out1, Clock1, MSBFIRST, D1>>8);
shiftOut(Out1, Clock1, MSBFIRST, D1 & 0xff);
digitalWriteFast(Latch, LOW);
digitalWriteFast(Clock1, HIGH);
digitalWriteFast(Clock1, LOW);
digitalWriteFast(Latch, HIGH);
 
Back
Top