Pages: [1]   Go Down
Author Topic: Communication with a programmable electronic load.  (Read 919 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 14
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
/*
 
 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() {

  }
« Last Edit: December 17, 2012, 01:54:27 am by Vitor2 » Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 485
Posts: 18807
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 94
sercona audio
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: