changed frequencies, suspect running 8 times slower than thought
This commit is contained in:
parent
0894b6aac5
commit
a4db90ecf4
6
main.c
6
main.c
@ -1,4 +1,4 @@
|
|||||||
#define F_CPU 8000000UL
|
#define F_CPU 1000000UL
|
||||||
#include <util/delay.h>
|
#include <util/delay.h>
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#include <avr/interrupt.h>
|
#include <avr/interrupt.h>
|
||||||
@ -22,7 +22,7 @@ void count(void)
|
|||||||
{
|
{
|
||||||
//counts=0;//0..65535
|
//counts=0;//0..65535
|
||||||
counts++;
|
counts++;
|
||||||
if(counts>=31)
|
if(counts>=128) //1m //1ms
|
||||||
{
|
{
|
||||||
counts=0;
|
counts=0;
|
||||||
if(ms<60000)//1 minute
|
if(ms<60000)//1 minute
|
||||||
@ -68,7 +68,7 @@ int main (void) { // (2)
|
|||||||
cli();
|
cli();
|
||||||
//#######Timer0-setup##### |Phase correct pwm
|
//#######Timer0-setup##### |Phase correct pwm
|
||||||
TCCR0A = (1<<COM0A1)|(1<<COM0B1)|(1<<WGM00)|(1<<WGM01); //mode fast pwm (1/Fcpu)*prescaler*(max+1) =
|
TCCR0A = (1<<COM0A1)|(1<<COM0B1)|(1<<WGM00)|(1<<WGM01); //mode fast pwm (1/Fcpu)*prescaler*(max+1) =
|
||||||
TCCR0B = (1<<CS00)|(1<<CS00); //frequency /256 = 31250Hz , 1 t0 period = 8.192ms 1 increment = 0.032ms strangly prescaler of 1 results in expected results as prescaler was 256
|
TCCR0B = (1<<CS01)|(1<<CS01); //prescaler /64 gives 0...255 0.002048s = 2.0ms 1mhz-> /8
|
||||||
|
|
||||||
// PLLCSR |= (1 << PLLE) | (1 << PCKE);
|
// PLLCSR |= (1 << PLLE) | (1 << PCKE);
|
||||||
//######Timer1-setup
|
//######Timer1-setup
|
||||||
|
Loading…
Reference in New Issue
Block a user