Digital read () ?

Hi everybody,

I’m a beginner french student with the arduino and i need your help for my project.
I link my arduino with a 16 bits paralell ADC (ADS8322 from Texas Instrument) and i want to get back the binary level of each byte of the ADC in output and display them.

I think that use digitalRead() is the good issue but i’m not sure, there is too many functions :wink:

Thanks for your help :wink:

This device apparently generates a parallel digital output, and is a very poor choice of device to connect to Arduino.

You would need to read 16 digital pins simultaneously, it is just not going to be practical to work.

Get a different ADC chip which will communicate with the arduino using SPI interface or maybe I2C interface.

You would need to read 16 digital pins simultaneously, it is just not going to be practical to work.

I don't see why that should be. Initiate a conversion, wait on busy, read sixteen bits, initiate another conversion and stitch your 16 bit integer together while you're waiting. It won't be fast, but I don't see why they need to be read simultaneously.

AWOL:

You would need to read 16 digital pins simultaneously, it is just not going to be practical to work.

Initiate a conversion, wait on busy, read sixteen bits, initiate another conversion and stitch your 16 bit integer together while you're waiting. It won't be fast, but I don't see why they need to be read simultaneously.

The ADS8322 is a parallel output device. Unless you add more external logic, you can't read it serially.

I don't recall mentioning reading it serially.

In addition, according to the data sheet, you can use the BYTE input so that you only need to use 8 pins to get the data rather than 16, which again supports the idea that the data is latched and you can pick it up a pin at a time.

AWOL: I don't recall mentioning reading it serially.

I guess what threw me was you saying

Initiate a conversion, wait on busy, read sixteen bits,

Obviously, you'd be reading them sequentially (unless you had them wired to two eight bit ports in which case it is quicker, but still sequential), but that's not the same as reading them serially.

I probably wouldn't even bother reading all sixteen - just wire up twelve or thirteen of the MSBs and assume the remainder were noise.

As mentioned this chip is not a great match for an Arduino. On the smaller chips (Uno etc) you would probably have an array of up to 16 pin numbers, start the conversion and when finished assert the RD pin (or whatever it has) and start reading all the 16 pins and accumulating them into a single variable.

On larger chips (Mega, Due) you should be able to organise things so you can use direct port reading to get the value in 2 operations.

On the Due you could even memory map the ADC so your access would be blindingly fast.

But if you have the option I'd get a serial ADC.


Rob

AWOL: Obviously, you'd be reading them sequentially (unless you had them wired to two eight bit ports in which case it is quicker, but still sequential), but that's not the same as reading them serially.

Well, it wasn't obvious from your post. The entire sentence was:

Initiate a conversion, wait on busy, read sixteen bits, initiate another conversion and stitch your 16 bit integer together while you're waiting.

which sound a LOT like you are reading 16 bits (not 8 bits), and assembling them into 16 bits (int perhaps).

which sound a LOT like you are reading 16 bits (not 8 bits)

From a sixteen bit device, it doesn’t matter if you’re reading serial, 8 bit parallel or sequential 16-bit parallel, because on an eight bit machine, sooner or later you’re going to have to stitch the bits together into a single variable.
There are no sixteen bit ports, and in all likelihood, the pins you use are going to be spread across two or three ports.
It isn’t a problem, just an overhead.

If there are no timing constraints then I don't see any problem wiring the 16 logic inputs to digital I/O pins, sticking the pin numbers in an array, and iterate through the array reading that pin and writing the corresponding bit value to an accumulator. It's only a few lines of code and a fraction of a millisecond to execute.

you can interface a Parallel in Serial out shift register if you want to save your arduino pins.

Hello all,

Thank you for your answers. I'll try to connect my 16 output bits from the ADC, put them in an array and convert them.

I'll say to you if this solution works..... or not^^

Thank you

put them in an array and convert them.

No need for an array, normally you shift them into a variable on the fly.


Rob

l'll say to you if this solution works..... or not^^

No the solution works, you will say whether you have managed to do it correctly or not.