EmbDev.net

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


von Florian M. (flormaye)


Rate this post
useful
not useful
Hi everyone,


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

http://interface.khm.de/index.php/lab/interfaces-advanced/arduino-frequency-counter-library/


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
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
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?


Greetings
Flo

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.