Hello Guest it is April 18, 2024, 09:40:33 PM

Author Topic: 16 atc via modbus  (Read 10927 times)

0 Members and 1 Guest are viewing this topic.

Offline jve

*
  •  128 128
    • View Profile
16 atc via modbus
« on: August 09, 2009, 02:39:04 AM »
hi guys
i just made a setup in a ab plc (micro logics 1100) i conect it with mach3 and i have comunications my problem is that i need to write and reed from mach3 and i dont know wich way is the simpler brains or vb my plc is waiting for 4 bits 80,81,82,83 so when the plc recive the binary code of those bits it means the tool position did any one did this type before so i can see the vb or brains for the m6 and have idea how to make it
regards
jeffrey

Offline jve

*
  •  128 128
    • View Profile
Re: 16 atc via modbus
« Reply #1 on: August 09, 2009, 01:20:04 PM »
any one has some vb or brains that wright and reed to modbus what code i have to do ?

vmax549

*
Re: 16 atc via modbus
« Reply #2 on: August 09, 2009, 01:25:28 PM »
I believe the best approach would be from VB . The exact code will depend on HOW you want it to work. AS I see it you would need to create a table that represents your PLC code so when mach calls for a tool change and presents the Tool# the table wil allow VB to send the correct PLC code across the modbus port.

Just a thought(;-) TP

Offline jve

*
  •  128 128
    • View Profile
Re: 16 atc via modbus
« Reply #3 on: August 09, 2009, 01:46:00 PM »
ok thanks for your reply
i need mach3  first go to a fixed position on the z axis and wright code for tool no as the binary table
reg  83  82  81  80    tool
        0    0    0    0        1
        0    0    0    1        2
        0    0    1    0        3
        0    0    1    1        4
        0    1    0    0        5
        0    1    0    1        6
        0    1    1    0        7
        0    1    1    1        8
        1    0    0    0        9
        1    0    0    1        10
        1    0    1    0        11
        1    1    0    1        12
        1    1    0    0        13
        1    1    0    1        14
        1    1    1    1        15
        1    1    1    1        16
and after the plc wright to mach a bit that the tool change is ready

vmax549

*
Re: 16 atc via modbus
« Reply #4 on: August 09, 2009, 01:57:08 PM »
See IF this post helps you out(;-) If not maybe Scot can help you out.


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

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: 16 atc via modbus
« Reply #5 on: August 09, 2009, 02:48:19 PM »
Look in the memory map of your PLC.  I suspect that your control bits are part of a 16 bit word.

My suggestion would be to make sure that word starts with "control bit 80" (if not find the word range that starts wtih a control bit and use that entire word (all 16 contorl bits).

At any rate, reserve the control word range to your ATC in the PLC.  Then since your only really dealing with the 1st 4 bits of a 16 bit work, you can then just send the decimal equivelant of that tool across the modbus into the Control Bit WORD.  You can then use the control bits as your doing (which equates to "Bit of Word" any way), or, just use the decimal value of the entire word for you compare statements in the PLC.

scott
fun times

Offline jve

*
  •  128 128
    • View Profile
Re: 16 atc via modbus
« Reply #6 on: August 09, 2009, 03:54:19 PM »
do you have any example how to send a bit word from a vb or brain

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: 16 atc via modbus
« Reply #7 on: August 10, 2009, 07:49:33 AM »
again, in my explaination above, you will need to see if your 16 C bits are in a complete word, or make them so (at least the "Small indian" last 4 bits).

You will have to do a combination of a Brian and VB, for instance if you want to send tool #2 to your PLC.

in VB you will send the next tool you want to change to, to the PLC.

i.e.

NewTool = GetSelectedTool()
OldTool = GetCurrentTool()

if OldTool <> NewTool then
SetUserDRO(2000, NewTool)
end if

SystemWaitFor (INPUT4) 'when the PLC is done, it can turn on input4 so the M6 will drop out.

SetOEMDRO(824, NewTool)

'////////////////////////////////////
The above will load the NewTool (next tool wanted), into User DRO 2000.
Then in a Brian, Lets say that your Cfg0 is your output cfg on a serial modbus. That will load the value of DRO 2000
into the First (starting address) of your PLC range for that config.

Brain: (using plugin enabled serial modbus)

DRO 2000 ->NoOp -> Serial P MB, out, cfg0, address 0

So, in your PLC, if you do a data view on the word that contains the 16 control bits (your just using the lower 4).

So in decimal that word would now contain a 2.

in binary it would have a 0000000000000010 at the end.

thus C0 = 0, C1 = 1, C2 = 0, C3 = 0

The example that VMax refered to above, was/is for a much more complex "Hot Swap" code, you dont get any gain in speed with that code unless you have a swap arm.

So, do a Search for ATC in the VB thread, you will find several examples for doing ATC's.

scott



fun times

Offline jve

*
  •  128 128
    • View Profile
Re: 16 atc via modbus
« Reply #8 on: September 19, 2009, 12:57:30 PM »
today i tried the above vb and brain but when i look in the plc it only change the first bid
example if i put t2m6 and go in the plc software i only find on the coils 0000000000000001 and if i put an other tool change no it is always desame do i have to set the plc in the holding regestre instead of the coils

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: 16 atc via modbus
« Reply #9 on: September 27, 2009, 10:42:25 AM »
then you are writing to "coils" in the PLC, you need to write to a "Holding register", or user memory.  Then do a "Bit-of-word" operation on that register to grab the Tool requested, from there you can do compare statements that then activate your sensor for your Binary input patteren your looking for.

scott
fun times