Implementing externa I-O

All things related to Centroid Oak, Allin1DC, MPU11 and Legacy products

Moderator: cnckeith

Post Reply
jshorter
Posts: 2
Joined: Tue Jul 14, 2015 3:04 pm
Allin1DC CNC Controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: Yes
CPU10 or CPU7: No

Implementing externa I-O

Post by jshorter »

I need to add external cycle start buttons to my GPIO4d plc running on CNC11 but can find no documentation on implementing additional inputs. The inputs change state according to the alt-I screen. I have added
LeftCycle IS INP15
RightCycle IS INP16
To the plc source code and that part compiles fine, but I don't know where to turn it into a command to actually start a cycle such as is in the Jog Panel Stage's, IF (CycleStartKey || KbCycleStart_M) THEN (DoCycleStart) command.
This application is for a custom machine that needs to have anti tie down switches.
cncsnw
Posts: 3763
Joined: Wed Mar 24, 2010 5:48 pm

Re: Implementing externa I-O

Post by cncsnw »

In short, whatever logic leads to asserting DoCycleStart is what will initiate a cycle on your machine.

Suppose, for example, that you just want to require that the operator press both start buttons any time they want to cause a cycle start (and, therefore, that you are not going to allow use of the cycle start button on the jog panel, nor the Alt-S keyboard equivalent).

In that case you would replace the standard line in the PLC program with one that reads:

Code: Select all

IF (LeftCycle && RightCycle) THEN (DoCycleStart)
However, that does not deliver the level of safety promised by two separate hand switches, because if one of the switches is defeated, then the operator can start a cycle simply by pressing the remaining switch. Ensuring that both switches have been open in between activations will require additional logic, with a memory flag indicating that starting will be allowed and recognized, and another flag indicating that the buttons have been seen and accepted. E.g.:

Code: Select all

HandStartsAllowed_M  IS MEM88
HandStartsPressed_M  IS MEM89

; If both switches are open, then "arm" system to allow next start
IF !LeftCycle && !RightCycle THEN SET HandStartsAllowed_M
; If system "armed" and both switches closed, then do start
IF LeftCycle && RightCycle && HandStartsAllowed_M THEN SET HandStartsPressed_M
IF HandStartsPressed_M THEN (DoCycleStart)
; If both have been pressed, and now one or both are released, then disarm
IF HandStartsPressed_M && !(LeftCycle && RightCycle) THEN RST HandStartsAllowed_M
; Then (after disarming while "pressed" flag was still set) turn off "pressed" flag
IF !(LeftCycle && RightCycle) THEN RST HandStartsPressed_M
I haven't tested this code, but it should work.

Now suppose that you don't want to require the operator to press both buttons for every "start" action on the control (e.g. homing after powerup, running an MDI command, etc.), but you do want to require both hands at certain points in program cycles. You could define a custom M function, which could be included in a program cycle any time you want to wait for the two hand switches. That M function, rather than waiting for a cycle start action, could wait for the "HandStartsPressed_M" memory bit as used above (and the above code would omit the DoCycleStart action).

In the file "mfunc70.mac" you would have:

Code: Select all

; M70 - wait for both hand switches
M100/70089 ; wait for switches not pressed
M101/70089 ; wait for switches pressed
and, because it is good practice to let the operator know what is going on, you would add to the file "cncxmsg.txt" the lines:

Code: Select all

MEM89
"Waiting for left and right hand switches..."
Clearly, the variations are endless, depending on your needs. Hope this helps.
jshorter
Posts: 2
Joined: Tue Jul 14, 2015 3:04 pm
Allin1DC CNC Controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: Yes
CPU10 or CPU7: No

Re: Implementing externa I-O

Post by jshorter »

Thanks Marc, that is just what the doctor ordered. problem solved!
Jerry :mrgreen:
Post Reply