About PWM

Status
Not open for further replies.

2001dragon

New Member
Hi, I'm using PWM from Atmega8L to control speed of a DC motor (through opto 6N136 and mosfet IRF540N). The thing is when I used Phase Correct PWM, the DC didn't work as I expected, it was either on RUNNING or STOPPED when I use VR to control speed (no speed changed at all). But when I used Fast PWM, it worked as I expected.

I ask because I read somewhere Fast PWM is for controlling LED, Phase Correct PWM is for controlling motor. Below is my code to initialize PC PWM

Code:
TCCR2 |= (1<<WGM20) | (0<<WGM21);
	TCCR2 |= (1<<COM21); 
	TCCR2 |= (1<<CS20); 
	TCNT2  = 0x00;
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…