m328. Противофазный ШИМ с шагом 4% :
void power(char power) // подпрограмма 125 KHz rf модулятора (power: 0 - выключен 25 максимальная мощность )
{
OCR1AL=power; //25 - on 0 - off
OCR1BL= 50-power; //25 - on 50- off
}
void rfid_init(void)
{
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: 12500000 Hz
// Mode: Ph. correct PWM top=ICR1
// OC1A output: Non-Inv.
// OC1B output: Inverted
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer 1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0xB2;
TCCR1B=0x11;
TCNT1H=0x00;
TCNT1L=0x0F;
ICR1H=0x00;
ICR1L= 50; // 50 - 125 kHz
OCR1AH=0x00;
OCR1AL=0x00; //25 - on 0 - off
OCR1BH=0x00;
OCR1BL= 50; //25 - on 50- off
}
.....
power(POW_L); //on
power(0); //off
....