Passing a parameter from Custom component to an Internal Component – KBA230047
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Author: EktaN_26 Version: **
Translation - Japanese: パラメータをカスタムコンポーネントから内部コンポーネントにわたす方法 - KBA230047 - Community Translated (JA)
Question:
How to use component expression view to pass a parameter from a custom component to an existing Internal component?
Answer:
The following steps show how to pass a parameter (“my_parameter”) from a custom component (“custom_clock”) to an internal component (clock in this example):
1. Create a project and go to the components tab in the workspace explorer.
2. To create a schematic file for the custom component; go to the components tab, right-click on the project in workspace explorer and select add component item. In the add component dialogue box select schematic under Implementation, provide the component name (custom_clock) and press Create New.
Figure 1. Step 2
3. Drag and drop a component (clock) on the schematic file as shown in the Figure 2. In this case connect a Digital Terminal Out to the clock component. Name the terminal as Terminal_out. You can drag any component based on your requirement.
Figure 2. Step 3
4. To create the component symbol, right-click on the empty space of the schematic ( .cysch file) and select Generate Symbol. This generates a symbol for the custom component as shown in the Figure 4.
Figure 3. Step 3
Figure 4. Generated symbol for the custom component
5. Right-click on the empty space of the symbol file and select Symbol parameters, to add a parameter (“my_parameter”) to the component. Click on the plus sign to add a parameter.
Figure 5. Step 5
Figure 6. Parameter Definition box showing the newly added parameter
In this case ‘my_parameter’ value is passed to the Internal (clock) component to set the frequency of the clock.
6. Go to Tools > Options. Under Design Entry > Component Catalog check the Enable Param Edit Views box. Click > OK.
Figure 7. Step 6
7. Double-click on the component (clock) to open the configure component dialogue box. Right-click over the Basic tab and select Show Expression View from the drop-down menu.
Figure 8. Step 7
You will see the configuration box as shown in Figure 9.
Figure 9. Configuration box on selecting show expression view
8. Replace the value of the expression (desired_freq) to which the “my_parameter” value has to be passed with “$” symbol followed by the parameter name. For example: “$my_parameter”
Figure 10. Step 8
9. The process is now complete. Changing the “my_parameter” value in the “custom clock” component will automatically change the frequency of the clock in the schematic of the component.