Hello Guest it is April 27, 2024, 11:54:45 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - TheSuperior

Pages: « 1 2 3 4 »
21
General Mach Discussion / Re: Arduino - Mach 3 - Gcode M6 T0101
« on: March 26, 2022, 02:32:37 AM »
Thank you Zafar, this is really good information and much appreciated!

The delays in my sketch might be a bit of a problem. As I use delays to turn the stepper motors a step each time.

I will try to implement a timer method, I will study this as I have not done it yet I have only used delays and millis before.

What else do I need to add to the sketch? As I'm using an Adruino Mega I can use Pins 18 and 19 which are TX1 and RX1 respectively for the receiving and sending of the signals? But then I'd need to use a RS232 to USB adapter? Or did I perhaps not understand well? So then I do not need the USB 2.0 Cable Type A/B ? Can I attach my code for you to have a look at?

22
General Mach Discussion / Re: Arduino - Mach 3 - Gcode M6 T0101
« on: March 25, 2022, 03:58:33 PM »
I had to uncheck the box "ignore tool change" in the general config and check the box "Auto toolchanger"
Now the macro is working fine along with userDRO of 2001. How will I test the brain I made to see if it is working the way it should?
Now it seems it is just the arduino sketch left to modify? So how do I do this and how do I add my toolchanger code to it? without either one interfering with the other?

23
General Mach Discussion / Re: Arduino - Mach 3 - Gcode M6 T0101
« on: March 25, 2022, 03:44:07 PM »
So this is what I have now:


  'Define some constants
 
    MyDRO = 2001   
   
  'Set MyDRO to GetSelectedTool()

   SetUserDRO(MyDRO, GetSelectedTool())
   
   'SetUserDRO(MyDRO, "2") 'this was just to test if it works correctly when I run the script
   
   'Get current value of MyDRO
   MyDROVal = GetUserDRO(MyDRO)
   
  'Define variables

  Message("Tool Change Started. Tool: " & MyDROVal & " selected")

   'Move The Toolchanger away from the Spindle - I still need to pause then save the old positions and continue machining operation from there
   
   Code "G0 Z200"
   
It compiles fine and it sets my UserDRO to the number I select when testing it through the VB script editor. But If I run G-codes with toolchanges it does not change the userDRO value, neither does it change if I just type M6 T0202 in the command line? What did I do wrong?

24
General Mach Discussion / Re: Arduino - Mach 3 - Gcode M6 T0101
« on: March 25, 2022, 02:29:41 PM »
So this is what I have so far and seems to compile fine:

'Variables

Dim OldTool      As Integer
Dim NewTool      As Integer


'*************************************************************
'                     Main Sub
'*************************************************************


Sub Main()   


   
  'Define variables

  OldTool = GetCurrentTool()
  NewTool = GetSelectedTool()

   
  Message("Tool Change Initiated Old Tool #" & OldTool &" New Tool #" & NewTool)


  'If tools are the same then exit
 
  If NewTool = OldTool Then       
    Message("New Tool and Old Tool are Same - No Action Requested")
    Exit Sub
  End If
 
  SetUserDRO(2001) = GetSelectedTool()

  Message("**********  Tool Change Start ********************")

   'Move The Toolchanger away from the Spindle - I stiill need to save the old positions and continue machining operation from there
   
   Code "G0 Z200"

End Sub
= tool

25
General Mach Discussion / Re: Arduino - Mach 3 - Gcode M6 T0101
« on: March 25, 2022, 01:59:39 PM »
So I have watched a couple of videos. Creating the DRO was fairly easy

In the M6start macro this line: SetUserDRO(2001) = GetSelectedTool()
does not want to compile and i receive a type mismatch error.

I have no idea what to do further in the arduino Sketch?

26
General Mach Discussion / Re: Arduino - Mach 3 - Gcode M6 T0101
« on: March 25, 2022, 11:22:09 AM »
So to clarify just check my images if this is correct?

and then in the sketch:

enum {       
        MB_REG0,
        MB_REG1,
        MB_REG10,
        // line below is for holding registers.    'vinny'
        MB_REGS   = 40    /* total number of registers on slave */
};

I added MB_REG10, ? is that correct?

I'm struggling with the brain where you say modbus output register as the terminal:
enter the modbus adres to use. what number should i enter here?
the CFG# would be number 2 then?
and macro modbus emulation?


27
General Mach Discussion / Re: Arduino - Mach 3 - Gcode M6 T0101
« on: March 25, 2022, 10:29:39 AM »
Also, I am doing this on Mach3 turn and not in mill. This is a 12 tool - tool changer turret I built.

28
General Mach Discussion / Re: Arduino - Mach 3 - Gcode M6 T0101
« on: March 25, 2022, 10:18:46 AM »
Hi Zafar,

Thank you for the quick reply.

The new fields that I add assume needs to be Output holding?

I have never made a userDRO before, I will watch a couple of youtube videos that might enlighten me.

I know how to make a brain based on your tutorial but have no idea what functions to use for this?

the m6start macro I could do. How do I change the arduino sketch to receive the inputs and can this still be done using the USB or do i need a RS232 to USB converter and use serial 1,2 or 3 on the arduino? I am completely lost.

29
General Mach Discussion / Arduino - Mach 3 - Gcode M6 T0101
« on: March 25, 2022, 10:01:41 AM »
Hi there,

I have read the posts I could find on the forums concerning arduino and mach 3 and connecting this using modbus.

http://www.machsupport.com/forum/index.php/topic,22982.0.html

This post from Zafar has been really helpful in connecting arduino as a slave to mach3 and using it with 2 x potentiometers for FRO and Spindle override

I want to do something similar with an Automatic Tool Changer.

the only thing I need is it should send an integer value between 1 to 12 to the arduino every time it encounters the M6 Gcode and based on what tool was selected.

ex. M6 T0101 - should send "1" to the arduino.

I have no idea how to modify the code to do this. Is there anyone who has done this before??

30
Modbus / Re: Simple tutorial on analog inputs with Arduino
« on: March 25, 2022, 02:33:42 AM »
Hi there,

I see this has been posted ages ago.

I want to do something similar with a ATC. It should send an integer value between 1 to 12 to the arduino every time it encounters the M6 Gcode

ex. M6 T0101 - should send "1" to the arduino.

Any idea how to do this?

Pages: « 1 2 3 4 »