Searching \ for '[PIC] 18F4550 and OSCCON and Tcy' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=18F
Search entire site for: '18F4550 and OSCCON and Tcy'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] 18F4550 and OSCCON and Tcy'
2012\05\10@150700 by Manu Abraham

picon face
Hi,

I have my config fuses thus with a 20MHz XTAL connected

#pragma config FOSC = INTOSC_HS
#pragma config PWRT = OFF
#pragma config BOR = OFF
#pragma config MCLRE = ON
#pragma config PBADEN = OFF
#pragma config ICPRT = OFF
#pragma config LVP = OFF
#pragma config WDT = OFF

and a simple snippet as follows ..

void main()
{
       OSCCON = 0x72; /* 8MHz INTOSC drives clock directly */
       OSCTUNE = 0x80; /* 31.25 kHz device clock derived from 8 MHz INTOSC */

       while (1) {
               Nop(); // this took .2uS or 200nS
               Delay10TCYx(120); // this took 481.2 uS
       }
}

With the simulator trace, I am viewing the elapsed time for each instruction.

Prior to OSCCON setup to 0x72, OSCCON was defaulting to 0x00 implying
1MHz INTOSC driven clock.

The trace showed an elapsed time period of 0.2uS at 1MHz. Even after
OSCCON was set to 8MHz INTOSC clock, I still do see the elapsed Tcy
period as 0.2uS itself.

Am I missing something ?

Thanks,
Man

2012\05\10@152012 by Bob Ammerman

flavicon
face
{Quote hidden}

Yes, the simulator only shows the time period based on the clock rate *you enter*. It does not know the current clock rate of the simulated chip.

-- Bob Ammerman
RAm  Systems

2012\05\10@153433 by Manu Abraham

picon face
On Fri, May 11, 2012 at 12:50 AM, Bob Ammerman <spam_OUTpicramTakeThisOuTspamroadrunner.com> wrote:
{Quote hidden}

The Simulator is set for a 20MHz "Processor frequency" which is same as the
crystal frequency and the simulator window also shows that.

You meant to change that "Processor frequency" ?

2012\05\10@154313 by Manu Abraham

picon face
On Fri, May 11, 2012 at 1:04 AM, Manu Abraham <.....abraham.manuKILLspamspam@spam@gmail.com> wrote:
{Quote hidden}

I am a bit confused.

The information here

http://w3.id.tue.nl/fileadmin/id/objects/E-Atelier/doc/Tutorials/DELAY_FUNCTIONS_18F4550.pdf

with a 20MHx crystal,

Delay10TCYx (60); // gives a delay of 10 x 60 x 1/12 = 600/12 = 50 us
This would be 100uS in my case with Delay10TCYx (120) but I am
actually getting a delay of
481uS (Delay10TCYx(120); // this took 481.2 uS)

More... (looser matching)
- Last day of these posts
- In 2012 , 2013 only
- Today
- New search...