Guten Morgen,
ich habe Code, der vorher für einen ATMega geschrieben für einen ATTiny
angepasst. Nun habe ich das Problem, dass ich nicht weiß, welcher
externer Pin geschaltet wird. Es ist für mich noch etwas neuland, direkt
mit den Timern zu arbeiten.
Da ich auf den ATTiny noch warte bis er ankommt, würde ich gerne schon
den Code und die Platine fertig machen.
hier meine Config des Timers:
1 | #define Timer_Clk 0x01
|
2 |
|
3 | ....
|
4 |
|
5 | // Here are some instructions that write directly to registers.
|
6 | // The goal is to set the PWM frequency as fast as possible
|
7 | // and to activate the right output(s).
|
8 | TCCR0A = _BV(COM0A1) | _BV(COM0B1) | _BV(WGM01) | _BV(WGM00);
|
9 |
|
10 | TCCR0B = _BV(Timer_Clk); // Set prescaler to 1.
|
11 | // Another direct register write.
|
12 | OCR0A = pwm; // Set duty cycle (0..255).
|
Danke im Vorraus :)