Post Created date
ATmega1608 TCB0 Periodic Interrupt mode
Yep, I missed it in the datasheet: 'This bit is cleared by writing a ‘1’ to it or when the Capture register is read in Capture mode.' Thanks!
Saturday, 5 June 2021 - 12:51
Sine wave PWM LED dimming
I generated the values using a little python script; it starts at 90 or 180 degrees (for inverted or no inverted), goes one full cycle, and is halved and offset to be above 0...
Monday, 11 January 2021 - 14:34
Sine wave PWM LED dimming
Just wanted to include the whole picture incase the issue was outside that loop. I get the feeling it's a harware thing related to changing the timer control or DDR regsiter...
Monday, 11 January 2021 - 10:09
Sine wave PWM LED dimming
I've managed to get to cyle through all four LEDs now using both PWM channels and changing the DDR of either the inverted or non inverted output, thus effectively getting 4...
Sunday, 10 January 2021 - 20:40
Sine wave PWM LED dimming
Well thanks everyone for your help, I did manage to get it working by using a switch case; I think my first approach was gettting trapped in while loops somewhere. I'm not...
Saturday, 9 January 2021 - 20:39
Sine wave PWM LED dimming
OK so I made timebase and state volatile, but I still can't get the thing to change modes. I'd have thought that when the ISR is over, and the 'state' variable was incremented, it...
Saturday, 9 January 2021 - 16:44
Sine wave PWM LED dimming
Sorry I don't quite get what you mean. Could you expand a bit? Would disabling and reenabling interrupts clear the stack from 'return to post-interupt' locations or somthing?
Saturday, 9 January 2021 - 16:10
Sine wave PWM LED dimming
OK so I did a bit of research on volatiles, makes sense now, but sadly it wasn't the causee of the issue here :(
Saturday, 9 January 2021 - 14:31
Sine wave PWM LED dimming
Ok so I had another look and decided to put the LED routine in its own function 'lightshow(char mode)' (for now I'm just turning different LEDs on and off in different modes as a...
Saturday, 9 January 2021 - 13:58