Continuing my OAK install on my lathe, I would like to get the pneumatic collet closer functioning. The collet closer is operated by a 5 way air solenoid with two coils (open & close) and I have a simple foot switch that operates a momentary switch.
I've wired the foot switch to input 16 and the two solenoid coils to output 9 (Axis Brake). I've verified the foot switch input works and forcing the output operates the collet closer (solenoid).
I've attempted to edit the PLC by re-naming the spare input 16 to FootSwitch_O and output 9 to ColletClose_O, but I'm a little lost on what the logic should look like to operate the collet closer.
What I would like to do is have the PLC see the foot switch momentary input and toggle the solenoid to either open or close (I'd like the collet closer to change state with each push of the switch...open or close).
What should the logic look like? I would guess it's pretty simple, but I've yet to come across a clear example.
PLC logic - toggle output with momentary input
Moderator: cnckeith
-
- Posts: 27
- Joined: Wed Jul 22, 2020 10:20 am
- Acorn CNC Controller: No
- Allin1DC CNC Controller: No
- Oak CNC controller: Yes
- CNC Control System Serial Number: just ordered
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
Re: PLC logic - toggle output with momentary input
Well, I got it working with the following code:
IF FootSwitch_I THEN (CloseCollet_PD)
IF (CloseCollet_PD && CloseCollet_O) THEN RST CloseCollet_O
If (CloseCollet_PD && !CloseCollet_O) THEN SET CloseCollet_O
I used the one-shot: Aux14PD_PD and re-named it to CloseCollet_PD to get this done. I'm not sure if this is the "proper" way to do this, but it works.
If there is a "proper" or better way, please let me know.
IF FootSwitch_I THEN (CloseCollet_PD)
IF (CloseCollet_PD && CloseCollet_O) THEN RST CloseCollet_O
If (CloseCollet_PD && !CloseCollet_O) THEN SET CloseCollet_O
I used the one-shot: Aux14PD_PD and re-named it to CloseCollet_PD to get this done. I'm not sure if this is the "proper" way to do this, but it works.
If there is a "proper" or better way, please let me know.
Re: PLC logic - toggle output with momentary input
That is basically it.
Your second two lines can be accomplished with one line, using an XOR operator:
It functions the same either way. The XOR is just a little more efficient.
Your second two lines can be accomplished with one line, using an XOR operator:
Code: Select all
IF FootSwitch_I THEN (CloseCollet_PD)
IF (CloseCollet_PD ^ CloseCollet_O) THEN (CloseCollet_O)