{"id":15059,"date":"2024-10-06T14:54:15","date_gmt":"2024-10-06T14:54:15","guid":{"rendered":"https:\/\/www.qec.tw\/?p=15059"},"modified":"2024-10-06T14:54:53","modified_gmt":"2024-10-06T14:54:53","slug":"configmachinesoftlimit","status":"publish","type":"post","link":"https:\/\/www.qec.tw\/zh\/ethercat\/api\/dmp\/stepper-dmp\/configmachinesoftlimit\/","title":{"rendered":"EthercatDevice_DmpStepper.configMachineSoftLimit()"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">[EthercatDevice_DmpStepper_Generic]<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Description<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Configure the software limit of the specified machine axis on the EtherCAT slave device in <em>G-code Controller<\/em> mode. These parameters are written to the EEPROM of the EtherCAT slave device and loaded during startup, so users do not need to configure these parameters each time before running the program.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Upon receiving a movement command from the user calling <code>machineGcode()<\/code>, the EtherCAT slave device internally calculates the target position for each axis.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If the target position <em>P<\/em> for an axis is greater than the maximum position value <em>P<sub>max<\/sub><\/em> for that axis, then <em>P<\/em> will be adjusted to <em>P<sub>max<\/sub><\/em>.<\/li>\n\n\n\n<li>If the target position <em>P<\/em> for an axis is less than the minimum position value <em>P<sub>min<\/sub><\/em> for that axis, then <em>P<\/em> will be adjusted to <em>P<sub>min<\/sub><\/em>.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Derived Class:<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes has-small-font-size\"><table class=\"has-fixed-layout\"><tbody><tr><td>Class Name<\/td><td>Vendor ID<\/td><td>Product Code<\/td><\/tr><tr><td>EthercatDevice_QECR11MP3S<\/td><td>0x00000bc3<\/td><td>0x0086d0d6<\/td><\/tr><tr><td>EthercatDevice_QECR00MP3S<\/td><td>0x00000bc3<\/td><td>0x0086d0d9<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Syntax<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code>int configMachineSoftLimit(int machine_axis, double min, double max);<\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Parameters<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>[in] int machine_axis<\/code><br>The specified machine axis number on the EtherCAT slave device:<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-table is-style-stripes has-small-font-size\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Definition<\/strong><\/td><td><strong>Value<\/strong><\/td><td><strong>Description<\/strong><\/td><\/tr><tr><td>ECAT_MACHINE_X_AXIS<\/td><td>0<\/td><td>X-axis, which mapping is determined by the&nbsp;<code>configMachineAxisMapping()<\/code>.<\/td><\/tr><tr><td>ECAT_MACHINE_Y_AXIS<\/td><td>1<\/td><td>Y-axis, which mapping is determined by the&nbsp;<code>configMachineAxisMapping()<\/code>.<\/td><\/tr><tr><td>ECAT_MACHINE_Z_AXIS<\/td><td>2<\/td><td>Z-axis, which mapping is determined by the&nbsp;<code>configMachineAxisMapping()<\/code>.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>[in] double min<\/code><br>The minimum position value <em>P<sub>min<\/sub><\/em> of the software limit to be configured, in millimeters.<\/li>\n\n\n\n<li><code>[in] double max<\/code><br>The maximum position value <em>P<sub>max<\/sub><\/em> of the software limit to be configured, in millimeters.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Return Value<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Return an <a href=\"https:\/\/www.qec.tw\/ethercat\/api\/error-code\/\">error code<\/a>. If the returned value is zero, it indicates a successful execution of this function.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Comment<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This function must be called after a successful execution of <a href=\"https:\/\/www.qec.tw\/ethercat\/api\/master\/ethercatmaster-begin\/\"><code>EthercatMaster::begin()<\/code><\/a>. This function is blocking and cannot be called within the callback functions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example<\/h2>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>#include &quot;Ethercat.h&quot;\n\nEthercatMaster master;\nEthercatDevice_QECR11MP3S slave;\n\nvoid setup() {\n  master.begin();\n  slave.attach(0, master);\n\n  slave.configMachineSoftLimit(ECAT_MACHINE_X_AXIS, 0, 100);\n  slave.configMachineSoftLimit(ECAT_MACHINE_Y_AXIS, 0, 100);\n  slave.configMachineSoftLimit(ECAT_MACHINE_Z_AXIS, 0, 100);\n}\n\nvoid loop() {\n  \/\/ ...\n}<\/pre><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">Please see&nbsp;<a href=\"https:\/\/www.qec.tw\/ethercat\/api\/dmp\/stepper-dmp\/\">EthercatDevice_DmpStepper_Generic Class<\/a>&nbsp;for more QEC Stepper Drivers instructions and API usage.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[EthercatDevice_DmpStepper_Generic] Description Configure the software limit of the specified machine axis on the EtherCAT slave device in G-code Controller mode. These parameters are written to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":15060,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[277],"tags":[162,54,191],"class_list":["post-15059","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-stepper-dmp","tag-86duino","tag-ethercat","tag-qec"],"_links":{"self":[{"href":"https:\/\/www.qec.tw\/zh\/wp-json\/wp\/v2\/posts\/15059","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qec.tw\/zh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qec.tw\/zh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qec.tw\/zh\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qec.tw\/zh\/wp-json\/wp\/v2\/comments?post=15059"}],"version-history":[{"count":0,"href":"https:\/\/www.qec.tw\/zh\/wp-json\/wp\/v2\/posts\/15059\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.qec.tw\/zh\/wp-json\/wp\/v2\/media\/15060"}],"wp:attachment":[{"href":"https:\/\/www.qec.tw\/zh\/wp-json\/wp\/v2\/media?parent=15059"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qec.tw\/zh\/wp-json\/wp\/v2\/categories?post=15059"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qec.tw\/zh\/wp-json\/wp\/v2\/tags?post=15059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}