> On Fri, May 11, 2012 at 12:50 AM, Bob Ammerman <
picram
KILLspamroadrunner.com> wrote:
>>> 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,
>>> Manu
>>
>> 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
>
>
> 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" ?