Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] problem with internal oscillator. PIC30f5011

Status
Not open for further replies.

Raady Here

Full Member level 5
Joined
Jun 8, 2013
Messages
242
Helped
26
Reputation
52
Reaction score
26
Trophy points
28
Location
India
Activity points
1,571
Hi,

I have been working with the internal oscillator of PIC30F5011, and I followed these steps for calculation of timer

/****************************************************************************************
* Timer Delay Calculations used:
* 1. Crystal Source Frequency Fosc
* 2. Timer Frequency Ftimer = Fosc / 4
* 3. Using a Prescalar 1:8, then
* Ftimerpre = Ftimer / scalar value
* 4. Time Interval Ttimer = 1/Ftimerpre
* 5. To calculate the value to be filled in Timer rolling over
* register to generate 10m sec delay :
* No of count for 10 msec delay = 10 ms / Ttimer
****************************************************************************************/

so my calculations
for delay timer with no PLL is 2303 , PLL 4 is 9212.5 ~ 9213, PLL 8 is 18424

when ever I load PR value as 2303 the timer is working fine, and remaining rest it doesn't.
From this i knew despite the PLL that i apply i needed to load the calculations that made for PLL.

The thing I couldn't understand is when ever I am using an external oscillator (8MHz) it all working fine (for the calculations made fosc multiplied by pll), should I not apply PLL multiplied to Fosc while I am using internal oscillator ?




Here is the piece of code timer code I used
Code:
void INIT_TIMER(void)
{
	TRISGbits.TRISG12 = 0; 				// setting MCLR LED as output port
	LATGbits.LATG12   = 1; 				// setting on MCLR LED. 
	
	T1CON		= 0; 					// Disable Timer and reset
	TMR1 		= 0x0000; 				// Clear timer register
	PR1 			= _T1_TIME; 			// Load the Period Value of 10m sec.
									// _T1_TIME = 2303 made from calculations.

	IPC0bits.T1IP	= 7;					// set timer 1 interrupt priority level.
	IFS0bits.T1IF	= 0;					// Clear Timer1 Interrupt Flag
	IEC0bits.T1IE	= 1;					// Enable Timer1 interrupt
	
	T1CONbits.TCKPS = 0b01; 				// Select 1:8 Prescaler	
	T1CONbits.TCS 	= 0;					// Enable Internal clock (FOSC/4)
	T1CONbits.TON	= 1;					// Start Timer
}


Regards,
Raady
 

when u using internal oscillator " FAST RC OSCILLATOR (FRC) " that time PLL is apply but onther config setting like internal
" LOW POWER RC OSCILLATOR (LPRC) " u not apply PLL of internal Oscillator . and also try to disable WDT .
 

Hi nick,

Here I am attaching a short view of the configurations that I have made (where in I have chose Internal oscillator FRC and disabled watchdog).
If you are looking at the attachment, I have no option to work with FRC with no PLL, but I need to make calculations based on FRC no PLL irrespetive of my selection FRC 4PLL, FRC 8PLL, FRC 16PLL.

I have raised this question as this have applied the same to UART functionality(changing PLL didn't match UART register to print correctly).
Further I need to work on ADC where I have to take calculations similarly based on Fosc.

is there any changes that I need make ?

Code:
//************************SYSTEM CONFIGURATION BITS*************************************
_FOSC(CSW_FSCM_OFF & FRC_PLL4);	//Internal fast RC oecillator
_FWDT(WDT_OFF);				//Disable the watcdog timer
_FBORPOR(MCLR_EN & PWRT_OFF); 	//Enable the master clear pin
_FGS(CODE_PROT_OFF); 			// Disable code protection

pic1.jpgpic2.jpg
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top