Forum > Embedded - AVR
Extra help debugging for 4 separately used PWM channels, with the atmega328p
(1/1)
pascalbythree:
Can somebody please help me out debugging this peace of source code ?
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---ModePortB(1,true); TCCR1A := (%10 shl COM1A) or (%10 shl COM1B) or (1 shl WGM1); TCCR1B := TCCR1B or %101; OCR1B := 125; // INTERNAL LIGHT EFFECT ModePortB(2,true); TCCR1A := (%10 shl COM1A) or (%10 shl COM1B) or (1 shl WGM1); TCCR1B := TCCR1B or %101; OCR1A := 125; // LED BAR 4 ModePortD(6,true); TCCR1A := (%10 shl COM0A) or (%10 shl COM0B) or (1 shl WGM1); TCCR1B := TCCR1B or %101; OCR0A := 125; // LED BAR 5 ModePortD(5,true); TCCR1A := (%10 shl COM0A) or (%10 shl COM0B) or (1 shl WGM1); TCCR1B := TCCR1B or %101; OCR0B := 125; // LED BAR 6
The INTERNAL LIGHT EFFECT and the LEDBAR 4 blinks just fine.
What to change to get the LED BAR 5 and LED BAR 6 channel to work at the same time?
PS: It has to run 4 different values.
Greets, Wouter van Wegen
Laksen:
TCCR0A/B instead of 1?
pascalbythree:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- // SETTTING ALL PWM MODUS FOR 4 DRIVERS ModePortB(1,true); TCCR1A := (%10 shl COM1A) or (%10 shl COM1B) or (1 shl WGM1); TCCR1B := TCCR1B or %010; OCR1B := 0; // INTERNAL LIGHT EFFECT ModePortB(2,true); TCCR1A := (%10 shl COM1A) or (%10 shl COM1B) or (1 shl WGM1); TCCR1B := TCCR1B or %010; OCR1A := 0; // LED BAR 4 ModePortD(6,true); TCCR0A := (%10 shl COM0A) or (%10 shl COM0B) or (1 shl WGM1); TCCR0B := TCCR1B or %010; OCR0A := 0; // LED BAR 5 ModePortD(5,true); TCCR0A := (%10 shl COM0A) or (%10 shl COM0B) or (1 shl WGM1); TCCR0B := TCCR0B or %010; OCR0B := 0; // LED BAR 6
Thank you, it got to work already like this!
Navigation
[0] Message Index