Garrett 712120 VNT Hella 6NW 008 412 actuator.
Garrett 712120 VNT Hella 6NW 008 412 actuator.
(09-04-2009, 12:29 PM)winmutt Well like I said I can bit bang it, its just that 140hz is very odd for a PWM I would think, its not a factor of binary.
Quote:If I'm reading the datasheet properly, those are the max frequencies when using those specific clock sources. Look at page 120 of the datasheet, and use "Fast PWM mode". You'll use the 16Mhz clock frequency divided by 8 as the clock source to the timer (TCCR1B = xxxxx010). This determines the frequency of the "ticks" (500ns). Since it is a 16-bit counter, you can have up to 65,535 ticks in the period. 7.1ms / 500ns = 14,200 ticks, which will give you the 140Hz frequency. Use the fast PWM mode where you put "top" in ICR1 (WGM13:0 = 14), and load the 14,200 into ICR1. In order to change the duty cycle you will load a number into OCR1x between 0 and 14,200. The percentage of 14,200 you enter will be the duty factor.
Did that make any sense? The datasheet is still pretty confusing to me...
(09-04-2009, 12:29 PM)winmutt Well like I said I can bit bang it, its just that 140hz is very odd for a PWM I would think, its not a factor of binary.
Quote:If I'm reading the datasheet properly, those are the max frequencies when using those specific clock sources. Look at page 120 of the datasheet, and use "Fast PWM mode". You'll use the 16Mhz clock frequency divided by 8 as the clock source to the timer (TCCR1B = xxxxx010). This determines the frequency of the "ticks" (500ns). Since it is a 16-bit counter, you can have up to 65,535 ticks in the period. 7.1ms / 500ns = 14,200 ticks, which will give you the 140Hz frequency. Use the fast PWM mode where you put "top" in ICR1 (WGM13:0 = 14), and load the 14,200 into ICR1. In order to change the duty cycle you will load a number into OCR1x between 0 and 14,200. The percentage of 14,200 you enter will be the duty factor.
Did that make any sense? The datasheet is still pretty confusing to me...