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.

PWM algo

Status
Not open for further replies.

fusian

New Member
1. configure CCP1 pin output

2. set PWM period(PR2 + T2CON)

3. set initial PWM duty cycle by writing to CCPR1L:CCP1CON<5:4>

4. enable timer2 int (TMR2IF=0,TMR2IE=1)

5. change PWM duty cycle as you like by writing to CCPR1L:CCP1CON<5:4> during TIM2 ISR. Goto 4.

conceptually, are the above algo correct? my application is to generate different duty cycle of PWM by user request. so can i do it following the algo above by changing the duty cycle during ISR?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top