MadOne Posted August 6, 2024 Report Posted August 6, 2024 Hi everyone. I'm am using small pneumatic cylinders as pushers too push down lightweight plastic products from a conveyor into different downshoots. I have a sensor that is activated and a small simple ST program with 2 timers. One timer is the delaytime from when the sensor is activated before the pusher is activated and the other is how long the pusher should be "out". Everything works okay and i am using the PLC TON 10ms timer for this. But I want to be able to use a 1ms timer instead so the mounting of the mechanical parts does not need to be on the 10th of a milimeter to function properly. Since there is no internal 1ms timer i want to be able to trigger my own timer in an interrupt when the sensor goes high and when that timer reaches the set value in the HMI i want to push the product down the shoot. Hopefully there a simple way to design a timer like that Any suggestions? I uploaded a small video showing my simple testsetup....perfectly mounted sensor i know test_pusher.mp4 Quote
Olly_J Posted August 6, 2024 Report Posted August 6, 2024 I am not sure if this is a good idea but you could try using a Fixed Scan program (which uses a timed interrupt) and you can set the Interval Setting to 1ms: CPU Parameter/Interrupt Settings/Fixed Scan Interval Setting/Interrupt Setting from Internal Timer/I31 (or replace I31 for I30, I29 or I28 depending on which is assigned to your fixed scan program). This way your fixed scan program will trigger every 1ms and you won't need to create a timer. I think that you shouldn't put too much logic in this program or it will bog down your CPU and cause some overlap. You need to make sure your fixed scan program executes well under 1ms and leaves enough of the time slice for your main logic program/s to run. I cannot test this method on a live PLC right now but it works in simulation with an extremely simple program. Hope this helps Quote
MadOne Posted August 11, 2024 Author Report Posted August 11, 2024 Hi Olly_J Thanks for the quick answer. I tested this today. I made a small program that just counts up D5 by 1 every tick but nothing happens. I looks like the fixed scan program never gets executed. I have set the I31 interrupt to 1ms and also enabled it. What in the world am i not doing correct Best regards Markus Quote
MadOne Posted August 11, 2024 Author Report Posted August 11, 2024 Hi, Solved it I forgot to put this line in the init section: EI(TRUE); It's difficult to run a fixed scan program if the interrupt's are not enabled....hahaha I'll test the new SW and will post an update Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.