Blockset described on this wiki is deprecated since 2012.

For Model Based Design (MBD), use the free MPLAB Device Blocks for Simulink, tool from Microchip.
Updated Rapid Control Prototyping (RCP) custom projects are published at: https://lubin.kerhuel.eu.

DsPIC Block/Master

From http://www.kerhuel.eu/wiki - Simulink device driver Blockset for dsPIC / PIC24 / PIC32 Microcontrollers --[[User:LubinKerhuel|LubinKerhuel]] 12:40, 3 September 2009 (UTC)
Jump to navigation Jump to search

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

Master Block

Dialog Box Parameters

Illustration not up to date !

Step Based on

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 blocks output is a vector of 2 elements for each channel).
Time Step in Free Run mode. The model is executed as fast as it can. The time step set in Simulink is not respected.
  • 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 : 24fJ128GA006, 24fJ128GA008, 24fJ128GA010, 24fJ64GA006, 24fJ64GA008, 24fJ64GA010, 24fJ96GA006, 24fJ96GA008, 24fJ96GA010, 30f2010, 30f2011, 30f2012, 30f3010, 30f3011, 30f3012, 30f3013, 30f3014, 30f4011, 30f4012, 30f4013, 30f5011, 30f5013, 30f5015, 30f5016, 30f6010A, 30f6011, 30f6012, 30f6013, 30f6014, 30f6015, 32MX360F512L, 32MX460F512L, 33fJ128GP206, 33fJ128GP306, 33fJ128GP310, 33fJ128GP706, 33fJ128GP708, 33fJ128GP710, 33fJ128MC506, 33fJ128MC510, 33fJ128MC706, 33fJ128MC708, 33fJ128MC710, 33fJ256GP506, 33fJ256GP510, 33fJ256GP710, 33fJ256MC510, 33fJ256MC710, 33fJ64GP206, 33fJ64GP306, 33fJ64GP310, 33fJ64GP706, 33fJ64GP708, 33fJ64GP710, 33fJ64MC506, 33fJ64MC508, 33fJ64MC510, 33fJ64MC706, 33fJ64MC710

Instruction Cycle Frequency

Specify the Instruction Per Secondes (MIPS) executed not gven in million here. Configuratoin of UART baud, timers prescaler and the time step rely on this frequency information. When using a quartz, the instruction frequency is calculated using : IPS = (FreqQuartz / 4) * PLL factor (1 if no PLL used).

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.

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.

Busy 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.