Hello Guest it is April 25, 2024, 08:47:11 PM

Author Topic: Serial ModBus Send Analog Value to PLC w/ Brains  (Read 10541 times)

0 Members and 1 Guest are viewing this topic.

Serial ModBus Send Analog Value to PLC w/ Brains
« on: September 16, 2012, 12:14:13 PM »
I built a stamping machine, running Mach3 with Auto-Direct DL06.  Stamp pressure is controlled by a 4-20mA signal from the DL06 and changes with every stamp tool.  I would like to send an analog value from Mach3 to the PLC when a tool change axis is in a particular position.  In that way when the tool change axis comes to rest, a regulator will automatically set the desired pressure.

I am using Serial Modbus, not plug-in enabled.  The machine is four axis, everything is working, several Brains are running successfully with exception to the pressure regulator control.  I wrote a Brain that uses axis position and feed-rate to get Mach3 output pin/register 64 (analog) set to a value and sent out to the PLC.  All I can seem to do with this Brain is get pin 64 mapped into the PLC as 0001 or 0000.  I cannot successfully get a full integer sent out to the PLC.

I tried using a Brain with a terminator "Modbus", using output pin 64.  There is an entry for Bit 0-15, but it seems to be a single bit only.  Another Brain terminator called "SendString" would seem like the perfect avenue.  I input "111111111111" in the box, use Register Address 64 and check 0-128 serial, but it does not work for me.  When I check my PLC, where it was changing from 0000 to 0001 using the Modbus terminator, now it just stays at 0000.  I could just send bits to the PLC and have the PLC fill the analog register, but would like to derive this from Mach3.  Also have not looked into Macros.  Any help would be greatly appreciated!

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Serial ModBus Send Analog Value to PLC w/ Brains
« Reply #1 on: September 16, 2012, 01:51:32 PM »
Here is a screenshot of the Brain I did for FRO and SRO which should help. Been a while since I did it, maybe 3 years so cant really remember all the setup but looks like 125 and 126 is what I look at.
Hood

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Serial ModBus Send Analog Value to PLC w/ Brains
« Reply #2 on: September 16, 2012, 01:57:08 PM »
Heres a screenshot of the ladder just in case that helps.
Hood

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Serial ModBus Send Analog Value to PLC w/ Brains
« Reply #3 on: September 16, 2012, 02:13:10 PM »
Oh just noticed you are trying to send out rather than in so not sure if the above will hold any clues at all, I have only ever used analogue ins and never outs :(
Hood
Re: Serial ModBus Send Analog Value to PLC w/ Brains
« Reply #4 on: September 16, 2012, 03:10:32 PM »
Thanks!  Anything to get me thinking.  I haven't investigated Macro Pumps and I was under the impression that Brains were the preferred method or replacement.  Only wrote my first Brains this weekend, so not to experienced.  I might just flip bits in the PLC and use ladder code to generate the analog values.

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Serial ModBus Send Analog Value to PLC w/ Brains
« Reply #5 on: September 16, 2012, 06:05:42 PM »
Not sure if this will help or is what you are looking for  but just tried it and it seems to work, see vid here
http://youtu.be/fxZb7_-RiNU

I just made a Brain to look at the Spindle Override DRO and then passed it through a formula (formula I used is a*10) and then put it out through a modbus output. Dont have a PLC here to see if the PLC reads it ok but the Brain side seems to be fine.
Oh the Modbus was set up as per screenshot.
Hood
« Last Edit: September 16, 2012, 06:07:58 PM by Hood »
Re: Serial ModBus Send Analog Value to PLC w/ Brains
« Reply #6 on: September 16, 2012, 07:02:13 PM »
Wow, that works!  What I did was set my Brain to get position as desired AND feed-rate equal to zero.  Then I added a formula after that being = A * (Desired Value in Decimal) and then terminated with "ModBus" terminator, set to Output, Register 64 and checked Serial non-plug in.  

When my tool axis comes to the right location and stops, the full integer gets placed in the PLC register as desired and I get my 4-20mA signal out of the PLC.

Thank you!!! I was already starting to punt and write a mountain of ladder logic to do all this in the PLC.   :D

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Serial ModBus Send Analog Value to PLC w/ Brains
« Reply #7 on: September 16, 2012, 10:09:27 PM »
 :)

Brett
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Serial ModBus Send Analog Value to PLC w/ Brains
« Reply #8 on: September 17, 2012, 02:45:14 AM »
Glad you got it working and you never know it may come in useful for me in the future  :)
Hood