24,534 ARTICLES
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

Introduction[edit]

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
-1 000 000 000   0b1100 0100 0110 0101 0011 0110 0000 0000   0xC465 3600
-1 000 000   0b1111 1111 1111 0000 1011 1101 1100 0000   0xFFF0 BDC0
-100 000   0b1111 1111 1111 1110 0111 1001 0110 0000   0xFFFE 7960
-10 000   0b1111 1111 1111 1111 1101 1000 1111 0000   0xFFFF D8F0
-1 000   0b1111 1111 1111 1111 1111 1100 0001 1000   0xFFFF FC18
-128   0b1111 1111 1111 1111 1111 1111 1000 0000   0xFFFF FF80
-127   0b1111 1111 1111 1111 1111 1111 1000 0001   0xFFFF FF81
-100   0b1111 1111 1111 1111 1111 1111 1001 1100   0xFFFF FF9C
-64   0b1111 1111 1111 1111 1111 1111 1100 0000   0xFFFF FFC0
-63   0b1111 1111 1111 1111 1111 1111 1100 0001   0xFFFF FFC1
-31   0b1111 1111 1111 1111 1111 1111 1110 0001   0xFFFF FFE1
-15   0b1111 1111 1111 1111 1111 1111 1111 0001   0xFFFF FFF1
-8   0b1111 1111 1111 1111 1111 1111 1111 1000   0xFFFF FFF8
-7   0b1111 1111 1111 1111 1111 1111 1111 1001   0xFFFF FFF9
-3   0b1111 1111 1111 1111 1111 1111 1111 1101   0xFFFF FFFD
-2   0b1111 1111 1111 1111 1111 1111 1111 1110   0xFFFF FFFE
-1   0b1111 1111 1111 1111 1111 1111 1111 1111   0xFFFF FFFF
0   0b0000 0000 0000 0000 0000 0000 0000 0000   0x0000 0000
1   0b0000 0000 0000 0000 0000 0000 0000 0001   0x0000 0001 White
2   0b0000 0000 0000 0000 0000 0000 0000 0010   0x0000 0002 Orange
3   0b0000 0000 0000 0000 0000 0000 0000 0011   0x0000 0003
4   0b0000 0000 0000 0000 0000 0000 0000 0100   0x0000 0004 Magenta
5   0b0000 0000 0000 0000 0000 0000 0000 0101   0x0000 0005
6   0b0000 0000 0000 0000 0000 0000 0000 0110   0x0000 0006
7   0b0000 0000 0000 0000 0000 0000 0000 0111   0x0000 0007
8   0b0000 0000 0000 0000 0000 0000 0000 1000   0x0000 0008 Light blue
9   0b0000 0000 0000 0000 0000 0000 0000 1001   0x0000 0009
10   0b0000 0000 0000 0000 0000 0000 0000 1010   0x0000 000A
11   0b0000 0000 0000 0000 0000 0000 0000 1011   0x0000 000B
12   0b0000 0000 0000 0000 0000 0000 0000 1100   0x0000 000C
13   0b0000 0000 0000 0000 0000 0000 0000 1101   0x0000 000D
14   0b0000 0000 0000 0000 0000 0000 0000 1110   0x0000 000E
15   0b0000 0000 0000 0000 0000 0000 0000 1111   0x0000 000F
16   0b0000 0000 0000 0000 0000 0000 0001 0000   0x0000 0010 Yellow
32   0b0000 0000 0000 0000 0000 0000 0010 0000   0x0000 0020 Lime
64   0b0000 0000 0000 0000 0000 0000 0100 0000   0x0000 0040 Pink
128   0b0000 0000 0000 0000 0000 0000 1000 0000   0x0000 0080 Gray
255   0b0000 0000 0000 0000 0000 0000 1111 1111   0x0000 00FF
256   0b0000 0000 0000 0000 0000 0001 0000 0000   0x0000 0100 Light gray
512   0b0000 0000 0000 0000 0000 0010 0000 0000   0x0000 0200 Cyan
1 000   0b0000 0000 0000 0000 0000 0011 1110 1000   0x0000 03E8
1 024   0b0000 0000 0000 0000 0000 0100 0000 0000   0x0000 0400 Purple
2 048   0b0000 0000 0000 0000 0000 1000 0000 0000   0x0000 0800 Blue
4 096   0b0000 0000 0000 0000 0001 0000 0000 0000   0x0000 1000 Brown
8 192   0b0000 0000 0000 0000 0010 0000 0000 0000   0x0000 2000 Green
10 000   0b0000 0000 0000 0000 0010 0111 0001 0000   0x0000 2710
16 384   0b0000 0000 0000 0000 0100 0000 0000 0000   0x0000 4000 Red
32 767   0b0000 0000 0000 0000 0111 1111 1111 1111   0x0000 7FFF
32 768   0b0000 0000 0000 0000 1000 0000 0000 0000   0x0000 8000 Black
65 535   0b0000 0000 0000 0000 1111 1111 1111 1111   0x0000 FFFF
65 536   0b0000 0000 0000 0001 0000 0000 0000 0000   0x0001 0000
100 000   0b0000 0000 0000 0001 1000 0110 1010 0000   0x0001 86A0
1 000 000   0b0000 0000 0000 1111 0100 0010 0100 0000   0x000F 4240
16 777 216   0b0000 0001 0000 0000 0000 0000 0000 0000   0x0100 0000
1 000 000 000   0b0011 1011 1001 1010 1100 1010 0000 0000   0x3B9A CA00
2 147 483 647   0b0111 1111 1111 1111 1111 1111 1111 1111   0x7FFF FFFF

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[edit]

Data conversion circuits use mIC:LB: prefix

ADC[edit]

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[edit]

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[edit]

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[edit]

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[edit]

hh:mm:ss timer[edit]

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[edit]

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 when I<0
    0 when I=0
    1 when I>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)[edit]

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[edit]

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[edit]

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[edit]

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[edit]

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[edit]

(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)[edit]

Inputs:

  • A0…A3: int;
  • B0…B3: int;

Outputs:

  • Y0…Y3: int;

PID Controller[edit]

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[edit]

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[edit]

Performs bitwise AND:

Y=A and B

Inputs:

  • A: int; first operand
  • B: int; second operand

Outputs:

  • Y: int; result

OR2[edit]

Performs bitwise OR:

Y=A or B

Inputs:

  • A: int; first operand
  • B: int; second operand

Outputs:

  • Y: int; result

XOR2[edit]

Performs bitwise XOR:

Y=A xor B

Inputs:

  • A: int; first operand
  • B: int; second operand

Outputs:

  • Y: int; result

NOT[edit]

Performs bitwise NOT:

Y = not A

Inputs:

  • A: int; operand

Outputs:

  • Y: int; result

NAND2[edit]

Performs bitwise NAND operation:

Y = A nand B

Inputs:

  • A: int; first operand
  • B: int; second operand

Outputs:

  • Y: int; result

NOR2[edit]

Performs bitwise NOR:

Y=A nor B

Inputs:

  • A: int; first operand
  • B: int; second operand

Outputs:

  • Y: int; result

XNOR2[edit]

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[edit]

Inputs:

  • Bin: int; number with assumed binary encoding

Outputs:

  • Gry: int; number with gray encoding

Gray to Binary[edit]

Inputs:

  • Gry: int; number with assumed gray encoding

Outputs:

  • Bin: int; number with binary encoding

2×16 bit encoder[edit]

Combines two 16-bit integers into one 32-bit number

Inputs:

  • Lo: short;
  • Hi: short;

Outputs:

  • Y: int; result

4×8 bit encoder[edit]

Packs four bytes into 32-bit integer

Inputs:

  • A0…A3: byte;

Outputs:

  • Y: int; result

8×4 bit encoder[edit]

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[edit]

Inputs:

  • A: int;

Outputs:

  • Lo: short;
  • Hi: short;

4×8 bit decoder[edit]

Inputs:

  • A: int;

Outputs:

  • Y0…Y3: byte;

8×4 bit decoder[edit]

Inputs:

  • A: int;

Outputs:

  • Y0…Y7: nibble;

Shift left[edit]

Inputs:

  • A: int;
  • n: byte;

Outputs:

  • Y: int;
  • C: boolean; carry bit

Shift right[edit]

Inputs:

  • A: int;
  • n: byte;

Outputs:

  • Y: int;
  • C: boolean; carry bit

RAM circuits[edit]

  • 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[edit]

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[edit]

Quad AND2[edit]

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[edit]

Inputs:

  • A0…A3: boolean;

Outputs:

  • Y0…Y3: boolean;

Quad OR2[edit]

Inputs:

  • A0…A3: boolean;
  • B0…B3: boolean;

Outputs:

  • Y0…Y3: boolean;

Quad XOR[edit]

Inputs:

  • A0…A3: boolean;
  • B0…B3: boolean;

Outputs:

  • Y0…Y3: boolean;

All the same[edit]

Inputs:

  • A0…A7: boolean;
  • CNT: 1…8;

Outputs:

  • Y: boolean;

Even number of inputs active[edit]

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[edit]

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[edit]

Inputs:

  • A0…A7: boolean;
  • N: 1…8;

Outputs:

  • Y: boolean;

N and only N inputs active[edit]

Inputs:

  • A0…A7: boolean;
  • N: 1…8;

Outputs:

  • Y: boolean;

2 of 3 inputs active (majority gate)[edit]

Inputs:

  • A0…A2: boolean;

Outputs:

  • Y: boolean;

5-stage Johnson counter[edit]

(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[edit]

Max DT relay[edit]

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[edit]

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[edit]

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[edit]

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.