ON THIS WIKI
MiscMFRcircuits
MiscMFRcircuits | |
---|---|
Name | MiscMFRcircuits |
Creator | Unknown |
Type | addon |
Latest Version | 0.6.0 |
Minecraft Version | Unknown |
Website | Minecraft forums |
Root Mod | MineFactory Reloaded |
MiscMFRcircuits - an addon for MineFactory Reloaded that implements additional circuits for Programmable RedNet Controller
Contents
[hide]- 1 Introduction
- 2 Conversion circuits
- 3 Analog circuits
- 4 32-bit circuits
- 4.1 AND2
- 4.2 OR2
- 4.3 XOR2
- 4.4 NOT
- 4.5 NAND2
- 4.6 NOR2
- 4.7 XNOR2
- 4.8 Binary to Gray code converter
- 4.9 Gray to Binary
- 4.10 2×16 bit encoder
- 4.11 4×8 bit encoder
- 4.12 8×4 bit encoder
- 4.13 2×16 bit decoder
- 4.14 4×8 bit decoder
- 4.15 8×4 bit decoder
- 4.16 Shift left
- 4.17 Shift right
- 4.18 RAM circuits
- 4.19 CG ROM
- 5 Logic circuits
- 6 Relay circuits
Introduction
Data types and naming convention:
- boolean is a data type with two possible values:
- High or H (logical 1) - input: non-zero value; output: 15;
- Low or L (logical 0) - input: zero value; output: 0;
- int or word - 32-bit signed integer, −2 147 483 648 … 2 147 483 647 ( from (-231) to 231).
- byte - 8-bit unsigned integer, 0…255 (from 0 to 28-1), corresponds to the values that could be entered using PRC interface;
- short - 16-bit unsigned integer, 0…65535 (from 0 to 216-1);
- nibble - 4-bit unsigned integer, 0…15 (0…24-1), equivalent to the vanilla redstone signal range;
Some useful numbers in decimal (base 10), binary (base 2) and hexadecimal (base 16) representations include:
-2 147 483 648 | 0b1000 0000 0000 0000 0000 0000 0000 0000 | 0x8000 0000 | [Expand] |
Truth table for logical operations:
INPUT | OUTPUT | ||||||
---|---|---|---|---|---|---|---|
A | B | A OR B | A AND B | A XOR B | A NOR B | A NAND B | A XNOR B |
0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
0 | 1 | 1 | 0 | 1 | 0 | 1 | 0 |
1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 |
1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 |
Conversion circuits
Data conversion circuits use mIC:LB: prefix
ADC
Inputs:
- A0: int; While input accepts full 32-bit integer, only 16 least significant bits are used.
Outputs:
- Y0…Y15: boolean; return boolean value of the corresponding bit from
A0
input.
Bargraph
Number of HIGH outputs (Y0…Y10) is proportional to the input value
Inputs:
- A: 0…10; Input value, the signal will be limited to 0..10 range automatically
- TST: boolean; Test input, setting it to HIGH value will activate all output ports
Outputs:
- OL: boolean; overload - active when A is either greater than 10 or less than 0.
- Y0…Y10: boolean; bargraph port - when A=0 only Y0 is active, when A=1 active ports are Y0 and Y1, A=2: Y0, Y1 and Y3 and so on.
DAC
Encodes 16 boolean signals into 16-bit integer
Inputs:
- A0…A15: boolean; signal input, A0 is the LSB (least significant bit), A15 is the MSB (most significant bit)
Outputs:
- Y0: short; result;
Threshold detector
The circuit provides debouncing for the input signal, output Q will be set to HIGH when input signal crosses "on" (S1) setpoint, but to become LOW the signal must cross "off" (S0) value.
Inputs:
- PV: int; Input value;
- S0: int; off setting;
- S1: int; on setting;
Outputs:
- Q: boolean; result;
Analog circuits
hh:mm:ss timer
Provides timer circuit with configurable duty cycle. Signal period is Ts+Tm+Th
Inputs:
- Ts: 1…255; signal period in seconds
- Tm: 0…255; signal period in minutes
- Th: 0…24; signal period in hours
- DC: 0…100; duty cycle
- EN#: boolean; disable timer (requires HIGH input to disable the circuit)
- RST: boolean; reset circuit
Outputs:
- Q: boolean; Output signal
- Qs: boolean; 1-tick wide pulse on every second of active output signal
- Qm: boolean; same pulse every minute
- Qh: boolean; and every hour
AbsSign
Circuit returns sign and absolute value of the input signal and performs related functions.
Inputs:
- I: int; Input signal
Outputs:
- ABS: int; returns absolute value of I;
- SGN: (-1|0|1):sign of I;
-1 whenI<0
0 whenI=0
1 whenI>0
- POS: boolean; HIGH when I is a positive integer (
I>0
), LOW otherwise; - ==0: boolean; HIGH when I is a zero (
I=0
), LOW otherwise; - <>0: boolean; HIGH when I is not a zero (
I≠0
), LOW otherwise; - NEG: boolean; HIGH when I is a negative integer (
I<0
), LOW otherwise.
Analog adder (8 input)
Does addition RSLT=X0+X1+X2+X3+X4+X5+X6+X7
. Circuit doesn't evaluates possible 32-bit overflow during the addition procedure.
Inputs:
- X0…X7: int;
Outputs:
- RSLT: int;
Average
Averages input signal over Ta clock periods
Inputs:
- X: short; input value
- Ta: short; averaging period, in clock periods
- CLK: boolean; clock input
Outputs:
- RSLT: int; result
Constraint
Circuit restricts input signal to Imn..Imx boundaries
Inputs:
- I: int; Input value
- Imn: int; Lower limit (minimum possible value for output signal)
- Imx: int; Upper limit (maximum possible value for output signal)
Outputs:
- Q: int; Output signal. Q=I when Imn <= I <= Imx, and Q=Imn or Q=Imx otherwise
Multiply
Y=A·B
Inputs:
- A: int; Multiplicand
- B: int; Multiplier
Outputs:
- Y: int; Product
- OF: boolean; Overflow - signal is HIGH when A·B>2 147 483 647 or A·B<−2 147 483 648
Divide
Performs integer division, A\B={Q,R}
so A=B·Q+R
Inputs:
- A: int; Dividend
- B: int; Divisor
Outputs:
- Q: int; Quotient
- R: int; Remainder
- Err: boolean; Division error, HIGH when
B=0
Multiply and divide
(M1·M2)\D={Q,R}
, that Q·D+R=M1·M2
Inputs:
- M1: int; Multiplicand
- M2: int; Multiplier
- D: int; Divisor
Outputs:
- Q: int; Quotient
- R: int; Remainder
- Err: boolean; HIGH division by zero is attempted (
D=0
), LOW otherwise
Quad Adder (4 two-input adders)
Inputs:
- A0…A3: int;
- B0…B3: int;
Outputs:
- Y0…Y3: int;
PID Controller
Implements digital PID controller
Inputs:
- PV: int; present value (input value)
- SV: int; setting value
- Kp: int; Proportional gain
- Ki: int; Integral gain
- Kd: int; Derivative gain
- dt: 1…255; integration period, in ticks
- RST: boolean; Reset, resets internal integration counter and stop it.
Outputs:
- Out: int; output value
- err: int; error value
- int: int; internal integration counter value (debug parameter)
- RST: boolean; reset state (HIGH when circuit is reset)
32-bit circuits
Operand | BIN | HEX | DEC |
---|---|---|---|
a | 0b0000 0000 0000 0000 0000 0000 0000 1011 | 0x0000 000B | 11 |
b | 0b0000 0000 0000 0000 0000 0000 0011 1001 | 0x0000 0039 | 57 |
Result | |||
AND | 0b0000 0000 0000 0000 0000 0000 0000 1001 | 0x0000 0009 | 9 |
OR | 0b0000 0000 0000 0000 0000 0000 0011 1011 | 0x0000 003B | 59 |
XOR | 0b0000 0000 0000 0000 0000 0000 0011 0010 | 0x0000 0032 | 50 |
NAND | 0b1111 1111 1111 1111 1111 1111 1111 0110 | 0xFFFF FFF6 | -10 |
NOR | 0b1111 1111 1111 1111 1111 1111 1100 0100 | 0xFFFF FFC4 | -60 |
XNOR | 0b1111 1111 1111 1111 1111 1111 1100 1101 | 0xFFFF FFCD | -51 |
AND2
Performs bitwise AND:
Y=A and B
Inputs:
- A: int; first operand
- B: int; second operand
Outputs:
- Y: int; result
OR2
Performs bitwise OR:
Y=A or B
Inputs:
- A: int; first operand
- B: int; second operand
Outputs:
- Y: int; result
XOR2
Performs bitwise XOR:
Y=A xor B
Inputs:
- A: int; first operand
- B: int; second operand
Outputs:
- Y: int; result
NOT
Performs bitwise NOT:
Y = not A
Inputs:
- A: int; operand
Outputs:
- Y: int; result
NAND2
Performs bitwise NAND operation:
Y = A nand B
Inputs:
- A: int; first operand
- B: int; second operand
Outputs:
- Y: int; result
NOR2
Performs bitwise NOR:
Y=A nor B
Inputs:
- A: int; first operand
- B: int; second operand
Outputs:
- Y: int; result
XNOR2
Performs bitwise XNOR2:
Y=A xnor B
Inputs:
- A: int; first operand
- B: int; second operand
Outputs:
- Y: int; result
Binary to Gray code converter
Inputs:
- Bin: int; number with assumed binary encoding
Outputs:
- Gry: int; number with gray encoding
Gray to Binary
Inputs:
- Gry: int; number with assumed gray encoding
Outputs:
- Bin: int; number with binary encoding
2×16 bit encoder
Combines two 16-bit integers into one 32-bit number
Inputs:
- Lo: short;
- Hi: short;
Outputs:
- Y: int; result
4×8 bit encoder
Packs four bytes into 32-bit integer
Inputs:
- A0…A3: byte;
Outputs:
- Y: int; result
8×4 bit encoder
The circuit packs eight 4-bit integers into 32-bit integer.
It could be used to send 8 redstone signals (each of which has 0..15 value) over one rednet channel.
Inputs:
- A0…A7: nibble;
Outputs:
- Y: int; result
2×16 bit decoder
Inputs:
- A: int;
Outputs:
- Lo: short;
- Hi: short;
4×8 bit decoder
Inputs:
- A: int;
Outputs:
- Y0…Y3: byte;
8×4 bit decoder
Inputs:
- A: int;
Outputs:
- Y0…Y7: nibble;
Shift left
Inputs:
- A: int;
- n: byte;
Outputs:
- Y: int;
- C: boolean; carry bit
Shift right
Inputs:
- A: int;
- n: byte;
Outputs:
- Y: int;
- C: boolean; carry bit
RAM circuits
- 1 word
- 8 words
- 16 words
Inputs:
- D: int; input value
- ADR: address
- WR: boolean; write enable
- CLK: boolean; clock
- RST: boolean; reset
Outputs:
- OUT: int; memory cell value
CG ROM
Inputs:
- A: byte: ASCII code for the character
Outputs:
- Y0…Y7: byte; rows of character image, bits in every byte represent columns of the image
Logic circuits
Quad AND2
Performs logic AND on every pair of inputs independently:
Y0=A0 and B0
…
Y3=A3 and B3
Inputs:
- A0…A3: boolean; first operands
- B0…B3: boolean; second operands
Outputs:
- Y0…Y3: boolean; results
Quad NOT
Inputs:
- A0…A3: boolean;
Outputs:
- Y0…Y3: boolean;
Quad OR2
Inputs:
- A0…A3: boolean;
- B0…B3: boolean;
Outputs:
- Y0…Y3: boolean;
Quad XOR
Inputs:
- A0…A3: boolean;
- B0…B3: boolean;
Outputs:
- Y0…Y3: boolean;
All the same
Inputs:
- A0…A7: boolean;
- CNT: 1…8;
Outputs:
- Y: boolean;
Even number of inputs active
Produces HIGH signal on output Y when even number of inputs A0…A7 HIGH
Inputs:
- A0…A7: boolean; input
Outputs:
- Y: boolean; output
Odd number of inputs active
Produces HIGH signal on output Y when odd number of inputs A0…A7 HIGH
Inputs:
- A0…A7: boolean;
Outputs:
- Y: boolean;
At least N inputs active
Inputs:
- A0…A7: boolean;
- N: 1…8;
Outputs:
- Y: boolean;
N and only N inputs active
Inputs:
- A0…A7: boolean;
- N: 1…8;
Outputs:
- Y: boolean;
2 of 3 inputs active (majority gate)
Inputs:
- A0…A2: boolean;
Outputs:
- Y: boolean;
5-stage Johnson counter
(see datasheet for 4017)
Inputs:
- C0: boolean; active HIGH clock input
- C1#: boolean; active LOW clock input
- MR: boolean; asynchronous master reset input
Outputs:
- Q0…Q9: boolean; signal output
- Q#: boolean; output from the most significant flip-flop (active LOW).
Relay circuits
Max DT relay
Maximum input definite time relay;
Inputs:
- I: int; input signal
- Imx: int; (maximum) Threshold setting
- TD: int; Time delay, in ticks.
- EN#: boolean; 'Disable' when input is HIGH (when non-zero signal is present it stops tick counting)
Outputs:
- TRP: boolean; 'relay tripped'. Imx threshold was exceeded for TD ticks, protection circuit must be activated.
- ST: boolean; 'relay started' Imx threshold was exceeded, but TD time didn't pass.
- TRP#: boolean; 'relay not tripped'
- ST#: boolean; 'relay not started'
Min DT relay
Minimum input definite time relay;
Inputs:
- I: int; input signal
- Imn: int; (minimum) Threshold setting
- TD: int; Time delay, in ticks.
- EN#: boolean; 'Disable' when input is HIGH (when non-zero signal is present it stops tick counting)
Outputs:
- TRP: boolean; 'relay tripped'. Signal I was less than Imn threshold for TD ticks, protection circuit must be activated.
- ST: boolean; 'relay started' signal input condition was activated, but TD time delay hasn't been exceeded.
- TRP#: boolean; 'relay not tripped'
- ST#: boolean; 'relay not started'
Inverse time relay
Inputs:
- I: int; input signal
- I1p: short; pick-up value; minimum signal value when relay can be activated,
- I1i: short; integration counter multiplier for the relay, relay adds I/(100*I1k) to internal counter every tick.
- I1k: 1…1000; when internal integration counter exceeds this value - relay will trip.
- I2: 64…255 'immediate trip', relay will trip immediately when I>I1p*I2/64;
- EN# boolean; 'disable relay'
Outputs:
- TRP: boolean; 'relay tripped'
- ST: boolean; 'relay started'
- TRP#: boolean; 'relay is not tripped'
- ST#: boolean; 'relay is not started'
Automatic transfer switch
This circuit could be used to monitor and control power plant.
Inputs:
- Mok: boolean; main power source is ready. (lava or fuel in the tank, boiler is warm, energy cell has some energy, there is coal (or other fuel) in AE network.
- Sok: boolean; stand-by power source is ready.
- Td: byte; time delay in seconds (0-255) between main <> standby transition. For most purposes it should be a constant.
- RST: boolean; standby reset - when HIGH (non-zero) signal is received and main power source is ready (Mok) it transfer output from standby source to the main one. Set it to constant non-zero value if you want automatic transfer to the restored main supply.
Outputs:
- EnS: boolean; 'Enable Stand-by' command to turn on stand-by power supply (activate magmatic or combustion engines, enable energy cell, start loading coal into generators or pumping lava into geothermals)
- EnM: boolean; (optional) 'Enable Main' command to turn on main power supply.
- ALM: boolean; 'Alarm' is active when at least one of the power sources is not ready
- ERR: boolean; 'Error' (complete power loss) - active when both power sources are unavailable.