Difference between revisions of "Carsten Milkau/D-Latch"
From Unofficial Stationeers Wiki
< User:Carsten Milkau
(→D-latch: input 1 and 2 of select unit were mixed up in intro) |
(→Using Select Unit and Logic Reader) |
||
Line 28: | Line 28: | ||
<li>a select unit determines whether to store the last output or the "data" input using the "enabled" input. i.e. | <li>a select unit determines whether to store the last output or the "data" input using the "enabled" input. i.e. | ||
<pre> if enabled | <pre> if enabled | ||
− | then | + | then store = data |
− | else | + | else store = output</pre></li> |
<li>a [[Kit_(Logic_I/O)#Logic_Reader|logic reader]] mirrors the value to be stored and feeds it back into the select unit so it can circulate (effectively being stored). This would be obsolete if the select unit could read its own output. | <li>a [[Kit_(Logic_I/O)#Logic_Reader|logic reader]] mirrors the value to be stored and feeds it back into the select unit so it can circulate (effectively being stored). This would be obsolete if the select unit could read its own output. | ||
− | <pre> output = | + | <pre> output = store</pre></li> |
</ol> | </ol> | ||
+ | |||
+ | {| | ||
+ | |+ Circuit setup | ||
+ | |- | ||
+ | ! Unit name || Unit type || Connector / Setting || Source / Value | ||
+ | |- | ||
+ | | select 1 || Select Unit || selector input || '''enabled''' (input) | ||
+ | |- | ||
+ | | || || 0 (input 1) || reader 1 | ||
+ | |- | ||
+ | | || || 1 (input 2) || '''data''' (input) | ||
+ | |- | ||
+ | | reader 1 || Logic Reader || in || select 1 | ||
+ | |- | ||
+ | | || || var || setting | ||
+ | |- | ||
+ | | || || out || '''stored''' (output) | ||
+ | |} |
Revision as of 11:53, 18 July 2018
D-latch
A d-latch is a circuit that stores the last value seen at its "data" input while its "enable" input was on.
enabled | data | previous output | output |
0 | x | y | y |
1 | x | y | x |
In theory, a single select unit can do this (selector input = enable, input 1 = output, input 2 = data, output = output). In practice, this is not possible as the game does not allow it to have its own output as input. However, several constructions using two or more circuits are possible.
Connectors
- Enabled: if 1, store data, else do nothing.
- Data: input
- Output: stored value
Using Select Unit and Logic Reader
This d-latch can store any value. It works in two steps:
- a select unit determines whether to store the last output or the "data" input using the "enabled" input. i.e.
if enabled then store = data else store = output
- a logic reader mirrors the value to be stored and feeds it back into the select unit so it can circulate (effectively being stored). This would be obsolete if the select unit could read its own output.
output = store
Unit name | Unit type | Connector / Setting | Source / Value |
---|---|---|---|
select 1 | Select Unit | selector input | enabled (input) |
0 (input 1) | reader 1 | ||
1 (input 2) | data (input) | ||
reader 1 | Logic Reader | in | select 1 |
var | setting | ||
out | stored (output) |