Using timer2 problem


hi,

i trying use timer2 on arduino uno having unexpected behaviour understand , fix. have attached library have created , have been using.

basically problem lies when trying set timer period using either enabletimerinterrupt(void (*isr)(), unsigned long microseconds=0) or enablepwm(uint8_t pin, uint8_t duty, unsigned long microseconds=0) functions.

setting microseconds 2000 or less, resulting period close enough target value.

however cannot seem higher that. example if try set microseconds 4000 or more, end period of 2ms or less!  :o

any ideas on what's gone wrong here?

quote
any ideas on what's gone wrong here?
code: [select]
#define resolution 256    // timer2 8 bit

resolution*prescaler in setperiod defaulting integer , overflowing.

try
code: [select]
#define resolution 256ul    // timer2 8 bit



Arduino Forum > Using Arduino > Programming Questions > Using timer2 problem


arduino

Comments

Popular posts from this blog

DHT11 Time out error using v0.4.1library

Sketch upload fails with Java error (___REMOVE___/bin/avrdude)!

Arduino Uno + KTY81/210 temperature sensor