i could like to create a debounce block in simulink
14 次查看(过去 30 天)
显示 更早的评论
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].
0 个评论
回答(1 个)
Divyanshu
2024-7-30,12:15
编辑:Divyanshu
2024-7-30,12:15
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:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Large-Scale Modeling 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!