Hello Guest it is March 28, 2024, 05:22:02 AM

Author Topic: Lag between Mach3 and ModIO output turning on  (Read 7562 times)

0 Members and 1 Guest are viewing this topic.

Lag between Mach3 and ModIO output turning on
« on: May 16, 2014, 05:43:18 AM »
Hey Everybody, got a problem that may or may not have a fix. Hoping there is one.

We have a CNC-controlled painting machine that turns on and off 50 pumps (different colors of paint) using outputs from Homann Designs' ModIO. We have 7 ModIOs connected together to get this many outputs. We've got the system working by issuing VB commands to turn on/off OEM Leds which are then read by a brain to set the corresponding output in the ModIO. (Buffer times are set for 25ms in the Modbus config page)

Problem: There is a 0.5 second lag (roughly) between the issuing of the macro command to turn on the pump and the moment when the pump actually turns on (or off). Also, it seems the lag is different for different boards (further down the chain the delay seems to be slightly longer).

Does anyone know whether this is an issue that we can fix or do we just have to try to work around this lag using dwell times and design changes?

Thanks!
Sam
Re: Lag between Mach3 and ModIO output turning on
« Reply #1 on: May 16, 2014, 10:50:27 PM »
Hi Sam,

The Brains only 10 times a second so there can be up to 100ms delay there.
For the Modbus side of things, it's running every 25ms. At 57600baud, that's approx 5760 chars max per second.

I'm assuming at you are using the write register command. So to write one 16 bit  register takes 11 bytes. The reply is 8 bytes, or 19 in total.  At 57600 baud thats 4ms per ModIO including the inter message delay.


 For 7 ModIOs that 28ms in total, over the 25ms schedule. I'm also not sure what Mach3 does in terms of whether there are delays between the commands to each ModIO. Since your total transaction time for 7 ModIOs is longer than 25ms. You may be better setting the cycle to 50ms.

Also, increase the baudrate in the ModIOs to 115200 baud. That may keep the transaction time under 25ms.

Cheers,

Peter
----------------------------------------------------
Homann Designs
http://www.homanndesigns.com
email: peter at homanndesigns.com
Re: Lag between Mach3 and ModIO output turning on
« Reply #2 on: May 17, 2014, 01:58:09 AM »
Thank you so much Peter! I will go try that and let you know how it goes!
Re: Lag between Mach3 and ModIO output turning on
« Reply #3 on: May 22, 2014, 08:28:12 AM »
Hi Peter, so we went ahead and changed the delay to 50ms and that seemed to help a bit but there's still a delay of at least half a second. I haven't been able to confirm this to the ms but it's enough to get us out of sink.

I tried to set the baud rate to 115200, but realized I don't know whether I need to reset the boards or do something else. When I change the baud rate to 115200 and click "Apply" all the error lights blink on and off slowly. When I change it back to 57600 they go off and the data send and receive lights come back on blinking. What am I doing wrong?

Thanks!
Sam
Re: Lag between Mach3 and ModIO output turning on
« Reply #4 on: May 22, 2014, 08:47:59 AM »
Hi Sam,

The error light blinking indicates that the is a communication error. Once you change the baud rate on all the modios, you then need to change the baudrate in Mach3 to 115200 as well.

Whenever you change a config item in a ModIO, you need to reset it (or power cycle) for the ModIO to start using the change.

Cheers,

Peter
----------------------------------------------------
Homann Designs
http://www.homanndesigns.com
email: peter at homanndesigns.com
Re: Lag between Mach3 and ModIO output turning on
« Reply #5 on: May 23, 2014, 03:24:39 AM »
Hi Peter,

This is such an elementary question, but I haven't been able to find how to update the baud rate in the ModIOs themselves. We are using the modbus plugin-enabled interface. I can update the baud rate there for Mach3 to communicate, but how do I reset the baud rate inside of the ModIO itself? Do I do it inside of the "Test Modbus" window?

Thanks so much,
Sam
Re: Lag between Mach3 and ModIO output turning on
« Reply #6 on: May 23, 2014, 03:51:55 AM »
Hi Sam,

The baud rate is set in ModIO register 102. Have a look at section 6.2.3 on page 41. Once you change it you will need to reset the ModIO for it to take effect.

Cheers,

Peter
----------------------------------------------------
Homann Designs
http://www.homanndesigns.com
email: peter at homanndesigns.com
Re: Lag between Mach3 and ModIO output turning on
« Reply #7 on: May 23, 2014, 03:55:23 AM »
Thank you so much Peter! I thought I had checked through the manual before I asked this question, but apparently not sufficiently!

Will check it out!

Many thanks,
Sam
Re: Lag between Mach3 and ModIO output turning on
« Reply #8 on: May 27, 2014, 02:20:56 AM »
Hello Peter,

I'm so sorry, can I bother you with a newbie question? What should I set the hex value on 102 to be?

I am reading the manual on 6.2.3 and I see that I need to set bits 5-7 as 101 in order to change the baud rate to 115,200. But I'm not figuring out how to map all 8 bits to a new hexadecimal number which I can use to write to the register.

Thanks,
Sam
Re: Lag between Mach3 and ModIO output turning on
« Reply #9 on: May 27, 2014, 04:47:03 AM »
Hi Sam,

No problems. You want to write BF( hex), or 191 decimal. In Binary it's 10111111

Made up of
101 ----------- 115,200 baud
     11 -------- 8 bits, 1 stop, no parity
         1 ------ Limit Error Flash
           1 ---- Unused
             1  - Check inter message gap


Write the value in then reset the ModIO, then change the baud rate to 115,200 in Mach3.

Cheers,

Peter
----------------------------------------------------
Homann Designs
http://www.homanndesigns.com
email: peter at homanndesigns.com