Beta support for OMRON MX2 VFD.
authorJoseph Coffland <joseph@cauldrondevelopment.com>
Sat, 25 Jan 2020 21:43:58 +0000 (13:43 -0800)
committerJoseph Coffland <joseph@cauldrondevelopment.com>
Sat, 25 Jan 2020 21:43:58 +0000 (13:43 -0800)
CHANGELOG.md
package.json
src/avr/src/modbus.c
src/avr/src/spindle.h
src/avr/src/vfd_spindle.c
src/pug/templates/tool-view.pug
src/resources/config-template.json

index 59708e6dd18f25158e8645c73247db3d9321f5ee..2b18574bd161005b3fa93f744a493aeb485e4dfb 100644 (file)
@@ -1,6 +1,9 @@
 Buildbotics CNC Controller Firmware Changelog
 =============================================
 
+## v0.4.13
+ - Beta support for OMRON MX2 VFD.
+
 ## v0.4.12
  - Segments straddle arc in linearization.
  - Control max-arc-error with GCode var.
index 2d06ce87ec40ae76f9662c6ddbb733721462f93f..2c79e85cfea358e62c9f46fbe82159ab28f3d074 100644 (file)
@@ -1,6 +1,6 @@
 {
   "name": "bbctrl",
-  "version": "0.4.12",
+  "version": "0.4.13",
   "homepage": "http://buildbotics.com/",
   "repository": "https://github.com/buildbotics/bbctrl-firmware",
   "license": "GPL-3.0+",
index ef1d792d6548b829fb1a9f598d257db7d13f2b79..2e63c1eb7a374b874a76b20b9aaf00d651ed3ea6 100644 (file)
@@ -120,8 +120,8 @@ static void _set_rxc_interrupt(bool enable) {
 
 
 static void _write_word(uint8_t *dst, uint16_t value, bool little_endian) {
-  dst[!little_endian]  = value;
-  dst[little_endian] = value >> 8;
+  dst[!little_endian] = value;
+  dst[little_endian]  = value >> 8;
 }
 
 
index 556a512610e8ef801a12a14cd861716b9e3a5e50..61f17bb08e3395ec2e71d0e96f0218284df183e2 100644 (file)
@@ -56,6 +56,7 @@ typedef enum {
   SPINDLE_TYPE_YL600,
   SPINDLE_TYPE_FR_D700,
   SPINDLE_TYPE_SUNFAR_E300,
+  SPINDLE_TYPE_OMRON_MX2,
 } spindle_type_t;
 
 
index 40cdf4aeca3215a496ee0df678e507906f33f552..d7234bbcb3fd602c60b92d68faf6918832d879ce 100644 (file)
@@ -154,6 +154,20 @@ const vfd_reg_t sunfar_e300_regs[] PROGMEM = {
 };
 
 
+const vfd_reg_t omron_mx2_regs[] PROGMEM = {
+  {REG_CONNECT_WRITE, 0x1201,   3}, // A001 Frequency reference modbus
+  {REG_CONNECT_WRITE, 0x1202,   3}, // A002 Run command modbus
+  {REG_MAX_FREQ_READ, 0x1204,   0}, // A004 Max frequency
+  {REG_FREQ_SET,      0x0001,   0}, // F001 Frequency
+  {REG_STOP_WRITE,    0x1e01,   0}, // Stop drive
+  {REG_FWD_WRITE,     0x1e01,   2}, // Forward
+  {REG_REV_WRITE,     0x1e01,   6}, // Reverse
+  {REG_FREQ_READ,     0x1001,   0}, // D001 Output freq
+  {REG_STATUS_READ,   0x0005,   0}, // Status A
+  {REG_DISABLED},
+};
+
+
 static vfd_reg_t regs[VFDREG];
 static vfd_reg_t custom_regs[VFDREG];
 
@@ -371,6 +385,7 @@ void vfd_spindle_init() {
   case SPINDLE_TYPE_YL600:            _load(yl600_regs);              break;
   case SPINDLE_TYPE_FR_D700:          _load(fr_d700_regs);            break;
   case SPINDLE_TYPE_SUNFAR_E300:      _load(sunfar_e300_regs);        break;
+  case SPINDLE_TYPE_OMRON_MX2:        _load(omron_mx2_regs);          break;
   default: break;
   }
 
index 7440094f16b80a0eb2f714e21647440b6a522f3a..a3ef3a11edd7dbb8eec4deade2f343fe734ecbfe 100644 (file)
@@ -109,7 +109,7 @@ script#tool-view-template(type="text/x-template")
 
       .notes(v-if="tool_type == 'HUANYANG VFD'")
         h2 Notes
-        p Set the following using the VFD's frontpanel.
+        p Set the following using the VFD's front panel.
         table.modbus-regs.fixed-regs
           tr
             th Address
@@ -157,7 +157,7 @@ script#tool-view-template(type="text/x-template")
 
       .notes(v-if="tool_type.startsWith('NOWFOREVER VFD')")
         h2 Notes
-        p Set the following using the VFD's frontpanel.
+        p Set the following using the VFD's front panel.
         table.modbus-regs.fixed-regs
           tr
             th Address
@@ -197,7 +197,7 @@ script#tool-view-template(type="text/x-template")
 
       .notes(v-if="tool_type.startsWith('DELTA VFD015M21A')")
         h2 Notes
-        p Set the following using the VFD's frontpanel.
+        p Set the following using the VFD's front panel.
         table.modbus-regs.fixed-regs
           tr
             th Address
@@ -245,7 +245,7 @@ script#tool-view-template(type="text/x-template")
 
       .notes(v-if="tool_type.startsWith('YL600')")
         h2 Notes
-        p Set the following using the VFD's frontpanel.
+        p Set the following using the VFD's front panel.
         table.modbus-regs.fixed-regs
           tr
             th Address
@@ -293,7 +293,7 @@ script#tool-view-template(type="text/x-template")
 
       .notes(v-if="tool_type.startsWith('SUNFAR')")
         h2 Notes
-        p Set the following using the VFD's frontpanel.
+        p Set the following using the VFD's front panel.
         table.modbus-regs.fixed-regs
           tr
             th Address
@@ -333,3 +333,72 @@ script#tool-view-template(type="text/x-template")
             target="_blank") Sunfar E300 VFD manual
           |
           | and spindle type.
+
+      .notes(v-if="tool_type.startsWith('OMRON')")
+        h2 Notes
+        p Set the following using the VFD's front panel.
+        table.modbus-regs.fixed-regs
+          tr
+            th Address
+            th Value
+            th Meaning
+            th Description
+          tr
+            td.reg-addr C071
+            td.reg-value 5
+            td 9600 BAUD
+            td Must match #[tt baud] above
+          tr
+            td.reg-addr C072
+            td.reg-value 1
+            td Bus ID 1
+            td Must match #[tt bus-id] above
+          tr
+            td.reg-addr C074
+            td.reg-value 0
+            td No parity
+            td Must match #[tt parity] above
+          tr
+            td.reg-addr C075
+            td.reg-value 2
+            td 2 stop bits
+            td Serial stop bits
+          tr
+            td.reg-addr C076
+            td.reg-value 4
+            td Deceleration stop
+            td Communication error action
+          tr
+            td.reg-addr C077
+            td.reg-value 500
+            td 0.5 seconds
+            td Communication error timeout
+          tr
+            td.reg-addr C077
+            td.reg-value 1
+            td 1 milisecond
+            td Communication wait time
+          tr
+            td.reg-addr C096
+            td.reg-value 0
+            td Modbus-RTU
+            td Communication mode
+          tr
+            td.reg-addr P200
+            td.reg-value 0
+            td Standard
+            td Modbus mapping
+          tr
+            td.reg-addr P400
+            td.reg-value 0
+            td Big endian
+            td Communication byte order
+
+        p
+          | Other settings according to the
+          |
+          a(href="https://buildbotics.com/upload/vfd/omron_i570_mx2.pdf",
+            target="_blank") OMRON MX2 VFD manual
+          |
+          | and spindle type.  The VFD must be rebooted after changing
+          | the above settings.
index e16bfb8dd438d96768c0673d62446367b681733f..9e4d808b3131b388c9daa7aa987bcd378ca13f04 100644 (file)
       "values": ["Disabled", "PWM Spindle", "Huanyang VFD", "Custom Modbus VFD",
                  "AC-Tech VFD", "Nowforever VFD", "Delta VFD015M21A (Beta)",
                  "YL600, YL620, YL620-A VFD (Beta)", "FR-D700 (Beta)",
-                 "Sunfar E300 (Beta)"],
+                 "Sunfar E300 (Beta)", "OMRON MX2 (Beta)"],
       "default": "Disabled",
       "code": "st"
     },