EMC comp components

Site Search

This page contains the EMC comp components that I have made (or extended) to be used on my CNC lathe.  To use these, copy them to the src/hal/components directory of the EMC source, and build emc.

enc_idx_div.comp - encoder index divider

My lathe spindle is driven by a 1.5kW servo motor with a 3:1 reduction timing belt and pulleys.  Threading requires a single index pulse for every one revolution of the spindle.  In order to use the existing index pulse coming from the servo controller, I built enc_idx_div to act as a divider so I would only receive one index pulse for every 3 revolutions.

The component isn't a simple divider.  It needs to manage the encoder's encoder_index_enable and present a a divided version of it to motmod.

iset.comp - outputs an integer value when an input bit is true

As the description says, this component will output an integer value when the .in pin is true.  I used this on my static LCD displays to force the LCD to change to another display page.  I was using it during a manual tool change, to change to page 'n' which displayed the new tool number that needed to be loaded.

updown_s.comp - enhanced version of the built-in updown component to include a set value

This is just the stock updown component with the inclusion of a set value - ie at any time the count value can be set to set_value.  I use the output of this to select the page of a static LCD display.  Buttons are connected to the count-up (and optionally count-down) to cycle through the LCD pages.  I use the iset component (above) to force setting a page, eg for a manual tool change, or e-stop is pressed, or program runs.

watchdog.comp - a watchdog component.

A watchdog component that is fed a constantly changing signal.  As long as the signal is constantly changing, the watchdog is happy, output=true.  If the signal stops changing for a predetermined amount of time, the output=false, and the watchdog must be reset.  There are two time intervals, timeout and initial-timeout.  The initial-timeout is the time to wait for the first signal change - this is for slow starting systems.  timeout is for once the system is running.  Times are in floating point seconds.  The input signal can be a bit, s32, or u32.  The watchdog watches for any change on any of the inputs: in-bit, in-s32, or in-u32.