Talk to me about Arduino Uno Timers

I would like to know more about the internal timers of the Arduino Uno. Re-reading the datasheet was not of much help.

In my last project I set up a 1mSec timer running on an interrupt using Timer1. The program used no ADC, I2C, serial, or one wire communication. Everything in the program works perfectly.

Next project has all of the above 1mSec timer, ADC inputs (two or three of them), I2C for a 20x4 LCD (using the newliquidcrystal library), I2C communication to a DAC, serial communication to the PC, one-wire communication to a DS18B20, and millis() calls.

Let's start with which timers are used by each of those elements?

ADC inputs (two or three of them)

None

I2C for a 20x4 LCD (using the newliquidcrystal library), I2C communication to a DAC

None.

serial communication to the PC

None

one-wire communication to a DS18B20

Check the library documentation.

and millis() calls

Timer0.

Drat. That wasn't the answer I was hoping for.

On a side note. I2C, serial, and one wire are all serial communication protocols. How do they go about timing the bits?

adwsystems:
Drat. That wasn’t the answer I was hoping for.

On a side note. I2C, serial, and one wire are all serial communication protocols. How do they go about timing the bits?

The TWI (I2C) and UART (Serial) peripherals have their own baud rate generators separate from the Timer peripherals.

However, the Uno does not have a native One Wire peripheral, so it needs to be mimicked using what capabilities the chip does have. I have not used any One Wire devices before, so I don’t know how it’s done. That is why I advised you to check the library documentation. If it doesn’t have documentation, check the code yourself and see if it’s setting up any timers.

In programming the timer 1 interrupt, I thought I read something about the ADC using a timer. At the time I didn't care so I passed over it. Now that I need it, I can't find it. Or did I imagine it?

I thought I read something about the ADC using a timer.

The ADC can run at several different clock frequencies, but they come from the system clock and not the hardware timers.

https://www.gammon.com.au/adc

adwsystems:
In programming the timer 1 interrupt, I thought I read something about the ADC using a timer. At the time I didn't care so I passed over it. Now that I need it, I can't find it. Or did I imagine it?

You might be thinking of auto-triggering. Instead of manually initiating conversions, you can configure the ADC to automatically start a conversion when certain events happen. These events can come from Timer0, Timer1, the analog comparator, external interrupt 0, or just free running (as soon as one conversion finishes, the next one starts immediately).

I never said the conversion was manually triggered. In fact it is not manually triggered.

Then you should have mentioned that.

And if you've set up the ADC for auto-triggering, you should know what you set it to trigger off of.

I didn't want to bog down the conversation of what timers do what with how my program is (or is not) working. Depending on the information, I'll start another thread to discuss that. As for now I am trying to gather information and knowledge on the namespace timers that I and everyone may be able to put to use.

The question is/was that I had thought I read something about the ADC using one of the namespace timers (Timer0/1/2) for the conversion process. I didn't not want to be using a namespace timer that is stepped or will step on another function. I also thought I saw the millis() function uses Timer0, which is why I chose to use timer 1 in my previous project. Is that also wrong? Does millis() use timer0? Good for my knowledge. If it does then I'm covered. If it doesn't then I'm still covered.

I also thought I saw the millis() function uses Timer0, which is why I chose to use time 1 in my previous project. Is that also wrong? Does millis() use timer?

You are correct. millis() uses Timer0.