CBDLibrary
classes:Drag and drop a ConstantBlock into the canvas:
Right click on the Process
block and rename it to "1":
Add the remaining blocks (a ConstantBlock
, AdderBlock
, and a DelayBlock
), and rename them accordingly:
Select the Connect Ports
tool:
Connect the Out1
output port of the 0
block to the IC
input port of the delay block by clocking once in the first output port, and clicking a second time in the target input port:
You can create "elbows" by clicking anywhere in the canvas.
Create the remaining connections according to the figure:
Don't forget to keep saving your CBD.
Go to File, Export, Causal Block Diagrams:
Define the following constant values:
Hit OK
and select the location where the code is to be exported:
The code looks like the following:
MyHierarchicalCBD.dfmx
. Counter
Note that the CBD is created inside the Counter cluster class:
Right click on the canvas, and select Add Data Output
:
Name it OutCounter
:
OutCounter
port.Using the Connect Ports
tool, click on the OutCounter
port and then click on the connection leaving the output of the delay block:
Don't forget to keep saving your CBD.
Click on the Edit Graph
button:
Drag and drop the Counter
cluster class:
And rename it to counter
.
On the Graph, add a few more block, as follows:
Go to File, Export, Causal Block Diagrams, and define the following constant values:
Select an adequate name for the generate python file:
And enjoy:
Follow this tutorial if you want to code your own block, and still use Dataflow Modeler to link that block with other blocks.
MyCustomBlock
:MyCustomBlock
cluster. MyCustomBlock.dfmx
.MyCustomBlock.dfmx
.The MyCustomBlock
cluster should now be available to use.
MyCBDWithCustomBlock.py
file:MyCustomBlock
class with your own code: