RoGuE_StreaK
Joined: 02 Feb 2010 Posts: 73
|
|
Posted: Sun Feb 12, 2012 8:58 pm |
|
|
| Ttelmah wrote: | The value for the period on timer2, can be up to 255, so with 255 selected, you get:
(255+1)*4 = 1024
and -1 gives 1023, as the full scale value.
If you select a lower count value for timer1, the frequency goes up, and the available resolution goes down. So with 127 selected, you get 511 as the maximum value (0 to 511 = 512 values - 9bit resolution), but double the frequency. | Sorry to dig this up again, but it seemed relevant;
I'm working with 8bit sound, so natively the values are 0-255, which fits in rather nicely with a period of 255.
But from the above, if I change this to be a 16bit value | Code: | | setup_pwm_duty((int16)dutyValue); //? | does that mean by reducing the period to 63, I can keep my full 8bit range but quadruple the frequency?
PS. If moving to a PIC24F, it indicates that "Tcy = 2*Tosc"; I assume that means anywhere we see "*4" or "/4" we just substitute 2 for 4? So the above would double rather than quadruple? |
|