Azzera filtri
Azzera filtri

i could like to create a debounce block in simulink

11 visualizzazioni (ultimi 30 giorni)
abdul
abdul il 21 Lug 2024
Modificato: Divyanshu il 30 Lug 2024
if the input is false and the previous out is false then the counter = counter - dec, if the input is false and the previous out is true then the counter = counter + inc ,if the input is true and the previous out is false then the counter = counter + inc ,if the input is true and the previous out is true then the counter = counter - dec, and if the previous out is true and the counter is greater than reset thershold then the output is false and the counter is 0, if the previous out is false and the counter is greater than set thershold then the out is true and the counter is 0 else out is previous out and the counter is equal to counter. Note: counter = 0 - The block can also output the counter. - if R (Reset) =1, the output is set to Init_Out. For every blocks, INC=1 and DEC=1. USING RULES NFR AUTEMSLIB DEBOUNCE 01/01 In, Out. Init Out and R are Boolean variables. The Cntr. SET_THR, RESET_THR, have no unit and an accuracy of 1. The range of Cntr has to be the same as the one defined under the block. The range of SET_THR, RESET_THR, Inc and Dec is [0..254] or [0..65534] if the range of Cntr is respectively [0..255]ог [0..65535].

Risposte (1)

Divyanshu
Divyanshu il 30 Lug 2024
Modificato: Divyanshu il 30 Lug 2024
Hi abdul,
I am assuming that you want to create a custom block in simulink which can modify the values of 'counter' based on different conditions.
'MATLAB Function' block is a user-defined Simulink block in which you can write the custom code and the block performs the specified operations same as a corresponding MATLAB script.
Please refer the following documentation link for more details about the block:
Also, you can use Simulink Function Block depending upon the use-case.

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by