Forum: µC & Digital Electronics Evaluate two signals -- Change input Timer 1 Source between T1 and T0

von Florian M. (flormaye)

Rate this post
0 useful
not useful
Hi everyone,

I'm using this code to evaluate capacity (change of frequency) on a 
Bluno beetle ATmega328P.


The code works fine but I need to evaluate two signals.
Is it possible to change the input Pin T1 of timer/counter 1 to T0 or 
one of the INT0/INT1?

I need to use Timer 1 because this one uses 16 bit registers. Had a look 
into the .ccp-File and read the chips datasheet and went pretty deep but 
could not figure out if there is a way to change the import pins. From 
what I understand the T0/T1 is fixed to the timers. But I'm not an 
expert so might be wrong.

I can also use an external analog switch but this is last option due to 
space limitatioins.

I hope someone can help me with this

Greetings Flo

von matzetronics (Guest)

Rate this post
1 useful
not useful
Yes, the T0 resp. T1 Pins are fixed to their timers. You cannot clock 
the T0 pin to advance Timer 1.
Its is possible though, to switch the T1 Pin to output and still let 
Timer 1 count pulses with it. Toggling the T1 pin by software then 
clocks Timer 1.

von Florian M. (flormaye)

Rate this post
0 useful
not useful
@ matzetronics

Thanks for the reply! Ok this sounds good.
I can set PD5 (T1) to output by:

DDRD =DDRD | B00000000;

But how can I then toggle for example interrupt INT1 (PD3) as input for 
timer I clock edge detector?

I cann not find the register for it in the datasheet.

Can you give me a hint how to do this?



Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.