Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.

Latest threads

New Articles From Microcontroller Tips

Back
Top