Hello Guest it is December 10, 2019, 01:30:17 PM

Author Topic: How to get notified to Zero Encoder  (Read 3623 times)

0 Members and 1 Guest are viewing this topic.

How to get notified to Zero Encoder
« on: August 20, 2009, 02:26:03 AM »
We're adding Encoder DRO support in our Plugin and I'm trying to respond when the user pushes the Zero X button next to the Encoder DRO.

I set breakpoints everywhere and can't find anything in the plugin that gets called when this button is pushed.

Anyone know how to handle this?

Thanks
TK
DynoMotion, Inc.

Offline poppabear

*
  • *
  •  2,233 2,233
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: How to get notified to Zero Encoder
« Reply #1 on: August 20, 2009, 12:02:32 PM »
Hey Tom,

     Do I understand you correctly, that your brining in a "feedback" encoder (one for each axis), and when the user pushes the Zero X Encoder (NOT the Zero X axis position, correct?).

also you would need to have passive encoders, (not active ones where your boad keeps the count and is always feeding it to mach, if you have that kind, you would need to send some kind of Zero command to your encoder register of your board.) If you just bringing in a staight encoder to a Breakout board. Then try this:

In your screen Set in each button (I am going to just use the X axis only) the zero x encoder button change its function
in screen designer to "VB script"  and put this in the VB window for that button:
NotifyPlugins(10000)  (10001 = y, 10002 = z etc.)

In your plugin in the:

void  myNotify ( int ID)
{

   if (ID == 10000)
   {
      SynchUpEncoderX = 1;
   }
}

Then in your MyUpdate()  loop

if (SynchUpEncoderX)
{      
   Engine->Axis[0].Index = 0;
   Engine->Encoders[0].Count[0] = 0;
   Engine->Sync = true;
   SynchUpEncoderX = 0;
}

//scott
   
Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
http://www.ss-systems-llc.com/
Re: How to get notified to Zero Encoder
« Reply #2 on: August 20, 2009, 01:40:53 PM »
Thanks Scott,

Yes you understood correctly we have hardware encoder counters on our board that we are using to track position.

BTW we have a new mode that runs Steppers under Mach3 in Closed Loop that works pretty well.

http://dynomotion.com/Help/ClosedLoopStep/ClosedLoopStepper.htm

I thought there would be a way to do it without requiring Users (and me) to edit their screens.  Maybe watch for Mach to clear the count variable?

But if that is the only way then so be it. 

So while I'm bugging you, could you tell me how to edit the VB script of a button that doesn't blink in "Edit Button Script" mode?

Thanks!
TK

Offline poppabear

*
  • *
  •  2,233 2,233
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: How to get notified to Zero Encoder
« Reply #3 on: August 20, 2009, 02:46:09 PM »
hehehehehhe,

   it would be best for you to call me on that one, not easy to explain.........

eight six five - four two six - nine seven two eight

I highly, highly, highly recommend the "Mach screen Designer" the one done by Klaus under mach screens thread.

scott
Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
http://www.ss-systems-llc.com/
Re: How to get notified to Zero Encoder
« Reply #4 on: December 11, 2009, 12:43:55 PM »
If I do not have additional pin to integrate the tool sensor in Mach3. Can I use the same pin (said pin 15) for the emergency stop to integrate the tool sensor. The tool sensor is a contact sensor. The two wire become short when it contact the tool. This is equivalent to push the stop button. If I use this pin to connect the tool sensor, what is the best G code to locate the tool position in the program.

Thanks