100Hz Rechtecksignal am OC1A (Pin 15) erzeugen
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
/* rectangle_01.c | |
* Ein 100Hz Rechtecksignal am OC1A (Pin 15) erzeugen | |
* Controller: ATmega88 @ 1MHz */ | |
#include <avr/io.h> | |
int main(void) | |
{ | |
DDRB |= (1<<PB1); // OC1A = output | |
OCR1A = 39999; // Compare match auf 39999 setzen | |
TCCR1A = (1 << COM1A0); // Toggle OC1A bei einem Compare Match | |
TCCR1B = (1 << WGM12) + (1 << CS10); // Mode 4, CTC on OCR1A und Prescaler = 1 | |
while(1) | |
{ | |
asm ("NOP"); // Nichts tun | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment