# Interfacing TLC1543CN adc with 8051

I am confused with the I/O clock input mentioned in this datasheet: http://www.ti.com/lit/ds/symlink/tlc1543.pdf

Do I need to output clock from this adc to 8051 or do I need to use an external crystal for both the TLC1543CN and 8051 together?

• Welcome to EE.SE! Please provide a screenshot or quote text from the relevant section of the datasheet. It's helpful and the best format on StackExchange sites to have all of the necessary information provided in your question or answer without relying on web links. Aug 7, 2016 at 21:17

It's not that confusing to read. There is a diagram near the end of the datasheet that shows a nominal arrangement between the a CPU (8051) and the ADC IC. And there is a section called "DETAILED DESCRIPTION" which makes things a lot clearer.

In general, the I/O Clock (which is really an input) line is used by your 8051 to "clock out," in serial mode, the prior reading. Your code is supposed to operate this clock (using a pin configured as an output pin) and to operate the chip select line (using another pin, if you have one, also configured as an output pin) and while that is happening also observe the data line (using yet another pin configured this time as an input.) You also may need to operate the address input pin for a part of the time you are also operating the clock line (using yet another 8051 pin configured as an output.)

The clock line also triggers other actions along the way, such as charging a capacitor array, or starting the next conversion near or at the end of a short series of clock cycles. The rate at which you clock this line, it says, cannot exceed 2.1MHz. It's not likely you'll need it to be that fast, as the conversion time appears to be about $\le$21$\mu$s and you'll use perhaps at most some 16 cycles to clock out the data. So there is room. It appears you can run the I/O clock as slow as you want, too. So you can "bit bang" everything in your 8051 code (which makes bit banging really easy at the assembly level.)

There are lots of timing diagrams near the end of the datasheet which tell you what to do in each of its modes, in software. Is there something that you don't understand there? Normally, you just bit bang the clock line while also sampling (reading) the data out pin. There's more (as there is addressing involved and a chip select, for example.) But it's just minor details along the way.

The 8051 does need a clock source. Usually, this is provided by applying a crystal between XTAL1 and XTAL2, plus a couple of tiny 30pF capacitors. I don't know which 8051 core you are using (I still have a hundred 80C32's from Intel, but I've used SiLab's [Cygnal's] 8051's too and there are more manufacturers than that), but you may also be able to drive one of those with a separate oscillator. You will have to check the datasheet for the device to find out various options. But you DO have to have a working hardware oscillator that drives the 8051 to make it work. There is no avoiding this requirement of the 8051. It needs a clock source of some kind. You cannot just apply power and expect it to run correctly.

Once the 8051 runs correctly, though, it's NOT the case that your ADC IC needs to have its clock line driven by such an oscillator. In fact, few would consider doing that and I don't even want to consider whether or not someone could make it work. (I'd have to read the ADC IC docs more than I want to, right now.) Instead, you just write software to manage the lines. You will have to program things so that the pins are properly configured, first. Then you will have to write lots of other software, some of which will be a subroutine or main-line bit of code that operates in a loop designed to extract a prior reading while initiating the next one. This is just very standard fare. You wire up a clock line, a data line, an address line in this case, probably a chip select (though this is optional, I believe) and perhaps something I've missed writing just now. Your software will operate ALL of them, changing the output pins properly and reading the input pin (data) at appropriate moments. The lucky thing here is that since you are driving all the other lines, you know EXACTLY when to read the data line. So it's really very, very easy to do.

None of this deals with the analog input lines. Given the difficulties you are having understanding something this simple and more "software-ish" than hardware-like, then I really, really worry about how you are going to properly design anything to operate the analog input lines -- where there is no question you will need to read other parts of the datasheet that does deal with hardware knowledge you need and will require some design knowledge on your part. Even the most basic analog inputs need some kind of conditioning and probably also protection.

Asking, "do you mean by inputting a clock to xtal1 and then outputting it through xtal2 to adc clock input," tells me that you are in for a world of hurt here. It's so completely off where your mind needs to be that I fear much more than just you figuring out how to clock out an address and clock in some data.

It's basic stuff that you want to do. But it is basic stuff that does depend on some fundamental knowledge you don't appear to have yet acquired. And if you are worried about a two week shipping delay, then this tells me you are in way too much of a rush for the learning you have ahead. Slow down. Allow yourself time to slowly acquire what you need to learn about. This is a great project in that sense, I think, in order to lift yourself up by your own bootstraps. But it will take time. You need to be prepared for that.

• I will check the datasheet again tomorrow and report back with all the unclear parts if there are any. I am a bit new with this stuff. Aug 7, 2016 at 20:28
• Ok. This skill is a very, very frequently needed one. So what you learn here will apply in other situations you will soon find yourself involved within, I suspect.
– jonk
Aug 7, 2016 at 20:39
• I am software guy. Usually I just follow the instructions on some tutorial and write the code myself. This is going to be a hard one. Aug 7, 2016 at 20:49
• I'm also a software guy. Electronics is just a hobby. For embedded programmers, it is my firm opinion that electronics is a necessary hobby. Not an optional one.
– jonk
Aug 7, 2016 at 20:52
• I also do this for a hobby. So I do not need crystal with lower frequency and instead I can output pulse (with lower frequency than 2.1Mhz) from a regular data pin? Should I use internal timer interrupt for this? Aug 8, 2016 at 9:01