Within Flowcode, users will be accustomed to components and the way they interact with them. A further feature of Flowcode 6 is that these components can very easily be created and added to the library of components already provided with Flowcode.
For this post, the basics of how a component is created, is demonstrated. The component created will create a 3D model of the target chip selected for the project.
For anyone following this as an exercise, you can find the source for the chip component, by clicking this link: ‘Creating components.’ Open Flowcode and then open this file once downloaded.
Our component needs to firstly have an action that is executed when the component is initialised.
Opening the Events macro tab in the project explorer shows the user every available callback macro that is executed on a specific event within flowcode. The macro that executes when our component is initialised is called “Initialise” and then needs to be enabled by creating a callback macro, in this case, “Ev_Initialise”.
Various other macros are available in this menu that can be used to call certain code when a particular event occurs.
Next, to identify the chip and therefore its properties, the user must create component properties for the target chip selection of the enclosing project. This is accomplished by creating a component property and using the correct property name and assigning the properties used within the FCD file. (seen below is the .fcdx file opened with a text-editor, with one of the properties highlighted)
Within the properties menu, we can create the properties, keeping the name the same as was shown in the .fcdx file. The data then needs to be pulled from the FCD file, and assigned to the property as shown in the macro “Ev_Initialise”.
At the end of this macro, we call the macro that handles the generation of the 3D model based on the data pulled in from the chip .fcdx file.
Using the drawing for the physical properties of DIL and QFP chip packages, factors for chip geometries were defined. An oblong shape was created in the system panel window, and named “ChipBody”. This was then re-sized, to the proportions of normal chip packages.
Depending on the geometries and pin count of the target chip, the body of the chip is sized appropriately. A label is also applied to the top face of the chip. The text is sized to not exceed the bounds of the chip body.
At the end of the “ResizeChip” macro, the “DrawPins” macro is called. To be able to create pins for the program to manipulate; an invisible oblong shape was created to provide the base for a pin block. This was named “MasterLeg”. It is referenced in the flowchart numerous times as the shape that is duplicated, and made visible, to show as pin connections on the 3D model.
The length of the sides of the chip are divided into spacings that will fit the number of pins specified in the component property and then duplicated into positions with these spacings. For chips with 4 sides, this process is duplicated once on all 4 edges.
Finally, the marker dot that is present on the face of all chip packages, is re-located to the top left corner of the top face of the chip body.
When the user changes the chip, after having added the component to the project, the 3D model doesn’t change. That is because the component has not defined what should happen when the target chip for the project is changed. Fortunately, Flowcode provides an event macro for when the user changes the target chip (“ChipChange”) and therefore can call the whole process over to re-size and re-place all of the shapes and text described above.
Now, that the component is complete, it can be exported as a component file (File –> Export Component…), and placed into the components folder within the flowcode install location (typically “C:\Program Files (x86)\Flowcode 6\components”). When flowcode is restarted, the new user-created component is available to be used as a component in any project!
Next week I’ll start from scratch on a demonstration of how to create a linear actuator component.
17,206 total views, 4 views today