Hello Guest it is February 07, 2023, 01:34:11 PM

Author Topic: Enable momentary spindle reset on reset  (Read 360 times)

0 Members and 1 Guest are viewing this topic.

Offline mark4

  •  167 167
    • View Profile
Enable momentary spindle reset on reset
« on: April 27, 2020, 09:31:48 PM »
Hello a while ago i was trying to get this to work and it still is not quite what i need. First I need to reset the spindle like enable but it needs to wait for a few things to start after pressing enable say 5 seconds then needs to turn on output 1 for say 5 seconds. Then it needs to turn the output off or the spindle will not start.

Last go I received this code for help
if (testcount==50)then
   local outHandle=mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT5)

It works on the testcount of the plc. The output turn on and the timer waits and turns it off. The timer has not functioned for me except after I listened to Das then i got it to work but not quite what i was looking for. I came up with this after much experimentation

if (testcount == 200) then
   local SpinHandle = mc.mcSignalGetHandle (inst, mc.OSIG_OUTPUT1)
--   mc.mcSignalWait (inst,mc.ISIG_INPUT60, 1, 10)
   mc.mcSignalWait (inst,mc.ISIG_INPUT60, 1, 5)

This works except it only runs the one time at startup and after exiting screen editing. I do not know but think the plc continues to run its cycles and does not stop because of a reset so the testcount never restarts from zero from a standard reset. I need it to do this. When reset is pressed wait 5 seconds then turn on the output for 5 seconds then turn it off. As you can see there is another wait in the code. The problem is when I added that it hung everything until it completed. then the things it was waiting for ran and of course the second timer was to early to properly reset. This is so close if somebody has an idea of how i can trigger this code. Right now it is in the plc script.
Thank you