Page 40
M4120170509EN
UI Robot Technology Co. Ltd.
UIM24102/04/08-IE
8.1 Rising and Falling Edge
When port S1 and S2 is configured for digital input, if the sensor module detects a voltage
change on S1(S2) from 0V to 5V, an Sx rising-edge event will be created, meanwhile S1(S2)
is assigned a logic value 1 (i.e. S1=1). If the sensor module detects a change on S1(S2)
from 5V to 0V, an S1(S2) falling-edge event will be created, meanwhile S1(S2)=0.
Figure8-1: Rising and Falling Edge of a Digital Sensor Input
8.2 Analog Input and Thresholds
Figure8-2: Analog Input and Thresholds
Sensor input port S1 can be configured for analog input by instruction. To do that, user
needs to first enable the analog input function by set the ANE bit of the master configuration
register (i.e., MCFG<ANE> =1). Then, user needs to select the analog input port by clear
the CHS bit of the master configuration register (i.e., make MCFG<CHS> =0).
Once
configured, the analog voltage on port S1 can be obtained by instruction SFB.
In order to use the sensor events, user may need to further setup the input upper and lower
thresholds (i.e., AH / AL in figure 8-2). If the sensor module detects the analog input voltage
is changing from lower than AH to high than AH, an S1 rising-edge event will be created,
meanwhile S1 is assigned a logic value 1 (i.e. S1=1). If the sensor module detects a
change on S1 from higher than AL to lower than AL, an S1 falling-edge event will be created,
meanwhile S1=0. Otherwise, S1 is kept unchanged.
T
(
Time
)
S1 / S2 (Logic Value)
Rising
Edge
Voltage on port S1(S2)
5V
0V
Falling
Edge
1
0
Voltage on Port S1 (S2)
T
(
Time
)
S1 logic value
5V
0V
1
0
Thd_H
Thd_L
S1 Logic Value
Falling
Edge
1
0
S1
Rising
Edge
Rising
Edge
Though voltage on sensor port is
lower than Thd_H, S1 is still 1
Though voltage on sensor port is
higher than Thd_L
,
S1 is still 0
T
(
Time
)
Analog
Input
Voltage on
Sensor Port