Pages: [1]   Go Down
Author Topic: Interfacing ADS1244  (Read 2021 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 148
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

does anybody know where to find an example code to drive
an ADS1244 ADC using its serial interface ?

http://www.bg-electronics.de/datenblaetter/Schaltkreise/ADS1244.pdf

thx wally
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 112
Posts: 5291
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't know of any implementation but it should be quite easy to do one yourself. Have you tried it?
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 148
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I'm preparing to try,
Yes, looks simple, but I'm not sure about the interface. Seems to be neither SPI nor I2C
It does not have a CS pin and usess 2 clocks, the system clock at 2,5 MHz.
I fear it's not entirely trivial.
I did not find anything useful on the web , e.g. example code

wally
 
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 112
Posts: 5291
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Seems to be neither SPI nor I2C

No, it's much simpler.

Quote
It does not have a CS pin and usess 2 clocks, the system clock at 2,5 MHz.

No, it doesn't have a CS pin, so the "bus" isn't sharable. What do you mean with 2 clocks? You have to provide it's chip clock, which is a simple rectangular signal, you can use a PWM for that. The SCLK is the serial clock, you have to provide an edge for every bit you wanna read. You can do this with 2 digital pins. So for the whole chip you need 3 Arduino pins, one of them has to be a PWM output with a free timer.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 148
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Pylon,

already little simpler now, thank you.

 All kind of further help highly welcome

wally
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 112
Posts: 5291
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

With that code in setup you get a 2.4MHz clock signal on pin 3.

Code:
void setup() {
  pinMode(3, OUTPUT);
  TCCR2A = 0x33;
  TCCR2B = 0x09;
  OCR2A = 0x06;
  OCR2B = 0x03;
}

Code for reading the data:

Code:
while (digitalRead(DATA_PIN) == HIGH); // wait for data ready
uint32_t value = shiftIn(DATA_PIN, CLOCK_PIN, MSBFIRST);
value <<= 8;
value |= shiftIn(DATA_PIN, CLOCK_PIN, MSBFIRST);
value <<= 8;
value |= shiftIn(DATA_PIN, CLOCK_PIN, MSBFIRST);
digitalWrite(CLOCK_PIN, HIGH);
digitalWrite(CLOCK_PIN, LOW); // 25th pulse to keep DATA high till next data ready

Keep in mind that DATA_PIN has to be in input mode while CLOCK_PIN has to be an output.

Hope that helps to get you started.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 148
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Pylon,

thanks a lot !   smiley
I am  ashamed but i must say i see the 'shiftIn/ shiftOut' commands the first time.
I still get some errors when compiling, but i think i can fix it after some readings.
And i must solder the ADC on a adapter-PCB (MSOP) now to test during weekend.

regards
Wally
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 112
Posts: 5291
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Take care of the different voltages, the analog is running at about 5V while the digital part must be below 3V6. Maybe you even have to have some voltage divider for the clock signal.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 148
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Works !

i get :
16.772.xxx   on  0V
2.794.xxx  on   3.3V
700.xxx on 5V


Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 148
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

better results with pos.Vref = +2.5V
 +5V     7FFFFF      8.388.607
 +2,5V  40ACA4  ~4.238.500
 +0,1V  5DC        ~1,500
 <+0,1  FFXXXX  16.xxx.xxx

Code:
/*
  ADS1244
 
*/

int DATA = 4;
int SCLK = 5;

void setup() {
 
  pinMode(DATA, INPUT);
  pinMode(SCLK, OUTPUT);
 
  Serial.begin(115200);
 
  // generate a 2.4MHz clock signal on pin 3
  pinMode(3, OUTPUT);      //CLK
 
  // 17.11 Register Description
  TCCR2A = 0x33;  // 0011 0011 
  TCCR2B = 0x09;  // 0000 1001
  OCR2A  = 0x06;  // 0000 0110
  OCR2B  = 0x03;  // 0000 0011
 
  Serial.print("ADS1244");    // output 'AADS1244' (?) additional 'A' in front
  delay(100);
}

void loop() {
 
  // Code for reading the data:
     
  int32_t value = 0;
 
  //digitalWrite(SCLK, HIGH);  //enter slleep mode
  delay(1000);
  digitalWrite(SCLK, LOW);  // wake up ADC
 
     
  // wait for data ready, stay in while-loop until LOW
  while (digitalRead(DATA) == HIGH);     

  value = shiftIn(DATA, SCLK, MSBFIRST);
  value <<= 8;
  value |= shiftIn(DATA, SCLK, MSBFIRST);
  value <<= 8;
  value |= shiftIn(DATA, SCLK, MSBFIRST);

  digitalWrite(SCLK, HIGH);  // enter sleep mode
  //digitalWrite(SCLK, LOW); // 25th pulse to keep DATA high till next data ready
   
  Serial.println(value, DEC);
  Serial.flush();

}

Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 148
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

some fine tuning to make it human readable:
thanks a smart solution from "dhenry"

Code:
/*
  ADS1244
 
*/

int DATA = 4;
int SCLK = 5;

void setup() {
 
  pinMode(DATA, INPUT);
  pinMode(SCLK, OUTPUT);
 
  Serial.begin(115200);
 
  // generate a 2.4MHz clock signal on pin 3
  pinMode(3, OUTPUT);      //CLK
 
  // 17.11 Register Description
  TCCR2A = 0x33;  // 0011 0011 
  TCCR2B = 0x09;  // 0000 1001
  OCR2A  = 0x06;  // 0000 0110
  OCR2B  = 0x03;  // 0000 0011
 
  Serial.print("ADS1244\n");    // output 'AADS1244' (?) additional 'A' in front
  delay(100);
}

void loop() {
 
  // Code for reading the data:
     
  int32_t value = 0;
 
  //digitalWrite(SCLK, HIGH);  //enter slleep mode
  delay(300);
  digitalWrite(SCLK, LOW);  // wake up ADC
 
     
  // wait for data ready, stay in while-loop until LOW
  while (digitalRead(DATA) == HIGH);     

  value = shiftIn(DATA, SCLK, MSBFIRST);
  value <<= 8;
  value |= shiftIn(DATA, SCLK, MSBFIRST);
  value <<= 8;
  value |= shiftIn(DATA, SCLK, MSBFIRST);

  digitalWrite(SCLK, HIGH);  // enter sleep mode
  //digitalWrite(SCLK, LOW); // 25th pulse to keep DATA high till next data ready
   
  // process as int24_t (two's compliment 24bit) 
  value = ((signed long) (value << 8)) >> 8;   
   
   
  Serial.println(value, DEC);
  Serial.flush();

}


Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, Could you share the code for the ads1232 with Arduino loadcell reading, I saw a post that could make reading, need to do a project and I'm having difficulty.
Logged

Pages: [1]   Go Up
Jump to: