Author Topic: Mach3, Arduino, Modbus and MPG  (Read 40455 times)

0 Members and 1 Guest are viewing this topic.

Offline poppabear

  • Global Moderator
  • *
  • Posts: 2,231
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: Mach3, Arduino, Modbus and MPG
« Reply #20 on: February 15, 2013, 08:01:25 AM »
so, any word, did you get it working?
Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
http://www.ss-systems-llc.com/

Offline zafarsalam

  • Active Member
  • Posts: 324
    • View Profile
Re: Mach3, Arduino, Modbus and MPG
« Reply #21 on: February 15, 2013, 09:51:09 AM »
so, any word, did you get it working?

Haven't tried it yet. Maybe next week. Another out of town visit is on schedule.

Offline dotn

  • Active Member
  • Posts: 6
    • View Profile
Re: Mach3, Arduino, Modbus and MPG
« Reply #22 on: February 25, 2013, 01:20:14 PM »
Hi guys
I think the problem with arduino mpg is the same as when connected to some BOB, the debouncing, Mach3 has to adjust it but does not properly with the mpg, this requires putting buffer and / or convert step and direction signals (see attached)

Offline PhuocLieu

  • Holding
  • Posts: 1
    • View Profile
Re: Mach3, Arduino, Modbus and MPG
« Reply #23 on: March 16, 2013, 10:47:59 AM »
Zafar

I am a newbie and i am working with your source.

I have a problem. I want to set pin default state is low but I don't know how (Sorry, I'm just beginer with code).
For example, when I connect pin 2 to gnd, the rx is "01 04 02 DF FF" but i need rx is "01 04 02 20 00"
How can I config it ? Please help me!

Phuoc

Offline mrprecise44

  • Active Member
  • Posts: 278
    • View Profile
Re: Mach3, Arduino, Modbus and MPG
« Reply #24 on: March 16, 2013, 04:29:03 PM »
(1) Go to the Arduino website.
(2) Study the examples in the "Learning section."
(3) Learn operation procedure and functions for I/O with an Arduino board.
(4) Write some simple sketches to verify the many kinds of functions in the Arduion IDE.
(5) Test a basic I/O on the ModBus sketch, such as creating an input from a pushbutton, and a brain to cause a Mach3 action, or copy the example posted by Zafar using a potentiometer.


Offline zafarsalam

  • Active Member
  • Posts: 324
    • View Profile
Re: Mach3, Arduino, Modbus and MPG
« Reply #25 on: September 18, 2013, 08:09:57 AM »
Zafar,

   I have a cheezy, Arduino here, and there is a "Timer" style kinda function you can call.
The resolution of that time would need to be in the ms granularity.
In any case, the "Tick Counter" in the arduino would need to at the minimum be MUCH faster,
than the 10hrz update loop.

If it where me, I would then send that Tick Value across the modbus in the standard 16 bit register,
I would then map that register address (in the modbus config in mach), to the "Tick Count" termination object.

Scott


Scott,

I've programmed the TickCount function in Arduino too. I am counting the pulses produced during the last 50 ms, multiply it by 20 to get the pulses per second and then pass it over to Mach through modbus. But still get the same result :(. Almost 1 second's delay between MPG movement and machine axes response. The same thing I got when I was not using the MPG TickCount in Mach brains.

Zafar

Offline mrich0908

  • Active Member
  • Posts: 68
    • View Profile
Re: Mach3, Arduino, Modbus and MPG
« Reply #26 on: September 06, 2014, 11:34:32 PM »
Hello Zafar:

I have not yet connected an MPG through the ModBus, but have all the I/O pins on the Arduino Mega, pin #2 through #53 digital, and all of the Analog inputs tested, working just fine.

mrprecise44,
Care to share your sketch of the Mega ? Im new to the arduino and this would help me out tremendously with my mega.

Offline zafarsalam

  • Active Member
  • Posts: 324
    • View Profile
Re: Mach3, Arduino, Modbus and MPG
« Reply #27 on: September 07, 2014, 08:35:54 AM »
Care to share your sketch of the Mega ? Im new to the arduino and this would help me out tremendously with my mega.

I'll be busy all this week. Maybe this weekend, I'll fish out the arduino code and post it here.

Zafar

Offline SolverGuy

  • Holding
  • Posts: 1
    • View Profile
Re: Mach3, Arduino, Modbus and MPG
« Reply #28 on: January 18, 2017, 05:49:47 PM »
Maybe I solved the problem:
I had a delay of something about 0.5 and 1.5 seconds and tried everything, till i found a "Serial.print("*********");" in my code... After deleting it, everything worked out perfect! I hope I can help someone with that in the future!

Cheers!