Din

Top  Next

Din


Digital Input

Since R2019b

 

Library: embeddedCreatorLib ( Dafulai Electronics) / Din

 

 

Din

 

 


 

Description


 

This block will get digital Input.

 

 

 

Parameters


 

Please double click this block to open parameters dialog below :

 

 

Din_parameter_pic

 

 

 

Let us explain parameters.

 

 

How to specify Digital Input — radio selection button for Digital input Pin. It can be one of "By physical port name and bit number"/"By C language reading variable/macro name".

 

Port Name — drop list for Digital Port name. It is used only when parameter "How to specify Digital Input" is "By physical port name and bit number".

 

Port Bit number  — drop list for Digital Port Bit Number. It is used only when parameter "How to specify Digital Input" is "By physical port name and bit number".

 

C Access Variable/Macro Name  — String type of scalar. It can be variable name or macro name in C language for Digital Input. It is used only when parameter "How to specify Digital Input" is "By C language reading variable/macro name".

 

Enable Filter — Logical type of scalar.  True means "Enable Digital input filter".

 

Filter Selection — radio selection button for Digital input Pin filter method. It can be one of "Continuous sample multiple times in one sample period"/"sample once in one sample period".  If you select "Continuous sample multiple times in one sample period", firmware will read the same digital input many times continuously. And this block output "Din" only change when it is the same value for every time reading inside this sample period, otherwise keep old value. If you select "sample once in one sample period", firmware will read digital input once in one sample period.  However this block output "Din" only change when it is the same value for consecutive sample periods, otherwise keep old value. So the 1st method's filter causes signal delay to be smaller than the 2nd method's filter

 

Sample Qty used in digital real result  — Drop list from 2 to 12. Integer type of scalar.  It only makes sense when Enable Filter. It means how many times readings consistent for filter .

 

Initial Input Value: — Logical type of scalar.  It only makes sense when Enable Filter. It is initial value for "Digital Input".

 

Sample time in sec (-1 for inherited): — Sample time for this block. It is the same meaning as general Simulink block .

 

 

Notes:  Please configure GPIO.   All settings must be done  in IDE GUI configuration (It is MCC for Microchip Micro-controller).  And it must match this block settings, otherwise unexpected result will occur.

 

Ports


 

Input

 

None

 

Outport


 

 

Din — Logical Scalar. Digital Input Value.

 

 

Examples