weiß nich mehr... motor pwm stuff

This commit is contained in:
john stone 2012-07-24 19:51:15 +02:00
parent 6ac7134589
commit cb1e79ad2c

View File

@ -16,7 +16,7 @@ static inline void init_pwm(void)
TCCR1A = (1<<COM1B1) | (1<<WGM11); // only b-chan , fastpwm (mode 14) TCCR1A = (1<<COM1B1) | (1<<WGM11); // only b-chan , fastpwm (mode 14)
TCCR1B = (1<<WGM13)|(1<<WGM12) | (1<<CS10); //Fastpwm, no prescale TCCR1B = (1<<WGM13)|(1<<WGM12) | (1<<CS10); //Fastpwm, no prescale
return return ;
} }
static void init_leds(void) static void init_leds(void)
@ -30,8 +30,8 @@ static void init_leds(void)
inline void setleds(uint8_t state) inline void setleds(uint8_t state)
{ {
//set leds according to //set leds according to
PORTC |= (state | 0 b00001111); PORTC |= (state | 0b00001111);
PORTC &= ~(state | 0 b11110000); PORTC &= ~(state | 0b11110000);
return; return;
} }
@ -45,11 +45,9 @@ static void init_motor(void)
static void stupid_pwmtest(void) static void stupid_pwmtest(void)
{ {
for (;;) { for (;;) {
OCR1BH = 0; OCR1B = 0xc3d2;
OCR1BL = 0;
_delay_ms(1); _delay_ms(1);
OCR1BH = 0xff; OCR1B = 0xeff;
OCR1BL = 0xff;
_delay_ms(1); _delay_ms(1);
} }
return; //never return; //never