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/Input Capture"
LubinKerhuel (talk | contribs) m |
LubinKerhuel (talk | contribs) m (LubinKerhuel moved page Block/Input Capture to DsPIC Block/Input Capture: Block is a special page, creates many issues) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[Image:Block_Input_Capture.png|thumb|rght|Block Input Capture]] | [[Image:Block_Input_Capture.png|thumb|rght|Block Input Capture]] | ||
− | The Input Capture (IC) block | + | The Input Capture (IC) block provides measurements from any kind of PWM data. Uptime, downtime, or both value can be captured. For each channel captured a timer is automatically chosen and set to obtain the maximum resolution. Timer configuration is based on the max pulse duration you are to measure. |
Line 6: | Line 6: | ||
[[Image:Block_InputCapture_DialogBox.png|thumb|right|450px|Input Capture Dialog]] | [[Image:Block_InputCapture_DialogBox.png|thumb|right|450px|Input Capture Dialog]] | ||
==Interrupt Priority== | ==Interrupt Priority== | ||
− | + | The interrupt is triggered on the rising and/or falling edge. The measurement is then calculated and saved. The interrupt priority will not affect the accuracy of the measure because timers are read in hardware. Interrupt priority can affect measurements on fast consecutive events, however. | |
==Input Channels== | ==Input Channels== | ||
− | Specify Input Capture channel(s) (IC) starting from 1. | + | Specify Input Capture channel(s) (IC), they are numbered starting from 1. Multiple channels can be specified as a vector. This will affect the number of outputs for the block. |
==Channels Input Type== | ==Channels Input Type== | ||
− | Select for each channel which | + | Select for each channel which kind of data you want to extract. |
*1 : is to get the High pulse duration | *1 : is to get the High pulse duration | ||
*2 : is to get the Low pulse duration | *2 : is to get the Low pulse duration | ||
− | *3 : is to get both High and | + | *3 : is to get both High and Low pulse duration |
− | *4 : is to get the | + | *4 : is to get the period using rising edge |
− | *8 : is to get the | + | *8 : is to get the period using falling edge |
− | *5 : is to get both High pulse duration and | + | *5 : is to get both High pulse duration and period using rising edge |
− | *10 : is to get both | + | *10 : is to get both Low pulse duration and period using falling edge |
− | The value of the vector | + | The value of the vector referring to corresponding channel defined in "Input Channels". |
==Max/Channels== | ==Max/Channels== | ||
− | Define max time in | + | Define the max time in seconds of the largest event to be measured by the respective channel. |
− | |||
+ | ==Safety margin in %== | ||
Add a margin to the max time defined previously. This margin time allow to avoid provided the event is larger than the max attempted value. | Add a margin to the max time defined previously. This margin time allow to avoid provided the event is larger than the max attempted value. | ||
Line 36: | Line 36: | ||
==Timer== | ==Timer== | ||
− | This is the timer that is used with the corresponding channel | + | This is the timer that is used with the corresponding channel and is set automatically. The timer prescalers are defined in the Master block. |
==Changed Detected on== | ==Changed Detected on== | ||
− | + | Adds boolean outputs to the block. This output takes the value 1 if a change has occurred since the last block execution. The output can be set to 1 either at rising edge, falling edge or both. | |
==Sample Time== | ==Sample Time== | ||
Line 45: | Line 45: | ||
==Status== | ==Status== | ||
− | Information if error | + | Information if error encountered. |
---- | ---- | ||
<comments \> | <comments \> |
Latest revision as of 19:30, 3 May 2015
The Input Capture (IC) block provides measurements from any kind of PWM data. Uptime, downtime, or both value can be captured. For each channel captured a timer is automatically chosen and set to obtain the maximum resolution. Timer configuration is based on the max pulse duration you are to measure.
Contents
Dialog Box Parameters
Interrupt Priority
The interrupt is triggered on the rising and/or falling edge. The measurement is then calculated and saved. The interrupt priority will not affect the accuracy of the measure because timers are read in hardware. Interrupt priority can affect measurements on fast consecutive events, however.
Input Channels
Specify Input Capture channel(s) (IC), they are numbered starting from 1. Multiple channels can be specified as a vector. This will affect the number of outputs for the block.
Channels Input Type
Select for each channel which kind of data you want to extract.
- 1 : is to get the High pulse duration
- 2 : is to get the Low pulse duration
- 3 : is to get both High and Low pulse duration
- 4 : is to get the period using rising edge
- 8 : is to get the period using falling edge
- 5 : is to get both High pulse duration and period using rising edge
- 10 : is to get both Low pulse duration and period using falling edge
The value of the vector referring to corresponding channel defined in "Input Channels".
Max/Channels
Define the max time in seconds of the largest event to be measured by the respective channel.
Safety margin in %
Add a margin to the max time defined previously. This margin time allow to avoid provided the event is larger than the max attempted value.
ValMax / Channel Variable Name
This Variable will be evaluated in the workspace and allow you to scale the data.The ValMax is the max value that will be given by an event of the duration defined in Max/Channels. This value does not take into account the Safety margin.
Result Byte Resolution
This is the log2 of the ValMax Variables for each channels.
Timer
This is the timer that is used with the corresponding channel and is set automatically. The timer prescalers are defined in the Master block.
Changed Detected on
Adds boolean outputs to the block. This output takes the value 1 if a change has occurred since the last block execution. The output can be set to 1 either at rising edge, falling edge or both.
Sample Time
-1 mean inherited
Status
Information if error encountered.
<comments \>