PWM programming with PIC18F4520

Discussion about projects that used PIC Microcontroller, Hardware Interface, Programming Algorithm and etc......

PWM programming with PIC18F4520

Postby masrisan » Wed Dec 05, 2012 11:36 am

Hi.. i hope some one can help me. :D below are some of my coding. tqvm...

void main (void)
{
init();
CCP1CON = 0x0C;
CCP2CON = 0x0C;
PR2 = 255;
T2CON = 0X01;
CCPR1L = 0;
CCPR2L = 0;

while (1)
{
MTRA=1;
MTRB=0;
MTRC=1;
MTRD=0;
CCPR1L = 200;
CCPR2L = 100;
TMR2 = 0;
PIR1bits.TMR2IF = 0;
T2CON.bits.TMR2ON = 1;
while (PIR1bits.TMR2IF==0);

}


my problem is CCPR2L speed are depend based on CCPR1L for example :

1) set CCPR1L = 255 , CCPR2L value can set at any value.
2) if set CCPR1L = 200 and CCPR2L = 255 the output i get from CCPR2L is 200 because CCPR1L value = 200 and CCPR2L value must not exceed 200.
masrisan
Greenhorn
 
Posts: 2
Joined: Wed Dec 05, 2012 11:18 am

Re: PWM programming with PIC18F4520

Postby robosang » Wed Dec 05, 2012 2:42 pm

So what do you need? You want forum member to write code for you?
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: PWM programming with PIC18F4520

Postby masrisan » Wed Dec 05, 2012 5:04 pm

robosang WROTE:So what do you need? You want forum member to write code for you?


problem solve... :D
masrisan
Greenhorn
 
Posts: 2
Joined: Wed Dec 05, 2012 11:18 am


Return to PIC Microcontroller

Who is online

Users browsing this forum: No registered users and 1 guest

cron