EmbDev.net

Forum: µC & Digital Electronics Interface of external ADC with Arduino UNO(avr atmega328)./ (ADC's TWI adress not found)


von Matt (Guest)


Attached files:

Rate this post
0 useful
not useful
Hello,

The usecase is the measurment of 2  voltagea of max -+10. I use Arduino 
UNO (Atmega328) and two ADC components  (AD7893ANZ-10), datasheet 
available on 
https://www.analog.com/media/en/technical-documentation/data-sheets/AD7893.pdf 
, trying to make this run I faced  two challenges which  was not 
solvable by my resaerches on it, why I hope for help here.
The issues are following:

1. The TWI adress of the ADC component is not avialable in Datasheet. I 
tried three I2C device scanners, which I foundnon forumnof Arduino, but 
no I2C device couldnt be found.  One of scanners is posted below and the 
scheme of the circuit(with pull up resistors etc.) is attached. on the 
circuit scheme the pin "convst" is not connetcted but I also tried it 
with convst pin being pulsed with T=12µs and D=50% according to 
datasheet.
#include <Wire.h>

void setup()
  { 
  int count = 0;       
 
  Serial.begin (9600);
  Wire.begin();
  Serial.println ("I2C-Bus-Scanner");

  Wire.setClock(100000L);
  Serial.println("Scan mit 100 kHz");
  scan();
  Wire.setClock(400000L);
  Serial.println("Scan mit 400 kHz");
  scan();
  }
 
void scan(void)
  {
  int count = 0;

  for (int i = 0; i < 128; i++)
    {
    Wire.beginTransmission(i);
   
    if (Wire.endTransmission () == 0)
      { /* gefunden */
      Serial.print ("ID = ");
      Serial.print (" 0x");     
      Serial.println(i, HEX);
      count++;   
      }
    delay (20);
    }
  Serial.print (count);
  Serial.println (" Devices gefunden\n");   
  }
 
void loop()
  {
 
  }

2. I considered also to use the SPI interface. But there are no CS and 
no pin to connect MOSI on the ADC (see datasheet page9). The alternative 
solution for CS pin is explained in data sheet as following: " To chip 
select the AD7893 in systems where more than one device is connected to 
the 68HC11's serial port, a port bit, configured as an output from one 
of the 68HC11's parallel ports, can be used to gate on or off the serial 
clock to the AD7893. A simple AND function on this port bit and the 
serial clock from the 68HC11 will provide this function. The port bit 
should be high to select the AD7893 and low when it is not selected. "; 
I tried to figure out how to realize the AND function but its not even 
clear for me if this is related to HW or SW yet.

I hope the problem is formulated detailed enough, if its not the case 
pls let me know. every hint is appreciated :)

von stefanus (Guest)


Rate this post
1 useful
not useful
Matt wrote:
> The TWI adress of the ADC component is not avialable in Datasheet.

This ADC does not have a TWI (I²C) interface!

According to Figure 3 and the explanations above, you need to start the 
conversation by a third wire (CONVST), then wait a while before reading 
out the data. To read out the data you need to send 16 clock pulses and 
read in the data bits (while the clock is low).

von stefanus (Guest)


Rate this post
1 useful
not useful
> I considered also to use the SPI interface.

To think this is possible by sending out 2 bytes via an unused MOSI 
wire.

Connect MISO and SCK to the ADC and also connect another general purpose 
write to CONVST. However due to the timing requirements I assume that 
using the SPI peripheral does not provide any benefit compared to 
bit-banging by a small 16-step for-loop.

von Mathias M. (matt4)


Rate this post
0 useful
not useful
Hi, thanks a lot for the hints.

This part in datasheet did let me belive it works with twi: "The AD7893 
provides a two-wire serial interface that can be used for connection to 
the serial ports of DSP processors and microcontrollers."

For spi , do you have a hint how to choose the ADCs by µC, thus there is 
no cs pin and there are 2 ADCS.

yours,

: Edited by User

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.