Welcome, Guest. Please login or register.
Did you miss your activation email?
May 24, 2012, 07:32:35 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  Brains Development
| | |-+  Brain for encoder to DRO via modbus
Pages: 1   Go Down
Print
Author Topic: Brain for encoder to DRO via modbus  (Read 1508 times)
0 Members and 2 Guests are viewing this topic.
iandmac
Active Member

Offline Offline

Posts: 5


View Profile
« on: June 29, 2009, 11:29:08 PM »

Hi all

I have an encoder on each of my mill axes connected to a cnc4pc M11 modbus board via serial to Mach3.  I am trying to write a brain to display each axis position in a DRO when my machine is under manual control.  This card decodes each encoder and uses three holding registers to store the counts.  I need to grab the values, scale them, then display them in some OEMDRO's.  I've put these DRO's on a separate screen which I can change to for manual control, leaving the standard Mach3 screens essentially unchanged for G-Code control.

My first working attempt for one axis only looked like:

MOD 64 (input) -> formula A * 0.01016  -> OEMDRO 1000

This works well and is very encouraging.  To be of any practical value however I need to be able to re-zero the DRO using an on-screen button.  I can't seem to find a way to capture the input value in the brain as an offset (when the button is pressed) and retrieve it for subtraction from the current value as it is sent to the DRO.  Any ideas for a solution or alternative approach welcome.

Regards, Ian
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 1,707


Briceville, TN, USA


View Profile WWW
« Reply #1 on: July 04, 2009, 03:10:28 PM »

Ian,

    I would suggest using the OEM "Encoder" DROs to start your value, then you can use the button functions that Zero these same encouder DROs, which in turn would zero your User DRO.

further, I would recommend using the Plugin Serial modbus as opposed to the old style modbus, with the plugin you can bring in each of the Modbus types from the M11.  I.e. cfg1 = 1000 outputs, dfc2 = 2000 inputs, 5000 = MPGs/encoders.

scott
Logged

Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
iandmac
Active Member

Offline Offline

Posts: 5


View Profile
« Reply #2 on: July 06, 2009, 08:32:11 PM »

Thanks, I'll give it a go.  Ian
Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!