{"id":1762,"date":"2017-02-22T13:12:29","date_gmt":"2017-02-22T13:12:29","guid":{"rendered":"https:\/\/novanta.com\/robotics-automation\/converting-mdrive-mcode-liberty-mcode\/"},"modified":"2017-02-22T13:12:29","modified_gmt":"2017-02-22T13:12:29","slug":"converting-mdrive-mcode-liberty-mcode","status":"publish","type":"page","link":"https:\/\/novanta.com\/robotics-automation\/converting-mdrive-mcode-liberty-mcode\/","title":{"rendered":"Converting MDrive MCode to Liberty MCode"},"content":{"rendered":"\n\n\n<div class=\"wp-block-group alignwide is-layout-flow wp-block-group-is-layout-flow\" style=\"margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40)\">\n\t<p>When upgrading a system component from MDrive to Liberty* MDrive the key difference in programming is in how the I\/O points are configured and used.. In the MDrive the non-isolated I\/O points may be programmed as inputs or outputs.\r\n\r\nIn the Liberty* MDrive, the I\/O points are fixed as inputs and outputs. In MDrive programs, the sink\/source state of the I\/O point is set in the user program. In the Liberty* MDrive the sink\/source state is set by the bias of the Reference input.\r\n\r\nThe other key difference is the Analog Input. In the MDrive, the input is 10-bit, with a range of 0 to 1024. The Liberty* MDrive has a 12-bit analog input with a range of 0 to 4096. Programs not using I\/O can generally be loaded onto the device and work without modification. The sample program we will convert uses an input to trigger a routine that will slew the axis a multiple of the analog input and one output set up as a moving output. The program is labeled as SU, so that it will execute on power up or reset.\r\n<\/p>\n\n<h3 class=\"wp-block-heading\">Program Code (MDrive MCode)<\/h3>\n\n\r\nBelow is the MDrive MCode program. The bold highlighted lines of code will need to be changed in order to port the program over to a Liberty* Motion product.\r\n\n<pre class=\"wp-block-code\"><code><pre class=\"toolbar:1 lang:default mark:5,6,7,15 decode:true \" title=\"MDrive MCode\">PG 100   'Enter program mode\r\n         'Main program and setup\r\nLB SU\r\n  A=1000000  'Set Acceleration\r\n  S1=0,1     'I\/O1 as user input\r\n  S2=17,1     'I\/O2 as moving out\r\n  S5=9        'Analog as 0 to 5 VDC\r\n              'Wait for input loop\r\nLB Wa\r\n  BR M1,I1=1  'Conditional branch\r\n  SL 0        'Stop\/no motion\r\n  BR Wa,I1=0  'Loop if input inactive\r\n              'Motion on input\r\nLB M1\r\n  SL=I5*100   'Slew rate: Analog X 100\r\n  BR Wa       'Jump to wait loop\r\n              'End and exit program mode\r\nE\r\nPG\r\nS             'keep this line<\/pre><\/code><\/pre>\n\n\r\n\r\n\r\nThe first point we will change is I\/O #1\r\n\n<h3 class=\"wp-block-heading\">Modify the Input<\/h3>\n\n\r\n\n<figure class=\"wp-block-table\"><table>\r\n<tbody>\r\n<tr>\r\n<td><strong>MDrivePlus<\/strong><\/td>\r\n<td><strong>Liberty* MDrive<\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>S1=0,1<\/td>\r\n<td>Is=1,0<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table><\/figure>\n\n\r\nThe S1\u2014S4 command has been changed to Is for input setup and Os for output setup In the example, I\/O #1 is set as a general purpose input with a sinking interface. To modify the command to function with the Liberty* MDrive, The Is (Input setup) command is used by entering Is=,. Is=1,0 then sets input 1 as a gen- eral purpose input. The available input functions are listed below:\r\n\n<figure class=\"wp-block-table\"><table>\r\n<tbody>\r\n<tr>\r\n<td><strong>Input Function Table<\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0<\/td>\r\n<td>General purpose input<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>1<\/td>\r\n<td>Homing function, will function as specified by the homing command (HM).<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>2<\/td>\r\n<td>Limit  , will function as specified by the limit command (LM).<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>3<\/td>\r\n<td>Limit \u2014, will function as specified by the limit command (LM).<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>4<\/td>\r\n<td>G0 input, will run program at address 1 upon activation.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>5<\/td>\r\n<td>Soft stop, stops motion with deceleration and halts program execution. If program is paused (PS), input is ignored.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>6<\/td>\r\n<td>Pause, pause\/resume program with motion<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>7<\/td>\r\n<td>Jog  , Will Jog motor in the positive direction at Max. Velocity (VM). The Jog Enable (JE) Flag must be set for this to function.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>8<\/td>\r\n<td>Jog \u2014, Will Jog motor in the negative direction at max. velocity (VM). The jog enable (JE) flag must be set for this to function.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>11<\/td>\r\n<td>Reset, When set as RESET input, then the action is equivalent to a ^C entered into a terminal. Note: If setting the input to sourcing, active true, ground the input first or a reset will occur.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>12<\/td>\r\n<td>Capture input will operate with the Trip Capture (TC) trip to run a subroutine when active NOTE: THIS FUNCTION APPLIES TO INPUT 1 ONLY!<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table><\/figure>\n\n\r\n\n<h3 class=\"wp-block-heading\">Modify the Output<\/h3>\n\n\r\nIn this program, an output is setup to be active during a move. To change this to function with a Liberty* MDrive we will use the Os (output setup) command.\r\n\n<figure class=\"wp-block-table\"><table>\r\n<tbody>\r\n<tr>\r\n<td><strong>MDrivePlus<\/strong><\/td>\r\n<td><strong>Liberty* MDrive<\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>S2=17,1<\/td>\r\n<td>Os=1,17<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table><\/figure>\n\n\r\nAs with the input, the Os command replaces the S2 command in the form of Os=,, in this case Os=1,17 The available output functions are listed on the next page.\r\n\n<figure class=\"wp-block-table\"><table>\r\n<tbody>\r\n<tr>\r\n<td><strong>Output Function Table<\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>16<\/td>\r\n<td>USER: General purpose user output.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>17<\/td>\r\n<td>MOVING: output will be active while the axis is in motion.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>18<\/td>\r\n<td>ERROR: will be active when a software error occurs.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>19<\/td>\r\n<td>STALL: Indicates a stall has been detected <strong><em><\/em><\/strong>.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>20<\/td>\r\n<td>VCHANGE: velocity changing indicates the axis is accelerating or decelerating.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>21<\/td>\r\n<td>LOCKED ROTOR: indicates the rotor is in a locked state <strong><em>.<\/em><\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>23<\/td>\r\n<td>MOVINGPOS: indicates the axis is moving to a specified position.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>24<\/td>\r\n<td>HMT ACTIVE: indicates when HMT is active <strong><em>.<\/em><\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>25<\/td>\r\n<td>MAKE UP ACTIVE: indicates when HMT is making up steps <strong><em>.<\/em><\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>28<\/td>\r\n<td>TRIP OUT, applies to output 3 only, active low only. Os=3,28,0<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>29<\/td>\r\n<td>ATTENTION: indicates a status or statuses as configured by the AO variable.<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table><\/figure>\n\n\r\n\n<h3 class=\"wp-block-heading\">Modify the Analog Input<\/h3>\n\n\r\nTo setup the Analog input we will return to the Is (input setup) command.\r\n\n<figure class=\"wp-block-table\"><table>\r\n<tbody>\r\n<tr>\r\n<td><strong>MDrivePlus<\/strong><\/td>\r\n<td><strong>Liberty* MDrive<\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>S5=9,0<\/td>\r\n<td>Is=5,9,0<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table><\/figure>\n\n\r\nTo set the analog input to voltage mode, 0 to  5VDC level the Is command is used as IS=5, , or Is=5,9,0 The parameters for the IS=5 command are listed below.\r\n\n<figure class=\"wp-block-table\"><table>\r\n<tbody>\r\n<tr>\r\n<td><strong>Analog input mode table<\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>9<\/td>\r\n<td>Voltage mode<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>10<\/td>\r\n<td>Current mode<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>Analog level table<\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0<\/td>\r\n<td>0 to  5V (voltage mode), 0 to 20 mA (current mode)<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>1<\/td>\r\n<td>0 to 10V (voltage mode), 4 to 20 mA (current mode)<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table><\/figure>\n\n\r\n\r\n\n<h4 class=\"wp-block-heading\">Modify the Analog Input scaling<\/h4>\n\n\r\nThe analog input on the Liberty* MDrive is 12-bit instead of ten, to set the program to have the same scale factor we need to divide the scale by 4\r\n\n<figure class=\"wp-block-table\"><table>\r\n<tbody>\r\n<tr>\r\n<td><strong>MDrivePlus<\/strong><\/td>\r\n<td><strong>Liberty* MDrive<\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>SL=I5*100<\/td>\r\n<td>SL=I5*25<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table><\/figure>\n\n\r\n\r\nThis will give us the same slew rate as with the MDrivePlus.\r\n\r\n\r\n*Previously Lexium\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>When upgrading a system component from MDrive to Liberty* MDrive the key difference in programming is in how the I\/O points are configured and used.. In the MDrive the non-isolated I\/O points may be programmed as inputs or outputs. In the Liberty* MDrive, the I\/O points are fixed as inputs and outputs. In MDrive programs, [&hellip;]<\/p>\n","protected":false},"author":102,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-1762","page","type-page","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.0 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Converting MDrive MCode to Liberty MCode - Robotics &amp; Automation<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/novanta.com\/robotics-automation\/converting-mdrive-mcode-liberty-mcode\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Converting MDrive MCode to Liberty MCode\" \/>\n<meta property=\"og:description\" content=\"When upgrading a system component from MDrive to Liberty* MDrive the key difference in programming is in how the I\/O points are configured and used.. In the MDrive the non-isolated I\/O points may be programmed as inputs or outputs. In the Liberty* MDrive, the I\/O points are fixed as inputs and outputs. In MDrive programs, [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/novanta.com\/robotics-automation\/converting-mdrive-mcode-liberty-mcode\/\" \/>\n<meta property=\"og:site_name\" content=\"Robotics &amp; Automation\" \/>\n<meta property=\"og:image\" content=\"https:\/\/novanta.com\/robotics-automation\/wp-content\/uploads\/sites\/3\/2026\/03\/Featured-Banner-Block-2-1.png?resize=1200,675\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"675\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/novanta.com\\\/robotics-automation\\\/converting-mdrive-mcode-liberty-mcode\\\/\",\"url\":\"https:\\\/\\\/novanta.com\\\/robotics-automation\\\/converting-mdrive-mcode-liberty-mcode\\\/\",\"name\":\"Converting MDrive MCode to Liberty MCode - Robotics &amp; Automation\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/novanta.com\\\/robotics-automation\\\/#website\"},\"datePublished\":\"2017-02-22T13:12:29+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/novanta.com\\\/robotics-automation\\\/converting-mdrive-mcode-liberty-mcode\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/novanta.com\\\/robotics-automation\\\/converting-mdrive-mcode-liberty-mcode\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/novanta.com\\\/robotics-automation\\\/converting-mdrive-mcode-liberty-mcode\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/novanta.com\\\/robotics-automation\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Converting MDrive MCode to Liberty MCode\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/novanta.com\\\/robotics-automation\\\/#website\",\"url\":\"https:\\\/\\\/novanta.com\\\/robotics-automation\\\/\",\"name\":\"Robotics & Automation\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/novanta.com\\\/robotics-automation\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Converting MDrive MCode to Liberty MCode - Robotics &amp; Automation","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/novanta.com\/robotics-automation\/converting-mdrive-mcode-liberty-mcode\/","og_locale":"en_US","og_type":"article","og_title":"Converting MDrive MCode to Liberty MCode","og_description":"When upgrading a system component from MDrive to Liberty* MDrive the key difference in programming is in how the I\/O points are configured and used.. In the MDrive the non-isolated I\/O points may be programmed as inputs or outputs. In the Liberty* MDrive, the I\/O points are fixed as inputs and outputs. In MDrive programs, [&hellip;]","og_url":"https:\/\/novanta.com\/robotics-automation\/converting-mdrive-mcode-liberty-mcode\/","og_site_name":"Robotics &amp; Automation","og_image":[{"width":1200,"height":675,"url":"https:\/\/novanta.com\/robotics-automation\/wp-content\/uploads\/sites\/3\/2026\/03\/Featured-Banner-Block-2-1.png?resize=1200,675","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/novanta.com\/robotics-automation\/converting-mdrive-mcode-liberty-mcode\/","url":"https:\/\/novanta.com\/robotics-automation\/converting-mdrive-mcode-liberty-mcode\/","name":"Converting MDrive MCode to Liberty MCode - Robotics &amp; Automation","isPartOf":{"@id":"https:\/\/novanta.com\/robotics-automation\/#website"},"datePublished":"2017-02-22T13:12:29+00:00","breadcrumb":{"@id":"https:\/\/novanta.com\/robotics-automation\/converting-mdrive-mcode-liberty-mcode\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/novanta.com\/robotics-automation\/converting-mdrive-mcode-liberty-mcode\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/novanta.com\/robotics-automation\/converting-mdrive-mcode-liberty-mcode\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/novanta.com\/robotics-automation\/"},{"@type":"ListItem","position":2,"name":"Converting MDrive MCode to Liberty MCode"}]},{"@type":"WebSite","@id":"https:\/\/novanta.com\/robotics-automation\/#website","url":"https:\/\/novanta.com\/robotics-automation\/","name":"Robotics & Automation","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/novanta.com\/robotics-automation\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/novanta.com\/robotics-automation\/wp-json\/wp\/v2\/pages\/1762","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/novanta.com\/robotics-automation\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/novanta.com\/robotics-automation\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/novanta.com\/robotics-automation\/wp-json\/wp\/v2\/users\/102"}],"replies":[{"embeddable":true,"href":"https:\/\/novanta.com\/robotics-automation\/wp-json\/wp\/v2\/comments?post=1762"}],"version-history":[{"count":0,"href":"https:\/\/novanta.com\/robotics-automation\/wp-json\/wp\/v2\/pages\/1762\/revisions"}],"wp:attachment":[{"href":"https:\/\/novanta.com\/robotics-automation\/wp-json\/wp\/v2\/media?parent=1762"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}