PIC24 PROCESSOR MODELS

Introduction

The PIC24 series model models the behaviour of many microcontrollers in the popular family from Microchip Technology™: We are constantly updating our model support for this family and you can find the latest list of supported variants on our website at http://www.labcenter.com/products/vsm/pic24.cfm

Datasheets for these devices can be viewed by clicking on appropriate device name, above. Note that there are a number of Errata datasheets for these devices which are available directly from Microchip’s website: http://www.microchip.com/.

Please check the Microchip website for the latest information and errata on particular devices.

See also

Getting Started - Compiler Support and Integration

Specifying The Processor Clock

Main Limitations

This help file last modified 20th November 2012.


High Level Language Support

The PIC24 model can load program files in Microchip COFF format as well as with the same hex file that you would program a physical device with. The advantage of using one of the COFF format is that it contains symbolic debug information (source code, variables,etc.) which enables you to not only simulate your system in Proteus but also to single step debug. The following is a summary of supported formats with basic instructions on how to get started.

Proteus VSM Tutorial

VSM Studio IDE

By far the easiest way to get set up for simulating in Proteus is through the integrated VSM Studio IDE. This tool is integrated into the Proteus Design Suite, will detect installed compilers and you can directly download and install additional tools from inside the IDE.

Installed compilers are automatically configured by VSM Studio to produce debugging output suitable for driving Proteus VSM. If however you need to make changes all of the compiler options are made available in the Project Setting dialogue inside VSM Studio.

Once you have written some code and compiled your schematic will automatically be programmed with the firmware. You can then both simulate and single step debug inside VSM Studio. Active popups let you add 'schematic snippets' to VSM Studio so that you can view and interact with the simulation while debugging the source code.

See Also:

VSM Studio Tutorial (New Project)

Schematic Only

If you choose or prefer to work in your own IDE and use Proteus VSM only for simulation then the PIC24 model can load program files in Intel Hex and Microchip COFF format. The latter format contains symbolic debug information enabling source level debugging of 'C' programs.

The process in each case is to produce the required debug file from your compiler and then to load this file as the PROGRAM property in the Edit Component dialogue form of the PIC microcontroller.


Main Limitations

The PIC 24 model has a number of limitations.

  • The CRC Generator module is not currently modelled. Support for this module is planned for a future release.
  • The UART modules do not currently support Auto-Baud Rate detection, Loop-back mode or IrDA mode. Support for Auto-Baud Rate is planned for a future release. Loop-back and/or IrDA may be supported.
  • The SPI modules do not currently support either "enhanced" mode (FIFO buffering) or "framing" modes (essentially, any feature enabled via SPIxCON2). Support for these modes is planned for a future release.
  • The Idle and Sleep power management modes (enabled via the PWRSAV instruction) and the Doze mode (enabled via DOZEN bit in CLKDIV register) are not modelled. Support for Sleep mode is planned for a future release. Support for Idle and Doze modes may also be included.
  • The following "core" registers are either not modelled at all. Functionality enabled by these registers is therefore not available: DISICNT, ODCx, CLKDIV, OSCTUN, PMDx.
  • The OSCCON register not modelled except for the SOSCEN bit (which must be set to enable the secondary oscillator for use by either timer 1 or the Real Time Clock Module).
  • The model supports writes to code memory but not erasing of the memory. Support for this is planned for a future release.
  • Brown-out detection is not modelled.
  • All external signal timing is approximate and is generally accurate to one instruction cycle.

The model generates a warning or error whenever an attempt is made to use an un-modelled feature of the device.


Specifying the Processor Clock

The PIC model determines the oscillator mode according to the POSCMODn and FNOSCn configuration bits.

Where the configuration bits specify an external clock source, the PIC model ignores any circuitry connected to the OSC1/CLKI and OSC2 pins and instead uses Processor Clock Frequency property value (specified by tagging and editing the PIC device on the schematic) to configure an internal clock. This is done for efficiency - attempting to simulate an external clock generating millions of clock edges per second is inefficient and slows the simulation down dramatically.

The value specified for the Processor Clock Frequency should be the same as the clock frequency that would be applied to the CLKI pin of the real device. Where a PLL-based oscillator is configured, the model will automatically multiply this value by the appropriate amount so mimicking the PLL behaviour of the real device. This value then presents the value of the Q-clock frequency (Fosc) and is divided by two (since there are two Q-clocks per instruction) to get the instruction clock.

Where the configuration bits specify an internal clock source (e.g. LRPC, FRCDIV, etc.) the model ignores any circuitry connected to the OSC1/CLKI and OSC2 pins as well as the Processor Clock Frequency property will automatically configure itself with an internal clock of the appropriate frequency. For LPRC and SOSC-based oscillators, the model will use the value specified in the LPRC Oscillator Frequency (defaults to 31kHz) or SOSC Oscillator Frequency (defaults to 32768Hz); for a Fast RC-based oscillator, the model will assume a base frequency of 8MHz and derive the oscillator frequency from this value.

Where the configuration bits specify an external clock source, the model issues a warning if the Processor Clock Frequency is not specified; likewise, where the configuration bits specify an internal clock source, the model issues a warning if the Processor Clock Frequency is specified.

The simulation log always indicates the clock frequency the processor is running at and the instruction clock frequency is always one half of the Q-clock (Fosc) frequency.

Again, for efficiency, the processor doesn’t generate a Q-clock on the CLKOUT pin unless the Generate Q-clock On CLKOUT Pin property is set to Yes.

Note that simulations of a PIC24 device clocking an internal Q-Clock of over about 20MHz will likely consume the entire processing power of even a powerful PC.


Bad or Unsupported PROGRAM Property Extension

Unsupported PROGRAM Property Extension

The program filename extension is missing or is of an unsupported type. The supported extensions are HEX, COF, COD and BAS.

See also High Level Language Support


Illegal destination register (Wn) for MULxx instruction

Illegal register (Wn) for MULxx instruction

The Wn register specified as the destination for a MULUU, MULSU, MULUS or MULSS instruction is not legal.

The MULxx instructions require the destination register to be W0, W2, W4, W6, W8, W10 or W12.


Instruction to be repeated (instruction at PC=XXXXXX) is not legal for a REPEAT loop

Instruction to be repeated is not legal

The PIC24 REPEAT instruction repeats the instruction that follows it a set number of times. There are some instructions that are not legal for being repeated (e.g. instructions that are more than one program word in length or instructions that would modify the program counter).


PCx register is read-only - attempt to write 0xXXXX ignored

PCx register is read-only

This warning is the result of an attempt to write to a PCL or PCH registers. These registers are read-only registers and any write to the register is ignored.


Program Property Not Specified

In order to load your program into the PICMicro™ microcontroller model, you must enter the compiled program filename into the PROGRAM field of the edit component dialog form. The program filename will be a HEX, COF, COD or BAS file.

See also High Level Language Support