Našel sem něco takového github.com/Hasi123/generate-ppm … y.inojenom to potřebují přeložit do C
Tady sem začal ale výstupu OC1A je jenom LOG 1 neměl by se mi tam objevit start puls
[code]#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
uint16_t chanel[7];
int main (void){
DDRA |= (1<<PA0); //LED
DDRD |= (1<<PD5);
// TCCR1A |= (1<<COM1A1) | (1<<COM1A0); // set polarity 1
TCCR1A |= (1<<COM1A1); // set polarity 0
OCR1A = 100; // compare match register, change this
TCCR1B |= (1 << WGM12) | (1 << WGM13) | (1 << WGM11) | (1 << WGM10); // turn on CTC mode
TCCR1B |= (1 << CS11); // 8 prescaler: 0,5 microseconds at 16mhz
TIMSK |= (1 << OCIE1A); // enable timer compare interrupt
sei();
while(1){
_delay_ms(500);
PORTA ^= (1<<PA0); //LED
}
}
ISR(TIMER1_COMPA_vect){
static uint8_t state = 1;
TCNT1 = 0;
if(state){
TCCR1A |= (1<<COM1A1) | (1<<COM1A0); // set polarity 1
OCR1A = 600;
state = 0;
}
else{
TCCR1A |= (1<<COM1A1); // set polarity 0
state = 1;
}
}[/code]