Znaleziono 4 wyniki

autor: Serwik
14 kwie 2010, o 20:32
Forum: AVR/AVR32
Temat: [Atmega8] Problem ze zmiennym okresem dzialania pętli
Odpowiedzi: 8
Odsłony: 11460

PWM na atmega162

Troszkę się męczę z uruchomieniem PWM #include <avr/interrupt.h> #include <avr/io.h> int main(void) { PORTD=0x00; DDRD=0x00; //PWM, phase correct, 8-bit | Prescaler /8 TCCR3B = _BV(WGM30) | _BV(CS31); TCNT3 = 0x00; ICR3 = 20000; OCR3A = 1000; //sei(); while (1) { }; } Ten prosty kod powinien (?) uru...
autor: Serwik
11 mar 2010, o 21:46
Forum: AVR/AVR32
Temat: [Atmega8] Problem ze zmiennym okresem dzialania pętli
Odpowiedzi: 8
Odsłony: 11460

Pożądany efekt uzyskałem w poniższy sposób. Niemniej delay'e są na tyle uciążliwe ze trzeba będzie sprawdzić co to jest to PWM :597: #define F_CPU 4000000L #include <avr/io.h> #include <util/delay.h> void my_delay_us(int us) { while(us>0) { us-=100; _delay_us(100.0); } } int main(void) { int t = 150...
autor: Serwik
11 mar 2010, o 19:16
Forum: AVR/AVR32
Temat: [Atmega8] Problem ze zmiennym okresem dzialania pętli
Odpowiedzi: 8
Odsłony: 11460

No prosze znalazlem odpowiedz w delay.h \note In order for these functions to work as intended, compiler optimizations <em>must</em> be enabled, and the delay time <em>must</em> be an expression that is a known constant at compile-time. If these requirements are not met, the resulting delay will be ...
autor: Serwik
10 mar 2010, o 23:08
Forum: AVR/AVR32
Temat: [Atmega8] Problem ze zmiennym okresem dzialania pętli
Odpowiedzi: 8
Odsłony: 11460

[Atmega8] Problem ze zmiennym okresem dzialania pętli

Próbowałem zrobić prosty program do sterowania serwem (Hitec HS311). Kod miał działać tak aby generować na wyjściu D procesora impuls o określonej szerokości a po nim 0 tak aby okres (impuls i zero) był stały (period=20ms) Impuls jest sterowany przez zmienną t, która waha się w przedziale od 0.6 do ...

Wyszukiwanie zaawansowane