Hello Guest it is April 24, 2024, 11:34:52 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Cartierusm

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 »
111
I appreciate the help, but as I said I'm no programmer. I understand what you mean and can program my PLC for the most part, but I'm not understanding the code.

How does Mach know what signal to send to my PLC with the identity of the tool that needs changing? Is that the register you're talking about?


112
Chaoticone, I don't completely get what you mean, but it did make me realize that on my Click Input X106 is only triggered after a successful tool change.

So I can loose some code. I also added for tool change position.

--Mori Seiki SL-1 ATC
function m6()

local inst = mc.mcGetInstance()
local Requested = mc.mcToolGetSelected(inst)
local Current = mc.mcToolGetCurrent(inst)

if requested == 1 then
     local ToolOutput = mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT01) –Y101
mc.mcCntlGcodeExecuteWait (inst, “G90 G53 G00 X0.25 Z0.25”)
end

if requested == 2 then
     local ToolOutput = mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT02) –Y102
mc.mcCntlGcodeExecuteWait (inst, “G90 G53 G00 X0.25 Z0.25”)
end

if requested == 3 then
     local ToolOutput = mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT03) –Y103
mc.mcCntlGcodeExecuteWait (inst, “G90 G53 G00 X0.25 Z0.25”)
end

if requested == 4 then
     local ToolOutput = mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT04) –Y104
mc.mcCntlGcodeExecuteWait (inst, “G90 G53 G00 X0.25 Z0.25”)
end

if requested == 5 then
     local ToolOutput = mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT05) –Y105
mc.mcCntlGcodeExecuteWait (inst, “G90 G53 G00 X0.25 Z0.25”)
end

if requested == 6 then
     local ToolOutput = mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT06) –Y106
mc.mcCntlGcodeExecuteWait (inst, “G90 G53 G00 X0.25 Z0.25”)
end

if requested == 7 then
     local ToolOutput = mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT07) –Y107
mc.mcCntlGcodeExecuteWait (inst, “G90 G53 G00 X0.25 Z0.25”)
end

if requested == 8 then
     local ToolOutput = mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT08) –Y108
mc.mcCntlGcodeExecuteWait (inst, “G90 G53 G00 X0.25 Z0.25”)
end

   if Requested == Current then
       mc.mcCntlSetLastError(inst, "Current tool == Requested tool so there is nothing to do")
   else

         --Tell the Click to change to requested tool.
         local Y101 = mc.mcRegGetHandle(inst,"Clcik PLC/Requested Tool")
         mc.mcRegSetValue(Y101,Requested)
end

         --Tell the Click to change to requested tool.
         local Y102 = mc.mcRegGetHandle(inst,"Clcik PLC/Requested Tool")
         mc.mcRegSetValue(Y102,Requested)
end

         --Tell the Click to change to requested tool.
         local Y103 = mc.mcRegGetHandle(inst,"Clcik PLC/Requested Tool")
         mc.mcRegSetValue(Y103,Requested)
end

         --Tell the Click to change to requested tool.
         local Y104 = mc.mcRegGetHandle(inst,"Clcik PLC/Requested Tool")
         mc.mcRegSetValue(Y104,Requested)
end

         --Tell the Click to change to requested tool.
         local Y105 = mc.mcRegGetHandle(inst,"Clcik PLC/Requested Tool")
         mc.mcRegSetValue(Y105,Requested)
end

         --Tell the Click to change to requested tool.
         local Y106 = mc.mcRegGetHandle(inst,"Clcik PLC/Requested Tool")
         mc.mcRegSetValue(Y106,Requested)
end

         --Tell the Click to change to requested tool.
         local Y107 = mc.mcRegGetHandle(inst,"Clcik PLC/Requested Tool")
         mc.mcRegSetValue(Y107,Requested)
end

         --Tell the Click to change to requested tool.
         local Y108 = mc.mcRegGetHandle(inst,"Clcik PLC/Requested Tool")
         mc.mcRegSetValue(Y108,Requested)
end

         --Send signal to the Click to start the tool change.
         mc.mcSignalSetState(ToolChange,1) –Y101
         wx.wxMilliSleep(1000)
         mc.mcSignalSetState(ToolChange,0) –Y101
end

         --Send signal to the Click to start the tool change.
         mc.mcSignalSetState(ToolChange,1) –Y102
         wx.wxMilliSleep(1000)
         mc.mcSignalSetState(ToolChange,0) –Y102
end

         --Send signal to the Click to start the tool change.
         mc.mcSignalSetState(ToolChange,1) –Y103
         wx.wxMilliSleep(1000)
         mc.mcSignalSetState(ToolChange,0) –Y103
end

         --Send signal to the Click to start the tool change.
         mc.mcSignalSetState(ToolChange,1) –Y104
         wx.wxMilliSleep(1000)
         mc.mcSignalSetState(ToolChange,0) –Y104
end

         --Send signal to the Click to start the tool change.
         mc.mcSignalSetState(ToolChange,1) –Y105
         wx.wxMilliSleep(1000)
         mc.mcSignalSetState(ToolChange,0) –Y105
end

         --Send signal to the Click to start the tool change.
         mc.mcSignalSetState(ToolChange,1) –Y106
         wx.wxMilliSleep(1000)
         mc.mcSignalSetState(ToolChange,0) –Y106
end

         --Send signal to the Click to start the tool change.
         mc.mcSignalSetState(ToolChange,1) –Y107
         wx.wxMilliSleep(1000)
         mc.mcSignalSetState(ToolChange,0) –Y107
end

         --Send signal to the Click to start the tool change.
         mc.mcSignalSetState(ToolChange,1) –Y108
         wx.wxMilliSleep(1000)
         mc.mcSignalSetState(ToolChange,0) –Y108
end

         
         --Wait for the signal from the CLick.         
         mc.mcCntlSetLastError(inst, "Wait for Click to complete tool change.")

 rc = mc.mcSignalWait(inst, mc.ISIG_INPUT06, mc.WAIT_MODE_HIGH, 20) --X106
end

         --Error check.  If the Click took too long.  Alarm out Mach4.
         if (rc~= 0) then
             wx.wxMessageBox("The Click did not complete the tool change in time.  Check for malfunction.")
             local Alarm = mc.mcSignalGetHandle(inst,mc.OSIG_ALARM)
             mc.mcSignalSetState(Alarm,1)
             CycleStop()
         else
             mc.mcCntlSetLastError(inst, "Current tool == " .. tostring(Requested))
             mc.mcToolSetCurrent(inst, Requested)
             mc.mcCntlSetLastError(inst, "Tool Change Complete.")
         end

    end--Request == Current

end --m6

if (mc.mcInEditor() == 1) then
 m6()
end

113
Ok this doesn't seem totally correct to me. What do you think?

I'm using the limit switches on my Tool Changer to verify that the tool change has completed correctly, those inputs run X101-X106.

I basically took your tool change program and changed it to match what I think is correct.

--Mori Seiki SL-1 ATC
function m6()

local inst = mc.mcGetInstance()
local Requested = mc.mcToolGetSelected(inst)
local Current = mc.mcToolGetCurrent(inst)

if requested == 1 then
     local ToolOutput = mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT01) –Y101
end

if requested == 2 then
     local ToolOutput = mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT02) –Y102
end

if requested == 3 then
     local ToolOutput = mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT03) –Y103
end

if requested == 4 then
     local ToolOutput = mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT04) –Y104
end

if requested == 5 then
     local ToolOutput = mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT05) –Y105
end

if requested == 6 then
     local ToolOutput = mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT06) –Y106
end

if requested == 7 then
     local ToolOutput = mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT07) –Y107
end

if requested == 8 then
     local ToolOutput = mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT08) –Y108
end

   if Requested == Current then
       mc.mcCntlSetLastError(inst, "Current tool == Requested tool so there is nothing to do")
   else

         --Tell the Click to change to requested tool.
         local Y101 = mc.mcRegGetHandle(inst,"Clcik PLC/Requested Tool")
         mc.mcRegSetValue(Y101,Requested)
end

         --Tell the Click to change to requested tool.
         local Y102 = mc.mcRegGetHandle(inst,"Clcik PLC/Requested Tool")
         mc.mcRegSetValue(Y102,Requested)
end

         --Tell the Click to change to requested tool.
         local Y103 = mc.mcRegGetHandle(inst,"Clcik PLC/Requested Tool")
         mc.mcRegSetValue(Y103,Requested)
end

         --Tell the Click to change to requested tool.
         local Y104 = mc.mcRegGetHandle(inst,"Clcik PLC/Requested Tool")
         mc.mcRegSetValue(Y104,Requested)
end

         --Tell the Click to change to requested tool.
         local Y105 = mc.mcRegGetHandle(inst,"Clcik PLC/Requested Tool")
         mc.mcRegSetValue(Y105,Requested)
end

         --Tell the Click to change to requested tool.
         local Y106 = mc.mcRegGetHandle(inst,"Clcik PLC/Requested Tool")
         mc.mcRegSetValue(Y106,Requested)
end

         --Tell the Click to change to requested tool.
         local Y107 = mc.mcRegGetHandle(inst,"Clcik PLC/Requested Tool")
         mc.mcRegSetValue(Y107,Requested)
end

         --Tell the Click to change to requested tool.
         local Y108 = mc.mcRegGetHandle(inst,"Clcik PLC/Requested Tool")
         mc.mcRegSetValue(Y108,Requested)
end

         --Send signal to the Click to start the tool change.
         mc.mcSignalSetState(ToolChange,1) –Y101
         wx.wxMilliSleep(1000)
         mc.mcSignalSetState(ToolChange,0) –Y101
end

         --Send signal to the Click to start the tool change.
         mc.mcSignalSetState(ToolChange,1) –Y102
         wx.wxMilliSleep(1000)
         mc.mcSignalSetState(ToolChange,0) –Y102
end

         --Send signal to the Click to start the tool change.
         mc.mcSignalSetState(ToolChange,1) –Y103
         wx.wxMilliSleep(1000)
         mc.mcSignalSetState(ToolChange,0) –Y103
end

         --Send signal to the Click to start the tool change.
         mc.mcSignalSetState(ToolChange,1) –Y104
         wx.wxMilliSleep(1000)
         mc.mcSignalSetState(ToolChange,0) –Y104
end

         --Send signal to the Click to start the tool change.
         mc.mcSignalSetState(ToolChange,1) –Y105
         wx.wxMilliSleep(1000)
         mc.mcSignalSetState(ToolChange,0) –Y105
end

         --Send signal to the Click to start the tool change.
         mc.mcSignalSetState(ToolChange,1) –Y106
         wx.wxMilliSleep(1000)
         mc.mcSignalSetState(ToolChange,0) –Y106
end

         --Send signal to the Click to start the tool change.
         mc.mcSignalSetState(ToolChange,1) –Y107
         wx.wxMilliSleep(1000)
         mc.mcSignalSetState(ToolChange,0) –Y107
end

         --Send signal to the Click to start the tool change.
         mc.mcSignalSetState(ToolChange,1) –Y108
         wx.wxMilliSleep(1000)
         mc.mcSignalSetState(ToolChange,0) –Y108
end

         
         --Wait for the signal from the CLick.         
         mc.mcCntlSetLastError(inst, "Wait for Click to complete tool change.")

If requested == 1 then
 rc = mc.mcSignalWait(inst, mc.ISIG_INPUT03, mc.ISIG_INPUT04, mc.ISIG_INPUT05, mc.ISIG_INPUT06, mc.WAIT_MODE_HIGH, 20) --X103, X104, X105, X106
end

If requested == 2 then
 rc = mc.mcSignalWait(inst, mc.ISIG_INPUT01, mc.ISIG_INPUT04, mc.ISIG_INPUT05, mc.ISIG_INPUT06, mc.WAIT_MODE_HIGH, 20) --X101, X104, X105, X106
end

If requested == 3 then
 rc = mc.mcSignalWait(inst, mc.ISIG_INPUT01, mc.ISIG_INPUT02, mc.ISIG_INPUT05, mc.ISIG_INPUT06, mc.WAIT_MODE_HIGH, 20) --X101, X102, X105, X106
end

If requested == 4 then
 rc = mc.mcSignalWait(inst, mc.ISIG_INPUT01, mc.ISIG_INPUT03, mc.ISIG_INPUT05, mc.ISIG_INPUT06, mc.WAIT_MODE_HIGH, 20) --X101, X103, X105, X106
end

If requested == 5 then
 rc = mc.mcSignalWait(inst, mc.ISIG_INPUT02, mc.ISIG_INPUT04, mc.ISIG_INPUT05, mc.ISIG_INPUT06, mc.WAIT_MODE_HIGH, 20) --X102, X104, X105, X106
end

If requested == 6 then
 rc = mc.mcSignalWait(inst, mc.ISIG_INPUT01, mc.ISIG_INPUT03, mc.ISIG_INPUT04, mc.ISIG_INPUT06, mc.WAIT_MODE_HIGH, 20) --X101, X103, X104, X106
end

If requested == 7 then
 rc = mc.mcSignalWait(inst, mc.ISIG_INPUT01, mc.ISIG_INPUT02, mc.ISIG_INPUT04, mc.ISIG_INPUT06, mc.WAIT_MODE_HIGH, 20) --X101, X102, X104, X106
end

If requested == 8 then
 rc = mc.mcSignalWait(inst, mc.ISIG_INPUT02, mc.ISIG_INPUT03, mc.ISIG_INPUT05, mc.ISIG_INPUT06, mc.WAIT_MODE_HIGH, 20) --X102, X103, X105, X106
end

         --Error check.  If the Click took too long.  Alarm out Mach4.
         if (rc~= 0) then
             wx.wxMessageBox("The Click did not complete the tool change in time.  Check for malfunction.")
             local Alarm = mc.mcSignalGetHandle(inst,mc.OSIG_ALARM)
             mc.mcSignalSetState(Alarm,1)
             CycleStop()
         else
             mc.mcCntlSetLastError(inst, "Current tool == " .. tostring(Requested))
             mc.mcToolSetCurrent(inst, Requested)
             mc.mcCntlSetLastError(inst, "Tool Change Complete.")
         end

    end--Request == Current

end --m6

if (mc.mcInEditor() == 1) then
 m6()
end


114
Ok now we're cooking with gas!

So is this the whole script or do I have to repeat this code 8 times for each of my tool positions, because I don't see where the different tool change positions are referenced?

I assume that the M6 program would have an instance for each of my tools and the corresponding inputs to verify the tool change was made. I'm using Y101 = T0101, Y102=T0202, Y103=T0303, Y104=T0404, Y105=T0505, Y106=T0606, Y107=T0707, Y108=T0808.

115
Thanks a bunch. I'll give this a look and see if I can figure it out.

I'm no programmer, but I love the Click. I was able to program it pretty easy for all sorts of projects. And yes it's not expensive at all.

116
Ok great. Now I need to figure out how to program! I have very little idea of how to program M6. I guess it wouldn't be that difficult, right? If I find an example of a tool change sequence I can just repeat that for the other tools but change the inputs and outputs.

Do you mind posting the script you for the tool change or maybe an example of how to write it? If that's not too much trouble. I'll do my own research later today.

117
Right now I use a physical button going to click to make tool changes, i.e. X001-X008. That in turn triggers a C# as you mentioned that resets once the tool change is made. I just added in parallel to the X001 a Y101 for Mach to control. This way I can control the tool change manually or with Mach. Manually would only be when switching out tools.

I figure in the M6 I would tell Mach: For T0101 Output Y101 for 500ms, For T0202 Output Y102 for 500ms, etc... Then Mach would need to have specific X### inputs to verify the tool change has been made.

Can you answer what I asked previously, when setting up Modbus do I need all those functions as in your picture or just the read and write as you mention? Thanks.

118
Ok I think I'm getting it, maybe, possibly, ok maybe not. Just kidding. I'm starting to comprehend. Thanks for the help.

I don't need any other functions under Modbus in Mach, in your picture originally you have a whole bunch of functions, i.e. Carousel Pos, Write Request Carousel, Click CPU out, etc.., but you're saying I only need Read Input Discretes and Write Coil?




119
Was thinking about this some more. I could use some more clarification. I'll break it down into two parts; setting up Mach for Modbus and the M6 Script. I take it that's all I need to do is those two things? I"ll worry about the tool change script last. I want to focus on the Modbus first.

First off if I'm using X001 as an input into my Click to trigger my tool change program and Mach Modbus directly works with Click as in your Example (i.e. Register 97) then do I have to use the DS#s? I figure when a tool change is called out in the Lua Script for tool changes Mach will send a signal to Click for X001 (register 97), which will run my Click tool change program. Then when Click receives an input for X006, click will send out an output signal to Mach (X006 is a proximity switch when tool changer is locked). Mach reads that input and knows the tool change was completed successfully and continues on with the rest of the tool change.

So first question, when Click receives a physical input, let's say X001, does Mach read that as an Input or Output?

So if all that makes sense then I don't need any outputs from Click because in my click program the inputs trigger the outputs. All Mach needs to do is send a signal to Click for that specific tool change and then wait for X006 input in Click.

So what Functions do I ned in Modbus in Mach Inputs and ?

120
Cbyrdtopper, thanks again for sending me all you did. I'm ready to revisit this issue. I've read through what you posted many times and now have a better handle on what I'm doing. I still have questions, but will play around with it first.

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 »