Last active
May 16, 2019 11:00
-
-
Save avr-programmierung/7be82970fbc6fcb00090625398102f3f to your computer and use it in GitHub Desktop.
ATmega88 @ 1MHz Pulsweitenmodulation 1kHz 02
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* pwm_1khz_02.c ATmega88 @ 1MHz */ | |
#include <avr/io.h> | |
int main(void) | |
{ | |
DDRB |= (1<<PB1); // OC1A = output | |
ICR1 = 1000; // Top Value = 1000 | |
OCR1A = 700; // Compare Match bei 700 | |
// Clear OC1A on Compare Match | |
TCCR1A = (1 << COM1A1) + (1 << WGM11); | |
// Mode 14, Fast PWM, OCR1A = TOP, Prescaler = 8 | |
TCCR1B = (1 << WGM13) + (1 << WGM12) + (1 << CS11); | |
while(1) | |
{ | |
asm ("NOP"); // Nichts tun | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment