Page 1 of 1

Reseting simple memory cell / counter

Posted: Mon Dec 05, 2016 8:26 pm
by one-man-bucket
Hi!

I'm trying to use the simple "memory cell / counter" as described in the cookbook (https://wiki.factorio.com/Circuit-network_Cookbook) to mix an exact ratio of items on one belt. I've been trying to figure out for a while how to reset the counter. I thought this design would work (excuse my bad ascii art):

Code: Select all

->         I ===arith==
|            iron * -1
|   ->     O ==========
|   |
|   ->     I ============decider=============
|             iron = -5 --> iron input count
| ->       O ================================
| | 
| ->  ->   I ===arith===
|     |       iron + 0
->    ->   O ===========
      |
      ->   I =====INSERTER========
              enable when iron < 6
             =====================

What it does is it keeps the negative of the counter value, and when the decision combinator hits my batch size (5 in this example) it sends -5 to the memory cell, which i thought would get summed with the current value (5 + (-5) = 0).

What happens instead is that the memory cell is set to -10, so I must be misunderstanding something. Any idea why this is happening? How can I work around it?

Thanks in advance!

Re: Reseting simple memory cell / counter

Posted: Mon Dec 05, 2016 10:49 pm
by DaveMcW
Use a decider combinator as your memory cell, and set the condition to Iron < 5.

For a more advanced reset, use RED = 0 as the condition and generate the red reset signal using whatever logic you want.