TECHNICAL WIKI

DsPIC Block/Master

Master Block

Master Block

The Master block set important dsPIC options like PLL, Quartz used, and share theses parameters with others blocks from the blockset.

Dialog Box Parameters

The dialog box parameters differs depending on which microcontroller is used. Unexpected close of the dialog box and few errors when re-opening it may appears when selecting a different chip. This has no consequence.

The principal change concern the Real Time Quartz tab. see Instruction Cycle Frequency

Master Block Dialog for the 30f3012 chip, General Tab

Master Block Dialog for the 30f3012 chip, General Tab

Master Block Dialog for the 30f3012 chip, Quartz Tab

Master Block Dialog for the 30f3012 chip, Quartz Tab

Step Based on

  • Tmer1 : The model time step is set using the Timer1 automatically configured (Prescaler and PR1).
  • ADC : The ADC conversion time can be used only when the ADC block is set to produce two or more sample per channel. The conversion time is 'augmented' so as to have reach the model time step at the end of all conversion needed in 1 time step.
  • Free Run : The model execute at its maximum speed. The Time step is not constant since the calculation time may changed slightly between time step. The simulink model time step is not taken into acount.

PIC

Specify the Microchip microcontroller target.

59 Supported devices :

See Release Notes and known bug for details

PIC 24FPIC 32F**PIC 30FPIC 30FPIC 33FJ GPPIC 33FJ MCPIC 33FJ GPPIC 33FJ MC*

24fJ128GA006

32MX360F256L

30f2010

30f5011

33fJ128GP206

33fJ256MC510

33fj128GP202

33fj128MC202

24fJ128GA008

32MX360F512L

30f2011

30f5013

33fJ128GP306

33fJ256MC710

33fj128GP204

33fj128MC204

24fJ128GA010

32MX460F256L

30f2012

30f5015

33fJ128GP310

33fJ64MC506

33fj128GP802

33fj128MC802

24fJ64GA006

32MX460F512L

30f3010

30f5016

33fJ128GP706

33fJ64MC508

33fj128GP804

33fj128MC804

24fJ64GA008

32MX775F256L

30f3011

30f6010

33fJ128GP708

33fJ64MC510

33fj32GP302

33fj32MC302

24fJ64GA010

32MX775F256L

30f3012

30f6011

33fJ128GP710

33fJ64MC706

33fj32GP304

33fj32MC304

24fJ96GA006

32MX795F512L

30f3013

30f6012

33fJ256GP506

33fJ64MC710

33fj64GP202

33fj64MC202

24fJ96GA008

32MX320

30f3014

30f6013

33fJ256GP510

33fJ128MC506

33fj64GP204

33fj64MC204

24fJ96GA010

32MX340

30f4011

30f6014

33fJ256GP710

33fJ128MC510

33fj64GP802

33fj64MC802

24fJ16GA002

30f4012

30f6015

33fJ64GP206

33fJ128MC706

33fj64GP804

33fj64MC804

24fJ32GA002

30f4013

33fJ64GP306

33fJ128MC708

24fJ48GA002

33fJ64GP310

33fJ128MC710

24fJ64GA002

33fJ64GP706

24fJ16GA004

33fJ64GP708

24fJ32GA002

33fJ64GP710

24fJ48GA002

24fJ64GA002

Newly added chip
64MC204, 128MC204, 128GP202, 32MC202, 32MC204, 16MC304 , 33FJ256GP710A
* PIC 32F
SPI function not suported yet;
* Compiler known and fixed bugs
* Check your compiler installation and version
at the matlab prompt ==> !pic30-gcc -v for pic30 and !pic32-gcc -v for pic32.
**Check pic32 compiler v 1.04 Workaround
**Check pic30 compiler PWM 2 Workaround from version v 3.12 to current version (3.25)...

Instruction Cycle Frequency

Time Step  reference is Timer 1. Timer 1 prescaler and PR1 register are configured  so as to meet the time step set in Simulink. When Timer 1 reach PR1, it  is reset and a next step is started.

Time Step reference is Timer 1. Timer 1 prescaler and PR1 register are configured so as to meet the time step set in Simulink. When Timer 1 reach PR1, it is reset and a next step is started.

Time  Step reference is the ADC peripheral. ADC conversion are slowed down so  as to meet the time step requirement set in Simulink. On this example,  Three channels are converted ; Two sample are read at each step (i.e.  the three ADC blocks output are vectors of 2 elements each).

Time Step reference is the ADC peripheral. ADC conversion are slowed down so as to meet the time step requirement set in Simulink. On this example, Three channels are converted ; Two sample are read at each step (i.e. the three ADC blocks output are vectors of 2 elements each).

Time  Step in Free Run mode. The model is executed as fast as it can. The  time step set in Simulink is not respected.

Time Step in Free Run mode. The model is executed as fast as it can. The time step set in Simulink is not respected.

Specify or shows the number of Instruction Per Secondes (MIPS) executed (in million here). Configuratoin of UART baud, timers prescaler and the real-timetime step rely on this frequency information.

For 30f family microcontroller
You must compute yourself the Instruction Per Seconds using :
IPS=FreqQuartz4*PLLfactorIPS = \frac{FreqQuartz}{4} * PLL_{factor}

With FreqQuartz the frequency of the source (Quartz or internal oscillator, External Clock ...) and with PLL factor set to 1 when PLL multiplication is not used.

For 24, 33 and 32 microcontroller
The Instruction Per Seconds is automatically computed using the Quartz frequency provided. If you activate the PLL multiplication, you have to enter the Desired Instruction Cycle Frequency (24f,32f and 33f dialog box only).

: From the entered Desired Instruction Cycle Frequency, the toolbox compute the best PLL multiplication which provides the Instruction Cycle Frequency the closest to the Desired one.

Config Timer

Set the prescaler for the timer 2,3 and 4,5 when available in the microcontrôller. Theses times are used by certain periphery like Output Compare, Input Capture. Set -1 for the timer prescaler to be set by matlab using optimal criterion.

Forcing a prescaler for one timer can be done by replacing -1 with your prescaler value. You must beware that when one peripheral use a timer, the timer value must not be changed as this would cause peripheral failure. Setting two timers with the same prescaler will insure that the second one will not be used by any peripheral. You will then be able to modify this timer value without affecting peripheral.

32 bits timer cannot be configured.

Busy Flag Port

Set the port specified to 1 during the time step calculation and 0 during idle time. This allow to check that all calculation are finished in less that one time step.

Overload Flag Port

Set the port specified to 1 during one time step if the previous time step was not finished when starting the execution of current time step.

config Oscillator mode

Sepecify PIC Oscillator configuration.

config Born Out Reset

Specify Voltage under which the microcontrôller Reset.

config Power Time

Specify time for the pic to start onced powered. (Lets time for alimentation tension to settle properly before starting instructions execution).

config MCLR

If disable, MCLR pin has not the hardware reset function on programme execution. When enable, Pic stop execution and reset when MCLR pin is in its low state.


<comments \>