atmega128 / pwm / pwm mode 14 / atmega128 pwm
#includeFast PWM Mode 14 구현 1024 프리스케일러에 ICR 값을 320가량을 줘서 20ms 주기의 PWM 신호를 만들었다.void main(void) { DDRB = 0xFF; DDRE = 0xFF; PORTB = 0xFF; PORTE = 0xFF; /* FastPWM 14 mode setting */ TCCR1A |= (1<<1) | (0<<0); //WGM 1, 0 TCCR1B |= (1<<4) | (1<<3); //WGM 3, 2 TCCR3A |= (1<<1) | (0<<0); TCCR3B |= (1<<4) | (1<<3); TCCR1A |= (1<<7) | (0<<6) | (1<<5) | (0<<4) | (1 << 3) | (0 << 2); TCCR3A |= (1<<7) | (0<<6) | (1<<5) | (0<<4) | (1 << 3) | (0 << 2); /* 1024 prescaler */ TCCR1B |= (1<<2) | (0<<1) | (1<<0); TCCR3B |= (1<<2) | (0<<1) | (1<<0); TCNT1H = 0x00; TCNT1L = 0x00; TCNT3H = 0x00; TCNT3L = 0x00; ICR1H = 0x01; ICR1L = 0x36; ICR3H = 0x01; ICR3L = 0x36; OCR1AH = 0x00; //OCR1AL = 0x0A; OCR1AL = 10; OCR1BH = 0x00; //OCR1BL = 0x28; OCR1BL = 40; OCR1CH = 0x00; OCR1CL = 0x20; OCR3BH = 0x00; OCR3BL = 0x08; SREG = 0x80; while(1); }
2014 / 02 / 20 - 01:38 태그 정리
STM32F103 - QuadCopter 참고 소스 (0) | 2014.02.19 |
---|---|
STM32F103 - PWM 소스 (0) | 2014.02.19 |
FB155BC 설정 with USB2UART Downloader (0) | 2014.02.19 |
STM32F103 - Flash Downloader 에러 (0) | 2014.02.19 |
ATmega128 - MPU6050 레지스터 읽기 (5) | 2014.02.19 |