How do I set timer TCCR1B on mega2560

I'll preface this by stating I'm a bit of a noob when it comes to coding so bear with me.

I'm trying to set the pwm frequency on my mega2560 to as close as possible to 293hz. Don't ask why that hz but let's just say a lot of money and engineers decided thats the correct operating freqeuncy for a particular solenoid in a particular application.

I read somewhere, that escapes me now, how to manipulate the pwm to just about any desired freq and if that is indeed possible that would be great.

I'm having a bit of trouble wrapping my head around the proper syntax for accomplishing the desired results using timers in general.

Thanks in advance.
Bill

We can't help with your syntax unless you show us your code - and please use code tags (explained in the How To ...).

Have you read the appropriate Atmel datasheet - it has all the details.

...R

Robin,

I did just that and found my answer. Although it took the datasheet and some web hunting to get to the info I was seeking on a level I could comprehend. :slight_smile:

Bill