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.

Difference between revisions of "DsPIC Block/Calculus Time Step"

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
(New page: Provide the exact execution time of the time step. Each microcontroller time step can be decomposed in time into two parts. During the busy part, all the Input/Output tasks and the calcul...)
 
m (LubinKerhuel moved page Block/Calculus Time Step to DsPIC Block/Calculus Time Step: Block is a special page, creates many issues)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[Image:Block_Calculus_Time_Step.png|thumb|rght|Block Calculus Time]]
 
Provide the exact execution time of the time step.
 
Provide the exact execution time of the time step.
  
Line 6: Line 7:
  
 
=Dialog Box Parameters=
 
=Dialog Box Parameters=
 
+
[[Image:Block_CalculusTimeStep_DialogBox.png|thumb|right|450px|Calculus Time-Step Dialog]]
 
==Sample Time==
 
==Sample Time==
 
-1 is inherited
 
-1 is inherited
Line 16: Line 17:
  
 
Typically, 'the calculus time step' block output is connected directly to the 'Tx Output Multiplexed For Matlab Lavview' block. Values can then be plotted with the matlab graphical user interface. With multirate simulink models, force the sample time to the model time step (ie, the minimum time step possible for a block of the model). Thus, you will obtain the execution time for the different rate of the model and you will be able to measure the time margin for each one.
 
Typically, 'the calculus time step' block output is connected directly to the 'Tx Output Multiplexed For Matlab Lavview' block. Values can then be plotted with the matlab graphical user interface. With multirate simulink models, force the sample time to the model time step (ie, the minimum time step possible for a block of the model). Thus, you will obtain the execution time for the different rate of the model and you will be able to measure the time margin for each one.
 +
 +
==Related topics on the forum==
 +
 +
[http://www.kerhuel.eu/forum/viewtopic.php?f=1&t=253 Confused about Calculus Time Step]
 +
 +
----
 +
<comments \>

Latest revision as of 18:30, 3 May 2015

Block Calculus Time

Provide the exact execution time of the time step.

Each microcontroller time step can be decomposed in time into two parts. During the busy part, all the Input/Output tasks and the calculation tasks are completed. During the idle part, the microcontroller is waiting for the time of the next time step to start. Time step is usually controlled using the timer1. Steps execution starts when timer1 reachs the precomputed PR1 value and is then reseted. The "Calculus Time Step" block extract the Timer1 value at the end of the busy part. Comparing this value to PR1 provides the margin for the step computation time. The PR1 value corresponding to the model time-step can be found in the Master block dialog box. Note that this block works only when time step is based on the timer 1 (in master block configuration, ie, does not work when using ADC sample time as reference for time).

Dialog Box Parameters

Calculus Time-Step Dialog

Sample Time

-1 is inherited

Max Step Time Out (Timer1 PR1)

When this case is checked, a second output provide the PR1 value. You can read directly this value in the master block configuration dialog.

Dividing first input by PR1 gives the percentage of charge of the microcontroller (using non integer division !).

Typically, 'the calculus time step' block output is connected directly to the 'Tx Output Multiplexed For Matlab Lavview' block. Values can then be plotted with the matlab graphical user interface. With multirate simulink models, force the sample time to the model time step (ie, the minimum time step possible for a block of the model). Thus, you will obtain the execution time for the different rate of the model and you will be able to measure the time margin for each one.

Related topics on the forum

Confused about Calculus Time Step


<comments \>