Go Down

Topic: <Help> Using internal timer as counter by feeding external clock (Read 1 time) previous topic - next topic

yck011522

Hi all,

As the topic: I'm bridging a ICL7135 AD Converter to Arduino. It is a 4 1/2 bi-polar Voltmeter, some people may be familiar with this IC if they have built a digital voltmeter.
I need the internal 16 bit counter to count a stream of pulse when a certain input is HIGH for a period.

The input frequency is about 100KHz - 300KHz (Which I can choose)

I'm new to Arduino system and microcontrollers especially when dealing with registers. I've read some writings about modifying the registers to control the timer 1 (or 3 etc.) in ATMEGA 1280
I'm using a Arduino Mega with ATMEGA1280.

I think I can change and read the value TCNT1 by saying:
TCNT1 = 0
i = TCNT1

However, I could not figure out how to set the control registers: TCCR1A and TCCR1B
and, Which input pin will I have to use to supply the clock?
and, How to start and stop and reset the counter?

I read some of the Frequency Counter Library, which is similar.
http://interface.khm.de/index.php/lab/experiments/arduino-frequency-counter-library/
But I could not understand all of it.

Thanks in advance.

Victor

Go Up