AtticusG3
Posts: 4
Joined: Mon May 06, 2013 11:58 pm

24bit ADC ADS1211 and a Pi

Tue May 07, 2013 12:22 am

Hi guys,

I'm currently working on a project in which I need to use an ADS1211P (Datasheet) for measure differential inputs and I have very little programming experience/knowledge. The little i have done so far has been with python, so I'd like to stick with that.

I have only used i2c devices in the past so this is my first adventure with a different interface. Reading the datasheet is not very clear to me, when it says 4-wire, 3-wire, 2-wire serial interface, is it refering to SPI in some way? As in can I use something like SPi-Py to communicate with this chip in python?

I have found an arduino library for a similar device (the ADS1213) so I'm going to be referring to that to write my code. Unless another forum member could point me at a library written for this chip.

Thanks in advance for your answers and any information you can provide/point me too.

AtticusG3
Posts: 4
Joined: Mon May 06, 2013 11:58 pm

Re: 24bit ADC ADS1211 and a Pi

Tue May 07, 2013 4:13 am

I've been looking at the wiringPi website, although I haven't programmed in Arduinoese before I may be able to convert the Arduino library to wiringPi. If anyone would be willing to help me out I would be appreciative.

Code: Select all

#ifndef ADS1213_h
#define ADS1213_h

#include "wiringPi.h"
#include "wiringPiSPI.h"

class ADS1213
{
  public:
    ADS1213(float clockspdMHz, boolean OffsetBin, byte SCLK, byte IO, byte DRDY, byte CS);

    void write(byte adr,byte count,byte val[]);
    void CMRwrite(byte channel,byte mode=0,byte gain=0,byte TMR=0,int DR=0);
    void channel(byte channel);

    unsigned long read(byte adr, byte count);
    unsigned long read(byte adr, byte count, boolean sync);
    long readSigned(byte count);

    void reset();
  private:
    int _tscaler;
    byte _SCLK;
    byte _IO;
    byte _DRDY;
    byte _CS;
    byte _SCLKdelay;
};

#endif
This is the Arduino code in the ADS1213.h file. Looking at it I think I need to change the

Code: Select all

    void write(byte adr,byte count,byte val[]);
    void CMRwrite(byte channel,byte mode=0,byte gain=0,byte TMR=0,int DR=0);
    void channel(byte channel);
lines.

Would i be right in thinking I need to change this to use the wiringPiSPIDataRW function?

Return to “Automation, sensing and robotics”