PIC18F4550 oscillator – Proteus Error

Thread Starter

viki2000

Joined Jun 18, 2013
11
I have tried a simple project with LED blink on/off using PIC18F4550.
The compilers used are XC8 and CCS. I have used as IDE: MPLABX, CCS and Flowcode 7 (with XC8).
When the projects are burned on real device and I check with the oscilloscope the signal at pin RA0, then there is no problem.
If I use Proteus to simulate this simple project, then I have a problem when I use as oscillator for PIC18F4550 an external crystal + PLL internal to get maximum frequency 48MHz. I have tried various crystal values, but I remained at 16MHz, because this is what I have also in reality on the bench.
If the oscillator is set internal, then there is no problem with Proteus.
But if the oscillator is external, then the values seen with the virtual oscilloscope are not good.
I came to this simple project and I have tested it in various ways, because actually I was working on another project with I2C and I could not find the cause of the problem when was simulated in Proteus, which now is clear related with oscillator when is set external HS with PLL.
Below is a link with the pictures/screenshots and the projects used for LED blinking:

https://goo.gl/nPKKj2

I wrote this topic for 2 reasons:
- To share the problem found.
- To ask you if you are aware of the Proteus problem related with PIC18F4550 external oscillator and if you can double check it and confirm/refute my findings.
 

simozz

Joined Jul 23, 2017
170
Hello,
Even if simulators like Proteus let you simulate an MCU firmware, the best thing to do is to check the datasheet first if the MCU meets your requirement, then you buy the device and work on it.
simozz
 

Thread Starter

viki2000

Joined Jun 18, 2013
11
I do that, I test and I tested with the real device on the bench and I am aware of the limitations in simulation possibilities of different software.
I just wanted to run PIC18F4550 with CPU 48 MHz in Proteus and I found the above problem.
Then I decided to share it and my request was to confirm/refute my findings. I provided even the Proteus project, screenshots and the C code in CCS and XC8.
It is just a question if someone is willing to spend time and double check it.
It is good to know about it.
 

Thread Starter

viki2000

Joined Jun 18, 2013
11
I’ve got the proof, the game ends here.
I have setup an I2C communication between PIC18F4550 as Master and PIC16F877A as Slave. All is done with MPLABX XC8 and then simulated in Proteus. And it works fine.
When the simulation starts, there is a message about PIC18F4550 saying:

[PIC18] PC=0x7EE0. The SCSx bits have been set. This feature is not modelled - the model continues to clock itself as before.

The SCSx bits are in OSCCON register, page 34 of the PIC18F4550 datasheet and set the system clock source:

bit 1-0 SCS1:SCS0: System Clock Select bits
1x = Internal oscillator
01 = Timer1 oscillator
00 = Primary oscillator

In other words, in Proteus, when you simulate PIC18F4550, you should use only internal oscillator, because the external oscillator is not modeled.

The proof.jpg
 
Top