go_away

Author Topic: Is it possible to do PWM while capturing signal as well with Timer1?  (Read 987 times)

0 Members and 1 Guest are viewing this topic.

Offline aludra_55Topic starter

  • Jr. Member
  • **
  • Posts: 22
  • Helpful? 0
I'm not that familiar with Atmega168/328 so I need help...  I've also read the
datasheet.  It is education but still kinda confusing for beginners.

I've enabled hardware PWM generator using Timer1 on two pins to control
two servos.  From what I've researched in the internet so far, Timer1 uses
ICR1. 

Now, I've used the pulseIn command (Arduino) to capture an incoming RC
signal from a receiver but it's pretty much noisy.  Probably because the resolution
of the timer of the pulseIn command is not high enough.  That's why I want to
use the 16bit Timer1, which is pretty much occupied with PWM generation for the
two servos.

Now the question.  In the same microcontroller, I would like to know if it's
possible to use ICR1 to capture a signal to calculate the width of the pulse while
still being used for PWM generation?  Thanks in advance.

-AludrA

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,121
  • Helpful? 108
Re: Is it possible to do PWM while capturing signal as well with Timer1?
« Reply #1 on: June 08, 2009, 08:02:28 PM »
It depends on the PWM mode you are using. Finer grained PWM control mode is used by using the ICR to specify the value of top (to get an exact PWM frequency). In which case you cannot the re-use ICR for input capture.
Are you using PWM to control servos or DC motor controllers?
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

 


Get Your Ad Here