I'm confused about which communication protocol to use, SPI, I2C or just the shiftOut commnad. I have a programmable electronic load, Datel DTL2A-LC http://www.alldatasheet.com/datasheet-pdf/pdf/194101/ETC2/DTL2A-LC.html The communication states "CMOS/TTL compatible, serial input current sink"
The DAC needs to get a 12 bit value to set the load current, from 1 to 4096.
The device has 4 pins for input: Latch Data - LD Serial Data In - SDI Clock - CLK Control Strobe - CS
I tried following the instructions in the datasheet; however, it specifies that the instructions are for C Language. I translated to the Arduino, see my sample below. I have tried using the shiftOut command with no success.
/*
This sketch is designed to communicate with the ELTEST EL2A-LC programmable electronic load
Communication with the EL2A-LC is with the shiftOut command
Tested with Arduino Mega running IDE 1.0.1
Created December 16, 2012
By Vitor2
*/
int latchPin = 8; //Connected to pin 4 of Eltest
int clockPin = 12; //Connected to pin 6 of Eltest
int dataPin = 11; //Connected to pin 5 of Eltest
int strobePin = 7; //Connected to pin 7 of Eltest
void setup() {
//set pins to output
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(strobePin, OUTPUT);
//I did not include sending the data in the loop because I only want to do it once.
//This may not belong here.
//Initialization
digitalWrite(strobePin, HIGH);
digitalWrite(latchPin, HIGH);
digitalWrite(clockPin, HIGH);
delay(10);
digitalWrite(strobePin, LOW);
delay(10);
//Send one value between 0 and 4096 to the device
//The value should be a 12 bit binary?
shiftOut(dataPin, clockPin, MSBFIRST, 100); //Value of 100 should be 0.488 Amps
digitalWrite(strobePin, HIGH);
digitalWrite(latchPin, HIGH);
digitalWrite(latchPin, LOW);
digitalWrite(latchPin, HIGH);
}
void loop() {
}