Go Down

Topic: Communication with a programmable electronic load. (Read 1 time) previous topic - next topic

Vitor2

Dec 17, 2012, 06:29 am Last Edit: Dec 17, 2012, 07:54 am by Vitor2 Reason: 1
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.

Code: [Select]

/*

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() {

 }

Nick Gammon

Please edit your post, select the code, and put it between [code] ... [/code] tags.

You can do that by hitting the # button above the posting area.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

linux-works

I just bought this module and will be trying it with my arduino.

first thing I noticed about the code example is that shiftout sends 8 bits at a time.  the dc load chip needs 12 bits.  and sending more is going to be -wrong-, just as much as sending less would be.

so, I think you have to bit-bang in software.  I plan to, anyway, and do it for a loop count of 12.

when I have my example working, I'll post it.  not sure if the OP cares anymore, but for the record, I'll debug this and post when I have working code for my own setup.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy