03-29-2009 01:35 PM
Escatrax wrote:Can't I use 3 shift registers: one for adding 1l/sec, one for adding 0,5l/sec and one for decrementing with 1l/sec?
A pair of shift registers is just storage. You need two:
The tank increment is either 1, 0.5, or -1, and the actual value must be calculated from LEVEL and STATE.
Here's a minimal solution, see if you understand it.
03-29-2009 01:45 PM
Hallo altenbach,
Well I understand some things, but I haven't started working with arrays so I have to study it before I understand it completely.
But there's one thing I can't figure out namely you've put a local variable of the stop button outside the while loop en connected it to the loop condition. Why?
thanks alot for helping me out!!
03-29-2009 01:55 PM
Since the stop button should not immediately stop the loop, but initiate draning of the tank, we need switch action instead of latch action (right-click...mechanical action). This means that the stop button should stay TRUE until the program stops (or until the stop is canceled by the operator). Once the loop stops, the program should reset the button to FALSE so the code does not stop right away next time we run the program.
There are many other ways to solve this. You can also force the button to FALSE right before the loop when the program starts. This may require a sequence frame (since local variables don't do dataflow) or you could use a value property with the error output wired to the while loop. Doing it before the loop has the advantage that it also works if you would stop the program with the abort button.
03-29-2009 02:27 PM