The Schematic Editor (Tutorial)
This section explains step-by-step how to create a schematic that models the counter.
Create a new project file
It is not strictly necessary to create a project file, but it is recommended to start the project by saving an empty project file in order to settle the project path.
- In the File menu, choose Save Project As....
- Choose a location in the file selector, enter a name (e.g. Counter; the extension .spp will be added automatically if necessary), and click OK.
Create a new schematic
- Create a new schematic by choosing File:New Schematic, by clicking the New Schematic toolbar button or by pressing Ctrl-N. A new file called Unnamed1.spp is created as can be seen under the Source Files folder in the project tree in the left part of the window. Notice that the file does not yet exist on disk. The first time it is saved (File:Save or Ctrl-S), RTflow will ask for its actual location and filename.
Add blocks
A schematic consists of blocks and connections. The blocks represent the functions to be computed, and the connections, shown as simple lines between the blocks, represent the signals that flow between these functions. There are also port blocks to represent input and output signals. Blocks are added to the schematic by dragging them from the blocks tree, on the Blocks tab in the left part of the window, into the schematic area.
- Click the Blocks tab in the lower left part of the window to show the blocks tree.
- Drag the BoolInput block from the blocks tree into the schematic area. This block represents a boolean input signal.
- Drag the IntOutput block from the blocks tree into the schematic area. This block represents an integer output signal.
- Open the Logic folder in the blocks tree by clicking on its + sign.
- Drag the If block from the blocks tree into the schematic area. This block represents an "If" function that selects either of two values depending on a third boolean value.
Rename the inputs and outputs
RTflow gives input and output blocks default names like BoolInput1 and IntOutput1. These can be changed by clicking on the name.
- Click on BoolInput1, enter enable and press Enter.
- Click on IntOutput1, enter count and press Enter.
In general, text that appears in green color in the schematic can be edited by clicking it. Editing can be aborted by pressing the Esc key. For details, see the Renaming an Element section.
Add connections
Connections are created by clicking once on the small line representing the output port of the source block and then once on the input port of the destination block.
- Move the mouse cursor to the right edge of the enable input block. A blue square appears around its port, indicating that clicking will start creating a connection from this port. Click the port.
- Move the mouse cursor to the small vertical line at the bottom of the If block. A blue square appears around its port, indicating that clicking will finalize the connection to this port. Click the port. A connection has now been created, indicating that the enable input will be used as the selector value of the If function.
- Create a connection from the port on the right edge of the If block to the port on the left edge of the count output in the same way as above. The output block will move up or down vertically to align with the block that it is connected to. (This behavior can be turned off as follows: Right-click the schematic, choose Properties..., click the Automation tab, uncheck Align ports vertically with blocks and click OK. However, keeping this function on typically makes it easier to maintain the layout of simpler schematics.)
RTflow does not allow open-ended connections. This means that clicking anywhere else than on a destination port when a connection has been started (as after the first step above) will cancel the connection. It also means that if a block is deleted, all connections to and from the deleted block will also be deleted automatically. For details, see the Adding a Connection section.
Finalize the schematic
Complete the schematic with the blocks and connections as shown in the screenshot above. The box with a single number in it is the Value block in the Arithmetic folder. The value in it can be edited by clicking it, just as with input and output names. The Add block is likewise in the Arithmetic folder, and the Pre block can be found in the Dynamic folder.
- At any time, the schematic can be saved with File:Save or Ctrl-S. Name the schematic file Counter.sps.
- Blocks can be moved by dragging them, and the inner segments of connections can also be moved by dragging. See the Moving a Block and Moving a Connection sections for details.
- Blocks and connections can be deleted by clicking them once and pressing the Del key.
- Also notice Undo, Redo and the clipboard functions in the Edit menu.