Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Ideas for a project with ADS1210 or 1211

Status
Not open for further replies.

mpuskar

Newbie level 1
Joined
Nov 28, 2004
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
16
I'm working on a project for ADS1210 and ADs1211, ADC.
Did anyone work with ADS 1210 or 1211,
do you have any link to project page, or something similar

sorry on my very bad english


Thanks
 

ads1211 interface with 8051

I use ads 1211 for some projects.

If you have any question , ask me , if I can , i'll be happy to help you !

bye
 

ads1211 con pic c

IN datasheet there is no information on serial communication details (timing).

Data enters the ADS1210/11 DIN pin of SPI port on FALLing edge or RISING edge of SCLK? what is the same for DOUT line?
 

ads1211 in source code

@7rots51,

Have you read the user guide? It has timing diagrams for the SPI.

**broken link removed**

FoxyRick.
 

ads1211 interface with pic

7rots51 said:
IN datasheet there is no information on serial communication details (timing).

Data enters the ADS1210/11 DIN pin of SPI port on FALLing edge or RISING edge of SCLK? what is the same for DOUT line?

Now I don't remenber...

But if you want I can give you a C source code for use this IC.
I wrote this code for a Pic microcontroller family , and I use the CCS compiler.

bye
 

ads 1211

Inkwaterman,

If you can please post the code for the PIC to ads1211 interface. I am currently looking at starting a project using this IC. Any help would be greatly appreciated.

Thanks,
kar8942
 

adc drdy sclk

kar8942 said:
Inkwaterman,

If you can please post the code for the PIC to ads1211 interface. I am currently
looking at starting a project using this IC. Any help would be greatly appreciated.

Thanks,
kar8942

This is the library for the ads1211 I/O

Code:
#define DATA_OUTPUT_REGISTER 0
#define COMMAND_REGISTER 4
#define OFFSET_REGISTER 8
#define FULL_SCALE_REGISTER 12

#define ADS_READ 128
#define ADS_WRITE 0



#define SCLK PIN_C4
#define SDIO PIN_C3 //PIN_C2
#define DRDY PIN_C2

void write_ADS12(byte data);
BYTE read_ADS12();
void wait_DRDY();
void ADS_SelfCalibration();
void ads1211_sleep();
void ads1211_rise();


void ADS_Filter(unsigned char sei,unsigned char sette )
{
   wait_DRDY();
   write_ADS12(6);
   write_ADS12(sei); //129

   wait_DRDY();
   write_ADS12(7);
   write_ADS12(sette);  //112
}


void ADS_SelfCalibration()
{
   wait_DRDY();
   write_ADS12(5);   //101
   write_ADS12(32);  //    100000
}


void write_ADS12(byte data)
{
   byte i;
   delay_us(40);
   for(i=0; i<8; i++)
   {
      delay_us(10);
      output_high(SCLK);
      delay_us(10);
      if(bit_test(data,7)) output_high(SDIO);
      else output_low(SDIO);
      output_low(SCLK);
      data <<= 1;
   }
}

BYTE read_ADS12()
{
   byte i, data=0;
//   delay_us(40);


   for(i=0; i<8  ;i++)
      {
         delay_us(10);
         output_high(SCLK);
         delay_us(10);
         if(input(SDIO)) bit_set(data, 7-i);
         output_low(SCLK);
   }

   return(data);
}


void wait_DRDY()
{
  probe_status |= 2; 
  while ( !input(DRDY) );
}


void ads1211_sleep()
{
   wait_DRDY();
   write_ADS12(5);
   write_ADS12(192);
}

void ads1211_rise()
{
   output_high(SDIO);
   delay_us(1000);
   output_low(SDIO);
}

And this is how I use it

Code:
float Read_Voltage_Channel(byte i)
{

  float ftemp;
  unsigned char index;
  unsigned char d[3];

  wait_DRDY();
  write_ADS12(5);
  write_ADS12(i);

  wait_DRDY();
  write_ADS12(192);

  for (index = 0 ; index < 3; index++)
      {
         d[index]=read_ADS12();
      }


  ftemp=(d[0] * 65536 + d[1] * 256 + d[2]) ;

//cost is the variable for byte/voltage conversion
  ftemp /= cost;
  return (ftemp);

}
 

ads1210 c

Thank you for your help.
 

ads1210 or 1211

I just convert the code from Inkwaterman into avrgcc with atmega8 but i got error, i cant get any value in my serial RS232 line, anyway thankyou so much for Inkwaterman.
But if you have a time please chack my unworked code



#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
#include <util/delay.h>
#define F_CPU 4000000 // Micro controller crystal freq
#define BAUD 9600
#define UBRR_VAL F_CPU/16/BAUD-1

#define output_low(port,pin) port &= ~(1<<pin)
#define output_high(port,pin) port |= (1<<pin)
#define bit_test(byte,bit) (byte & (1 << bit)) //

#define bit_get(p,m) ((p) & (m))
#define bit_set(p,m) ((p) |= (m))
#define bit_clear(p,m) ((p) &= ~(m))
#define bit_flip(p,m) ((p) ^= (m))
#define bit_write(c,p,m) (c ? bit_set(p,m) : bit_clear(p,m))
#define BIT(x) (0x01 < < (x))
#define LONGBIT(x) ((unsigned long)0x00000001 << (x))

#define SCLK PC2
#define SDIO PC3 //PIN_C2
#define DRDY PC5


float ftemp;

unsigned char Read_Voltage_Channel(unsigned char i)
{


unsigned char index;
unsigned char d[3];

wait_DRDY();
write_ADS12(5);
write_ADS12(i);

wait_DRDY();
write_ADS12(192);

for (index = 0 ; index < 3; index++)
{
d[index]=read_ADS12();
}


ftemp=(d[0] * 65536 + d[1] * 256 + d[2]) ;

//cost is the variable for byte/voltage conversion
// ftemp /= cost;
return (ftemp);

}


void write_ADS12(unsigned char data)
{
unsigned char i;
delay_us(40);
for(i=0; i<8; i++)
{
delay_us(10);
output_high(PORTC, SCLK);
delay_us(10);
if(bit_test(data,7)) output_high(PORTC, SDIO);
else output_low(PORTC, SDIO);
output_low(PORTC, SCLK);
data <<= 1;
}
}

void read_ADS12()
{
unsigned char k, data=0;
// delay_us(40);


for(k=0; k<8 ;k++)
{
delay_us(10);
output_high(PORTC, SCLK);
delay_us(10);
if(bit_get(PORTC, SDIO)) bit_set(data, 7-k);
output_low(PORTC, SCLK);
}

return(data);
}


void wait_DRDY()
{
//probe_status |= 2;
while ( !bit_get(PORTC, DRDY) );
}










// Delay function

void delay_ms(int delay) {
int i;
for (i=0;i<=delay;i++) {
_delay_ms(1);
}
}
void delay_us(int delay) {
int i;
for (i=0;i<=delay;i++) {
_delay_us(1);
}
}
// Initialing serial

void init_uart(unsigned int ubrr) {
UBRRH = (unsigned char)(ubrr>>8);
UBRRL = (unsigned char)(ubrr);
UCSRB |= (1<<RXEN);
UCSRB |= (1<<TXEN);
UCSRB |= (1<<RXCIE);
UCSRC = (1<<URSEL)|(1<<USBS)|(3<<UCSZ0);
}

// send a single character

void send_char(unsigned char data) {
while (!(UCSRA & (1<<UDRE)));
UDR = data;
}


// send a string (multiple character)

void send_string(char *data) {
while (*data) {
send_char(*data);
data++;
}
}




int main(void) {
init_uart(UBRR_VAL);
while (1) {
//Read_Voltage_Channel(0);
send_string(Read_Voltage_Channel(0));
}
return 1;
}


And if anyone have a BascomAVR code or avrgcc to interfacing the ads1210 with avr micro controller please share it for me
Thank you very much ..
 

Re: ads1210 or 1211

i have used 4 mode of SPI (Atmega8,2Mhz )
i don't know why i can't read correctly content of register in ADS1211
please help me!

---------- Post added at 12:47 ---------- Previous post was at 12:39 ----------

i use codevisionAVR. I used the code above. But it still can not run!
 

I have been looking for code to inface this ADS1211 for several hours

I am very happy to see your code. I am currently using Cypress PSoC 1 for my MCU. I would have preferred the PSoC 3 or 5. I hope your code will work with my Cypress part.
Your code looks greate. I am trying to talk to the ADC via a three wire SPI.

Thank you for the greate code.

Philip:-D
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top