Author Topic: setPWMPrescale() not quite as implied in reference?  (Read 1517 times)

0 Members and 1 Guest are viewing this topic.

denard

setPWMPrescale() not quite as implied in reference?
« on: August 21, 2012, 12:36:19 PM »
I'm new to the Wiring S board and this forum.  I'm not sure if this is a h/w problem or the reference(?). 
When I use pins 4 or 5 for PWM output (Wiring S board), I can only use the default pre scale number (64, and possibly _NO_PRESCALE I think), which results in an output  frequency of ~122Hz (or ~7.8kHz).  If I try another prescale, it seems to compile and load OK, but there is no output (this is with resolution at default 8-bit).  If I use pin 6 or 7, I can successfully use other pre scale numbers, but get a different output frequency.  E.g. I need a prescale of 256 to get ~122Hz out, implying a derived clock frequency of ~31kHz.
This is not what I expected given the reference description for this method.  Has any one else observed this with the Wring S board and Wiring 1.0?

Denard
ps. The Wiring S board seems very versatile, and the Wiring s/w is GREAT - very intuitive, forgiving and flexible.  My experience so far has exceeded my expectations!  Thanks to the team for all the work!!

barragan

Re: setPWMPrescale() not quite as implied in reference?
« Reply #1 on: August 22, 2012, 12:49:43 PM »
hi, in Wiring S board the 9 and 10 bit PWM resolution capable pins are: 4 and 5. Pins 6, 7, 19 and 20 are 8 bit resolution only. I believe, this might apply to some prescale not being available on certain timers, let me check with the datasheet, and will get back to you.