Hallo raid_ox,
vermutlich sollte es so gehen...
(dies ist ein ausschnitt aus dem Yeti Init Funktion, der funktioniert gleich wie Asuro)
Code:
//------------------------------------------------------------//
// Init USART for RS232 communication //
//------------------------------------------------------------//
// Init Atmega USART for RS232 communication (connected to Yeti InfraRed transmitter/receiver)
// default init
UCSRA=0x00;
// default init
UCSRB=0x00;
// select UCSRC, no parity, 1 stop bit, 8 databits per character
UCSRC=(1<<URSEL)|(1<<UCSZ1)|(1<<UCSZ0);
// select baudrate 2400bps when using 8.0000MHz oscillator (see table 62 in pdf)
UBRRL=0xCF;
//------------------------------------------------------------//
// Init Timer2, used for generating RS232 IR carrier signal //
//------------------------------------------------------------//
// prepare 36kHz for IR - Communication
// WGM21: waveform generation mode 2 => CTC mode => TOP = OCR2
// (Only counting up until value OCR2 (TOP) reached)
// COM20: Toggle OC2 on Compare Match
// CS20: No prescaling (so Timer2 clock frequency = 8MHz = 125ns)
TCCR2=(1<<WGM21)|(1<<COM20)|(1<<CS20);
// 0x6E = 110, so frequency is 110 * 125ns = 13.75us = 72.727KHz
// as output is toggled, the real frequency is 72.727KHz / 2 = appr. 36KHz
OCR2=0x6E;
//------------------------------------------------------------//
// Set 36KHz carrier pin as output
//------------------------------------------------------------//
// set carrier signal pin PB3/(MOSI/OC2) as output
DDRB|=(1<<PB3);
Gruss,
Henk
Lesezeichen