SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
By cncbasher
thanks Vraz , the ultimate is to drive a motor and be able to ramp the speed of the motor using pid as they will be a hall sensor monitoring RPM and then not only have speed control from the rc as is usual , but also have the motor under RPM control within a dead band area , hence the thoughts of using pwm , and using the code as a starting block , amongst also using one other rc channel as a start / emergency stop switch

i mostly code in c but it's my first time with an avr , pwm and interrupts , and i hate assembler .

so a learning curve is in order , we all had to start somewhere , i am just wondering why start here !

thanks for the handholding it is appriciated
By cncbasher
oh forgot to add their is also a servo to control too which is connected to a fuel supply valve , i hope then at most theirs only 3 rc input ppm channels to monitor , although only one ( servo ) requires pwm control , if that makes sense

Vraz Wrote:
>The PPM input code uses polling (not interrupts) and thus would be extremely difficult to extend to multiple channels.>

If I were a rude impolite person I'd say "b.u.l.l.s.h.i.t" but I'm not, so I won't.
This is polled here:
I'm reading in 9 RC channels, 3 analogue piezo gyros and 1 analogue battery monitor, while simultaneously running 3 PID algorithms and driving 4 motors with PWM using an ATMega128.
I've actually tapped off the raw serial PPM signal rather than read individual 1-2ms decoded output pins. The main reason for reading the raw PPM is because the receiver's onboard decoder wasn't high enough resolution for me.
If you choose to read individual decoded outputs though, the important thing to remember is that you don't need to read each and every discrete channel output pin. Doesn't make any sense to me.
If you remember that Ch1 end pulse falls precisely on Ch2 start pulse and Ch3 start pulse is Ch2 end pulse etc. .. you therefore don't need CH2, 4,6,8 etc pins.
I'll leave the implementation up to you, but save your I/Os and interrupts.
Why use more than you need to ?
In fact, polling gives higher count resolution than using interrupts method.
Interrupts waste clock cycles due to the overhead involved.

long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]