Skip to content

Instantly share code, notes, and snippets.

Created September 9, 2016 03:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
LTC1257 untested quick code
shift register simpletown for LTC1257
12 bit DAC, 5V, 1.4MHz max clock
DOUT -________- GND
DIN loaded into shift reg on rising edge of clock
MSB first
DAC loads data when !LOAD pulled low, then sets when !LOAD high
internal 5v reg, full rail swing: GND to VCC
can daisy chain them, DOUT to DIN, max 1.4MHz
#define DIN 10
#define CLK 11
#define LOAD 12
void sendDAC(int data) //12 bits, 4095, 0xFFF
digitalWrite(LOAD, HIGH);
digitalWrite(CLK, LOW);
for(int i = 11; i >= 0; i++)
digitalWrite(DIN, data >> i & 1);
digitalWrite(CLK, HIGH);
digitalWrite(CLK, LOW);
digitalWrite(LOAD, LOW); // might want to set high after
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment