RPOR15bits.RP30R = 1; meaning

(instructions, reset, WDT, specifications...) PIC17Cxx, PIC18Fxxx

Re: RPOR15bits.RP30R = 1; meaning

Postby Manoj » Thu Jul 11, 2019 7:56 am

Though I am using system clock.//OC1CON1bits.OCTSEL = 0b111;
Say I am using timer 3 for now .
Then when TMR3=pR3 timer rolls over.
So now what technique should I use ?
//This one definitely does no work
if(TMR3==pR3)
{
OC1RS =25000;
OC1R = (25000/2);
}
Manoj
 
Posts: 37
Joined: Mon Apr 09, 2018 8:01 am

Re: RPOR15bits.RP30R = 1; meaning

Postby ric » Thu Jul 11, 2019 8:04 am

Use the TMR3 rollover interrupt.
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 659
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products

Re: RPOR15bits.RP30R = 1; meaning

Postby Manoj » Fri Jul 12, 2019 10:06 am

Ok I did it. Now its stable
Code:-
void __attribute__((__interrupt__, auto_psv)) _ADC1Interrupt( void )
{
if (IFS0bits.AD1IF)
{
IFS0bits.AD1IF = 0;
if (FReadings==AVGNO)
{
// PWMpreiod=16000000/(c*64);
OC1RS = (int)(PWMpreiod-1); // PWM period
OC1R = (int)((PWMpreiod/2)-1 ); //50% initial duty cycle
FilterFlag=FALSE;
}
}
Thanks.
Manoj
 
Posts: 37
Joined: Mon Apr 09, 2018 8:01 am

Re: RPOR15bits.RP30R = 1; meaning

Postby Manoj » Wed Jul 17, 2019 12:48 pm

When I am using Dso to view the PWM ,It is shaking a lot .Is this supposed to Happen?
Thank you.
Manoj
 
Posts: 37
Joined: Mon Apr 09, 2018 8:01 am

Re: RPOR15bits.RP30R = 1; meaning

Postby AussieSusan » Thu Jul 18, 2019 2:23 am

You don't need to test the IF flag inside the ISR - it will ONLY be called when the IF (and IE) flags are (both) set.
Susan
AussieSusan
Verified identity
 
Posts: 173
Joined: Mon Jun 16, 2014 4:45 am
PIC experience: Experienced Hobbyist

Re: RPOR15bits.RP30R = 1; meaning

Postby Manoj » Fri Jul 26, 2019 10:02 am

Ok it worked.
Manoj
 
Posts: 37
Joined: Mon Apr 09, 2018 8:01 am

Previous

Return to 16-Bit Core

Who is online

Users browsing this forum: No registered users and 6 guests

cron