Hello Guest it is April 25, 2024, 07:26:44 PM

Author Topic: Arduino - Mach 3 - Gcode M6 T0101  (Read 4617 times)

0 Members and 1 Guest are viewing this topic.

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: Arduino - Mach 3 - Gcode M6 T0101
« Reply #40 on: March 31, 2022, 04:56:39 AM »
0x1E  0x?? 0x0D where ?? is the toolnumber

based on this code for M6Start:

https://www.machsupport.com/forum/index.php?action=dlattach;topic=1658.0;attach=1174

and again that has nothing to do with Modbus Communication you mentoined to use.
« Last Edit: March 31, 2022, 05:03:43 AM by TPS »
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Arduino - Mach 3 - Gcode M6 T0101
« Reply #41 on: March 31, 2022, 05:41:00 AM »
It will still use modbus to communicate to the microcontroller.

What I mean is what would an actual message of this Startsign (Hex 1E) + toolnumber + CR (Hex 0D) look like

I see that The value of HEX 1E in decimal is 30 and in binary is 00011110

Hex 0D = 0D

So would it be: 30 01 0D for tool number 1
30 02 0D - tool number 2
30 03 0D - tool number 3
30 04 0D - tool number 4
etc

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: Arduino - Mach 3 - Gcode M6 T0101
« Reply #42 on: March 31, 2022, 05:45:59 AM »
looks like i am writing Swahili ??

IF YOU WILL USE MODBUS THE DATA WILL BE COMPLETLY DIFFERENT THAN IN MY EXAMPLE
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Arduino - Mach 3 - Gcode M6 T0101
« Reply #43 on: March 31, 2022, 11:54:15 AM »
I know this, but it seems you do not fully understand.

I need to write code in arduino to understand what is send to it.

This macro basically sends

 30 toolnumber 13

but in Hex format. This is what I'm asking, so I figured it out myself.

ToolCommand = &H1E     'Tells microcontroller the job is tool change
JobDone = &HB6         'Micro sends this value when the job is done
CReturn = &H3E         'Value of carriage return in Hexadecimal

This is in the macro and gets appended to be send as a complete message.

I need to know how this macro is send over RS232 (Not rocket science I assume)

which I did figure out without using Swahili.

&H1E this is the same as 0X1E which is Hex format for a Record Seperator
&H0D this is the same as 0X0D ehich is HEX format for Carriage Return

Now I can not just randomly try to Parse this in arduino as it will not work. but what I can do is use both of these as Start and end markers. That is what they were intended for but I can replace them with my own start and end markers

ex. "<" and ">"

That way I can use only the integer value that is returned between my markers. That is exactly how this macro was written when it was made for the microcontroller.

So when everything is done I can use this: JobDone = &HB6         'Micro sends this value when the job is done
but instead of &HB6 I can use my own HEX value to send back to Mach3 and tell it the tool change has been completed.

Visual Basics and C++ are worlds apart therefore for them to communicate takes a different approach

The easy answer would have been for you to say '30 toolnumber 13' in HEX format but it seemed you did not understand this either.

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: Arduino - Mach 3 - Gcode M6 T0101
« Reply #44 on: March 31, 2022, 12:20:55 PM »
OK if you think i did not understand the real problem, it is ok for me. i am out.

good luck anyway
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Arduino - Mach 3 - Gcode M6 T0101
« Reply #45 on: March 31, 2022, 03:30:39 PM »
I have finally managed to solve it. Thank you Zafar and TPS for all the help it is really appreciated.