INTRODUCTION

Introduction

The dsPIC33 series model models the behaviour of the following microcontrollers from Microchip Technology™:

dsPIC33FJ12GP201, dsPIC33FJ12GP202, dsPIC33FJ32GP202,

dsPIC33FJ32GP204, dsPIC33FJ16GP304,

dsPIC33FJ12MC201, dsPIC33FJ12MC202, dsPIC33FJ32MC202,

dsPIC33FJ32MC204, dsPIC33FJ16MC304.

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 - Compilers and Integration

Main Limitations

Specifying The Processor Clock

This help file created 30th November 2012.


High Level Language Support

The dsPIC33 model can load program files in Intel Hex and Microchip COFF format. The advantage of using COFF 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.

See Also:

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 you should attempt to produce a COFF file from your toolchain of choice. The procedure is to get 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.

Note that you can use any compiler if you debug under MPLAB using the Proteus VSM MPLAB Plugin.

Failing all else, you can specify the HEX file as the PROGRAM property on the schematic part. This will simulate fine but debugging capabilities will be limited.


MAIN LIMITATIONS

While most of the unique features of these controllers, included the Digital Signal Processor engine, the Bit Reverse and Modulo Addressing are fully modelled, the dsPIC33 model has a number of limitations.

  • Oscillator - FOSCSEL<TEMP>, Temperature Protection Enable bit
    FOSCEL<IESO> Internal External Start-up Option bit.
    CLKDIV<ROI>, Recover on Interrupt bit is not supported.
    OSCTUN, Oscillator tuning not modelled.
  • Loop-back mode and IrDA mode are not supported.
  • The SPI modules do not currently support either “enhanced” mode (FIFO buffering) or “framing” modes (essentially, any feature enabled via SPIxCON2).
  • Modules disable. The register PMDx effects are not modelled.
  • Brown-out detection is not modelled.
  • Quadrature encode interface - bit QEI1CON<QEISIDL> Stop in Idle mode not modelled.
  • Motor Control PWM - bit PxTCON<PTSIDL>, PWM Time Base Stop in Idle Mode not modelled.
  • Adc with SS&H - only the variant up to 13 analog input pin and without DMA is supported at moment.
  • 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 7.37MHz 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.

The Switch Clock feature is also simulated by enabling DOZEN with DOZE=1. The new FCY will not take place until a new clock is selected. As a suggested procedure, you initiate a switch clock by unlocking OSCCON, writing OSWEN bit and finally selecting the new clock in NOSC. Once stabilized the new clock is switched and the wanted new one will switched out. The stabilization time is also modelled; as a correct procedure you should check the bits OSCCONbits.COSC until the new configuration takes place .

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 dsPIC33 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

Bad or Unsupported PROGRAM Property

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


Illegal destination register (Wn) for MULxx instruction.

Illegal destination register 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 is not legal for a REPEAT loop

The dsPIC33 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

Register is read-only attempt to write ignored

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 or COF file.