{"id":21417,"date":"2022-05-25T13:22:54","date_gmt":"2022-05-25T05:22:54","guid":{"rendered":"https:\/\/hongtronics.com\/?p=21417"},"modified":"2024-07-11T11:44:55","modified_gmt":"2024-07-11T03:44:55","slug":"automation-softplc-sub-program-and-user-defined-udfb","status":"publish","type":"post","link":"https:\/\/hongtronics.com\/en\/automation-softplc-sub-program-and-user-defined-udfb\/","title":{"rendered":"Automation softPLC Teaching Guide (2) - Subroutines and User-Defined Function Blocks UDFBs"},"content":{"rendered":"<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"146\" src=\"https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/03\/640-1024x146.gif\" alt=\"\" class=\"wp-image-19754\" srcset=\"https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/03\/640-1024x146.gif 1024w, https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/03\/640-300x43.gif 300w, https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/03\/640-600x86.gif 600w, https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/03\/640-768x110.gif 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\"><strong>HONGKE Automation softPLC is a programming environment for developing PLCs for real-time operating systems such as Linux, Xenomai, INtime, Windows, etc. It is very suitable for users who need to use IEC61131-3 and PLCopen standard control technology and PLC programming.<\/strong>This article will help you create and develop functions and function blocks using the IEC language.<\/p>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button aligncenter has-custom-font-size is-style-fill has-medium-font-size\"><a class=\"wp-block-button__link has-vivid-cyan-blue-background-color has-background\" href=\"https:\/\/hongtronics.com\/en\/automation-softplc-user-guide1\/\" style=\"border-radius:33px\"><strong>Learn from the past - Automation softPLC Teaching Guide (1) Getting Started Guide<\/strong><\/a><\/div>\n<\/div>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Hongke Automation softPLC Studio Naming Rules<\/strong><\/p>\n\n\n\n<p class=\"has-medium-font-size\"># Functions written in IEC language are called subroutines.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"># Function blocks developed in the IEC language are called UDFBs.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"># UDFB stands for \u201cUser Defined Function Block\u201d.\u201d<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Note: This document is for Automation softPLC Studio version 1.0 or higher. automation softPLC Studio needs to be installed on a Windows PC.<\/p>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Creating and using subroutines<\/h2>\n\n\n\n<p class=\"has-medium-font-size\">Click Insert New Program from the workspace menu.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"448\" height=\"250\" src=\"https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640.jpg\" alt=\"\" class=\"wp-image-21423\" srcset=\"https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640.jpg 448w, https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-300x167.jpg 300w\" sizes=\"(max-width: 448px) 100vw, 448px\" \/><\/figure><\/div>\n\n\n\n<p class=\"has-medium-font-size\">After naming it, select the language you want, note that this language cannot be SFC.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"441\" height=\"520\" src=\"https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-8.jpg\" alt=\"\" class=\"wp-image-21424\" srcset=\"https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-8.jpg 441w, https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-8-300x354.jpg 300w, https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-8-254x300.jpg 254w\" sizes=\"(max-width: 441px) 100vw, 441px\" \/><\/figure><\/div>\n\n\n\n<p class=\"has-medium-font-size\">Clicking OK opens another dialog box that lets you define the outputs and outputs of the subroutine.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"441\" height=\"520\" src=\"https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-2.jpg\" alt=\"\" class=\"wp-image-21420\" srcset=\"https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-2.jpg 441w, https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-2-300x354.jpg 300w, https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-2-254x300.jpg 254w\" sizes=\"(max-width: 441px) 100vw, 441px\" \/><\/figure><\/div>\n\n\n\n<p class=\"has-medium-font-size\"><br>Use the workspace menu to modify parameters.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"474\" height=\"367\" src=\"https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-3.jpg\" alt=\"\" class=\"wp-image-21421\" srcset=\"https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-3.jpg 474w, https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-3-300x232.jpg 300w\" sizes=\"(max-width: 474px) 100vw, 474px\" \/><\/figure><\/div>\n\n\n\n<p class=\"has-medium-font-size\">In the Local Variable Editor, you can still see these parameters and can add or modify them<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"867\" height=\"482\" src=\"https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-4.jpg\" alt=\"\" class=\"wp-image-21422\" srcset=\"https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-4.jpg 867w, https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-4-300x167.jpg 300w, https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-4-600x334.jpg 600w, https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-4-768x427.jpg 768w\" sizes=\"(max-width: 867px) 100vw, 867px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">After completing the above settings, the subroutine can be called from other POUs.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"425\" src=\"https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-5-1024x425.jpg\" alt=\"\" class=\"wp-image-21418\" srcset=\"https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-5-1024x425.jpg 1024w, https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-5-300x124.jpg 300w, https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-5-600x249.jpg 600w, https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-5-768x319.jpg 768w, https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-5.jpg 1080w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<hr class=\"wp-block-separator is-style-dots\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2,<strong>Creating and Using a UDFB<\/strong><\/h2>\n\n\n\n<p class=\"has-medium-font-size\">The above steps also apply to User Defined Function Blocks (UDFB), note that you need to select the \u201cUDFB\u201d option in the New Program dialog box.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"441\" height=\"521\" src=\"https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-6.jpg\" alt=\"\" class=\"wp-image-21419\" srcset=\"https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-6.jpg 441w, https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-6-300x354.jpg 300w, https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/AnyConv.com__640-6-254x300.jpg 254w\" sizes=\"(max-width: 441px) 100vw, 441px\" \/><\/figure><\/div>\n\n\n\n<hr class=\"wp-block-separator is-style-default\"\/>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/01\/\u5b8f\u8679\u8cc7\u8a0a\u5361-1024x576.png\" alt=\"\" class=\"wp-image-17585\"\/><figcaption>Contact Us<\/figcaption><\/figure>","protected":false},"excerpt":{"rendered":"<p>\u8679\u79d1 Automation softPLC \u662f\u70ba Linux\u3001Xenomai\u3001INtime\u3001Windows \u7b49 [&hellip;]<\/p>","protected":false},"author":29,"featured_media":21425,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"minimal","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","iawp_total_views":102,"ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[2315],"tags":[1634],"table_tags":[],"class_list":["post-21417","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-2315","tag-automation-softplc","entry","has-media","owp-thumbs-layout-horizontal","owp-btn-normal","owp-tabs-layout-horizontal","has-no-thumbnails","has-product-nav"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/hongtronics.com\/wp-content\/uploads\/2022\/05\/softplc-user-guide2-1.jpg","_links":{"self":[{"href":"https:\/\/hongtronics.com\/en\/wp-json\/wp\/v2\/posts\/21417","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hongtronics.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hongtronics.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hongtronics.com\/en\/wp-json\/wp\/v2\/users\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/hongtronics.com\/en\/wp-json\/wp\/v2\/comments?post=21417"}],"version-history":[{"count":3,"href":"https:\/\/hongtronics.com\/en\/wp-json\/wp\/v2\/posts\/21417\/revisions"}],"predecessor-version":[{"id":21428,"href":"https:\/\/hongtronics.com\/en\/wp-json\/wp\/v2\/posts\/21417\/revisions\/21428"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hongtronics.com\/en\/wp-json\/wp\/v2\/media\/21425"}],"wp:attachment":[{"href":"https:\/\/hongtronics.com\/en\/wp-json\/wp\/v2\/media?parent=21417"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hongtronics.com\/en\/wp-json\/wp\/v2\/categories?post=21417"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hongtronics.com\/en\/wp-json\/wp\/v2\/tags?post=21417"},{"taxonomy":"table_tags","embeddable":true,"href":"https:\/\/hongtronics.com\/en\/wp-json\/wp\/v2\/table_tags?post=21417"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}