A to D converter onboard

Hi all. I understand the arduino has a A to D converter on it so there is a line of analogue inputs to the arduino. If i have an external A to D converter can i somehow put that information into the digital pins. I understand digital pins can either be high or low but is that reading as well or just writing. Just dont understand how the arduino reads the digital side once its gone through the converter.
Any help much appreciated

Read the datasheet for the part you want to use.
Most use I2C or SPI for interfacing.
The chip does the conversion, then sends the results as 2 bytes to the arduino.
See mcp3201 as an example.

See section 6.1
Basically you do this:

digitalWrite (SSpin, LOW);
upperbyte = SPI.transfer(0);  // dummy transfer of 0 out, while reading  data in at the same time
lowerbyte = SPI.transfer(0); // with other chips, these might be real data out, to select a channel for instance
digitalWrite(SSpin, HIGH);

then do a little manipulation to grab the 12 bits from the 2 bytes: put the 2 bytes together to make an int, and shift right 2 bits to drop the duplicate B0/B1 bits.

I sort of underatnd that but i thought the digital pins on the arduino could only read high or low. I could put a A to D converter before the arduino but does it still have to communicate through the analogue ports. I dont understand how the digital pins can read 2 bytes.
Thanks

Try reading CrossRoad's post again. If necessary, Google for I2C and SPI.

They are both serial data protocols that transfer more than one bit - a succession of bits is sent and reassembled at the receiving end. They are both command/response protocols where the microcontroller starts a transaction and generates the timing/clocking. They both deal in bytes (octets). Most sensors and devices than connect to a microcontroller use these or similar protocols rather than the parallel interfaces common in microprocessors.

I sort of underatnd that but i thought the digital pins on the arduino could only read high or low. I could put a A to D converter before the arduino but does it still have to communicate through the analogue ports. I dont understand how the digital pins can read 2 bytes.
Thanks

If you already have an A/D converter, you do not hook it up to the analog pins. It will already have converted the analog signal to a digital output. the output come into the Arduino through a digital pin one bit at a time. That means basically, that if it is a 12 bit A/D then you send out a pulse (clock signal) from another pin on the Arduino 12 times to read all of the 12 bits in. There are lots of scripts that show how to do this. You need to know the sequence of clock pulses that are needed to obtain the total reading sent from the A/D. If you are a complete novice programmer, developing your own script may be pretty frustrating. If the chip you are using already has a script or library written for it, then the task becomes much easier.

No worries. I do understand now so rather than just reading the input it would get a signal through the digital pins of it being high then low and so on. Thanks for the help i now know where to start and how to add extra analogue pins to the arduino or to a module.
Thanks

I sort of underatnd that but i thought the digital pins on the arduino could only read high or low

Perhaps your confusion is in not being aware that the arduino is reading the digital pin (detecting either a high or low) very quickly 16 times to gather in two bytes of data.

I am a newbie, myself. Perhaps the veterans here might need to correct me but this is the way I think it works.

  • Scotty

You are correct in your understanding Scotty.

Yeah that is what i figued thanks for clearing everything up.