Start Back Next End
  
ZBasic System Library
203
ZBasic Microcontrollers
Available 8-bit PWM Frequencies at 14.7MHz
Prescaler
Divisor
Fast PWM
Frequency
F_CPU / Div / 256
Phase Correct PWM
Frequency
F_CPU / Div / 510
1
57,600.0
28,912.9
2
28,800.0
14,156.8
4
1.440
7,228.2
8
7,200.0
3,614.1
16
3.600.0
1,807.1
32
1,800.0
903.5
64
900.0
451.8
128
450.0
225.9
256
225.0
112.9
1024
56.3
28.2
In the table above, the frequencies in the shaded rows are not available on some ZBasic devices due to
the set of available prescaler divisors on the 8-bit PWM timer.  The table below gives the set of prescaler
divisors for each target device.
Available Prescaler Divisors for the 8-bit PWM Timer 
Target Devices
Prescaler Divisors
tiny48, tiny88, tiny24, tiny24A, tiny44, tiny44A, tiny84, tiny84A, tiny441, 1, 8, 64, 256, 1024
tiny841
tiny87, tiny167, tiny1634
1, 8, 32, 64, 128, 256, 1024
tiny2313, tiny2313A, tiny4313, tiny828
1, 8, 64, 256, 1024
mega48, mega48A, mega48P, mega48PA, mega48PB, mega88,
mega88A, mega88P, mega88PA, mega88PB, mega168, mega168A,
mega168P, mega168PA, mega168PB, mega328, mega328P,
mega328PB
1, 8, 32, 64, 128, 256, 1024
mega16, mega16A, mega32, mega32A , mega644, mega644A,
mega164A, mega164P, mega164PA, mega324P, mega324PA,
mega644P, mega644PA, mega1284P
1, 8, 32, 64, 128, 256, 1024
mega8515, mega64, mega64A, mega128, mega128A, AT90CAN32,
AT90CAN64, AT90CAN128
1, 8, 64, 256, 1024
mega1281, mega2561, mega640, mega1280, mega2560
1, 8, 64, 256, 1024
mega8U2, mega16U2, mega32U2, AT90USB82, AT90USB162,
AT90USB646, AT90USB647, AT90USB1286, AT90USB1287
1, 8, 64, 256, 1024
mega16U4, mega32U4
1, 2, 4, 8, 16, 32, 64, 128, 256, 1024
mega8535, mega161, mega162, mega163, mega323
1, 8, 32, 64, 128, 256, 1024
mega165, mega165A, mega165P, mega165PA, mega325, mega325P, 1, 8, 32, 64, 128, 256, 1024
mega645, mega645A, mega645P, mega169, mega169A, mega169P,
mega169PA, mega329, mega329P, mega329PA, mega649,
mega649A, mega649P
mega3250, mega3250P, mega6450, mega6450A, mega6450P,
mega3290, mega3290P, mega6490, mega6490A, mega6490P
1, 8, 32, 64, 128, 256, 1024
all xmega
n/a
Example
Call OpenPWM8(1, 50.0, zxFastPWM)  'prepare for 50Hz Fast PWM using channel 1
Compatibility
This subroutine is not available in BasicX compatibility mode nor is it available on ATxmega-based
ZBasic devices.
Previous page Top Next page