9
« on: September 18, 2021, 10:39:04 AM »
So far not having luck with the basic problem. I see how to put functions into the script load which works fine and is definitely a better way to organize my programming. However the issue now is that I need to move the motor which tilts a plate that a person is standing on. Then the motor pauses and waits in that position while recording values from analog sensors in the PLC program. When the recording is done, the array is added to an open file. Now repeat a motor move and record again.
So I need to move to 0 degrees, let the PLC record for 5 seconds, save the data array to the open file, move 2 degrees and repeat. What happens is in the script, all the G code moves execute so the plate goes on to 0,2,4,6 degrees without stopping to let the PLC record and at the end of all the moves, the recording starts. No matter what I have tried from G4, while loop, to timer it will not wait. I figured the while loop would be perfect to have the G move the while the global variable startrecording = "on" do nothing then save the values when startrecording = "off" but it just goes through all the programmed G moves.
What am I missing? Seems like a simple issue I am not understanding.
So PLC has the routine to sample the analog sensors 10 times a second for 5 seconds. startrecording is a global variable controlled from a screen button with startrecording="on" and PLC turns it off after 5 seconds controlled by monitoring sweeps. It all works great when I use separate buttons to control each move and record but combining everything into one script in one button is not working.
Thanks