Sideway Posted January 11, 2022 Report Share Posted January 11, 2022 Hi everyone, I found something weird about timers lately... We already discussed about timers in another topic i wrote a couple of months ago, but this time, the behaviour is a bit different so i decided to write a new one. Let TE2 and TE 33 be two timers in my program : TE2 is called after a couple of seconds, and TE33 is called all the time. As you can see, TE2 is working properly, but TE33 always remains OFF. Why is that ? Greetings, Sideway. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Flex727 Posted January 11, 2022 MVP 2022 Report Share Posted January 11, 2022 Be aware that with a preset time of 50ms, it may be too fast to see when online with the PLC. Use TE 33 to INC an MI and you should be able to see it working. Or you could just increase the Preset to several seconds. Quote Link to comment Share on other sites More sharing options...
Sideway Posted January 11, 2022 Author Report Share Posted January 11, 2022 Hi Flex, I have often been manipulating timers for CAN communication and they are all in milliseconds *10 (we need our devices to answer fast ). And usually, if my timers are working, i can see them blinking (switching on and off) within Visilogic. I checked for my timer TE33 here, and it does not turn ON, even with a MI increment next to it. Cheers, Sideway. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Ausman Posted January 11, 2022 MVP 2022 Report Share Posted January 11, 2022 Sideway, I replicated your layout into a running 130. The displayed states show various on/offs but they depend on the cycle time of the timer, in line with what Flex has said. I can monitor both TEs and they are indeed counting down correctly, using the online Timer observation. However, there does seem to be a display difference in using SB1 for one of the instances. If I substitute an MB for SB1, then I can see intermittent state changes on both rungs in Visilogic. If I use SB1 then this doesn't seem to happen as often, if at all. But they are still both doing what they are meant to. (Which I puzzle over anyway given what you have said, I think you'll have issues depending on project complexity and scan times.) All of this was on a direct ethernet link within my LAN, so something involving WAN would likely do different results as well. If you are not getting your TE33 to change state at all, then something else is affecting it. Perhaps the PLC fairies inside the unit are confused over something, and you need an Init and Reset. Also....you did download it again after some mods...didn't you? I've done this simple error before and it is very puzzling why something isn't working......Finish that minor change, compile, go to download it and the phone rings, distracting discussion, go back to monitor the program I've thought I've downloaded but haven't, scratch head pondering why it isn't working properly! Eventually mutter rude words about what an idiot I am and do the download and it all works as expected. cheers, Aus Quote Link to comment Share on other sites More sharing options...
MVP 2022 Flex727 Posted January 11, 2022 MVP 2022 Report Share Posted January 11, 2022 40 minutes ago, Ausman said: Also....you did download it again after some mods...didn't you? I've done this simple error before and it is very puzzling why something isn't working......Finish that minor change, compile, go to download it and the phone rings, distracting discussion, go back to monitor the program I've thought I've downloaded but haven't, scratch head pondering why it isn't working properly! Eventually mutter rude words about what an idiot I am and do the download and it all works as expected. I've done this many times over the years. Makes you want to pound your head on the desk. Quote Link to comment Share on other sites More sharing options...
Sideway Posted January 11, 2022 Author Report Share Posted January 11, 2022 Hi ! I have read your answers carefully, and will retry tomorrow morning so that i can give you a feedback As you said, maybe I forgot powering up again the machine after downloading... which may sound stupid buuuuuut it may not be the first time for me However, i am SURE about this : the two timers TE2 and TE33 were never used anywhere else. I just called them for the demo ! (So, no double direct coil, reset coil forgotten or anything of the sort...) And the lungs are in the Main Routine, just to be sure i call the routine properly Quote so something involving WAN would likely do different results as well. Oh and Ausman... what is WAN ? Never heard about this Cheers, Sideway. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Ausman Posted January 12, 2022 MVP 2022 Report Share Posted January 12, 2022 https://en.wikipedia.org/wiki/Wide_area_network Quote Link to comment Share on other sites More sharing options...
Sideway Posted January 12, 2022 Author Report Share Posted January 12, 2022 Hi, I have tested again my program this morning and here is what resulted from my tests : 1) After downloading the program properly, and switching on/off my machine, i found that my TE33 timer was working, since my MI was incrementing, as shown below : As you said, TE33 is not showing that it's powered up within Visilogic (neither in the ladder section, nor in the timer array) 2) I have tried again without SB1, and the result was exactly the same. 3) I have tried with a slower timer value for TE33, and the result was quite interesting : As you can see, i set up MI to equal 0 on power-up. The MI variable attached to TE33 is incrementing a lot faster than TE2, eventhough my TE33 is slower. And yes, i downloaded the program (download + reset), then restarted my machine just to be sure. Any idea on what's going on here ? Cheers, Sideway. Quote Link to comment Share on other sites More sharing options...
Gabriel Franco Posted January 12, 2022 Report Share Posted January 12, 2022 I would INC MIs in another net using positive transition of timers. Quote Link to comment Share on other sites More sharing options...
MVP 2022 kratmel Posted January 12, 2022 MVP 2022 Report Share Posted January 12, 2022 11 hours ago, Sideway said: Any idea on what's going on here ? I think you net with TE timer (Extended Pulse) is not correct. If yo use it - your net count PLC cycles. If you use TD timer in the same net - you find correct result in incremented MI. Quote Link to comment Share on other sites More sharing options...
Sideway Posted January 12, 2022 Author Report Share Posted January 12, 2022 Oh ! Ok i think i got it : Since i dont use any rising edge when my coil goes ON, my TE33 stays on for more than one scan ? That's why my MI is counting down scan cycles, is that correct ? Cheers Quote Link to comment Share on other sites More sharing options...
MVP 2022 Flex727 Posted January 12, 2022 MVP 2022 Report Share Posted January 12, 2022 If you want it on for only one scan, use "TD" timer instead of "TE". Quote Link to comment Share on other sites More sharing options...
MVP 2022 kratmel Posted January 12, 2022 MVP 2022 Report Share Posted January 12, 2022 1 hour ago, Sideway said: That's why my MI is counting down scan cycles, is that correct ? Please read about timing diagram for TE Timer in Help. I do not know why you use TE timer activated by PDO clock XB17 in self reset mode. You need to generate some pause, wait for something? Quote Link to comment Share on other sites More sharing options...
MVP 2022 Ausman Posted January 13, 2022 MVP 2022 Report Share Posted January 13, 2022 Sideway, FYI do you know about clicking a timer when online? If you do a single left click in the timer description area in the ladder, up comes a box that shows what the timer is doing. And I repeat: On 1/12/2022 at 9:05 AM, Ausman said: Which I puzzle over anyway given what you have said, I think you'll have issues depending on project complexity and scan times. The reason for this comment is that it is very easy to get unregistered overlap issues arising when things happen close to scan times. An example is why there are HS inputs as against normal ones. If you have an input that is turning on and off fairly fast, then the interval between the identical signal peaks needs to be carefully measured. If it is close to the maximum scan time of your program then a normal input won't handle it properly, but an appropriate HS will. Sometimes a not super-fast switching input can be handled by normal inputs, but you need to carefully calculate things to ensure it will be handled correctly. I always allow a safety factor of at least 2. If you draw yourself a little on/off diagram using an XY graph, with the time being the X factor line, and also incorporate scan times into the X line, you'll understand things easier and realise the potential issues. Unless you specifically cater for such things (some programming tricks might help) it can turn into a minefield. I'd actually be doing what you want with a counter that increments and resets simply based on scan time ie every scan (or multiples thereof) the increment happens and once it reaches a limit it triggers an action, resets to 0 and starts again. cheers, Aus Quote Link to comment Share on other sites More sharing options...
MVP 2022 Ausman Posted January 13, 2022 MVP 2022 Report Share Posted January 13, 2022 22 hours ago, Sideway said: (download + reset), During another look at this, I noticed this you did not do an Init and Reset, you did a reset, which likely accounts for the odd numbers. Be aware that with an MI on such a quick increment it will overflow quite quickly. Did you manually set both MIs to 0 before running the program? Reset Click to reset the PLC, and reinstall any values preset in the program, such as Timers. Reset & Initialize Click to reset, reinstall any preset values, and initialize all memory operands Above copied from help. cheers, Aus Quote Link to comment Share on other sites More sharing options...
Sideway Posted January 14, 2022 Author Report Share Posted January 14, 2022 On 1/13/2022 at 12:49 AM, kratmel said: I do not know why you use TE timer activated by PDO clock XB17 in self reset mode. kratmel, XB17 is a bit which sets ON when my CANopen configuration has terminated successfully ==> Once i configured my PDOs properly, i turn on XB17 to initiate a PDO Clock every 20 ms (which is later called to send RPDOs to my motor drives as shown below) EDIT : Discard XB1 direct coil, it is useless, just forgot to delete that one On 1/13/2022 at 1:24 AM, Ausman said: Sideway, FYI do you know about clicking a timer when online? Ausman, i forgot that feature was actually available I was used to checking for the timer running within the timer variable list. On 1/13/2022 at 1:24 AM, Ausman said: I'd actually be doing what you want with a counter that increments and resets simply based on scan time ie every scan (or multiples thereof) the increment happens and once it reaches a limit it triggers an action, resets to 0 and starts again. I take good note of this one Thank you for your kind replies ! I have read the Timer help more in depth than i used to, and i understand it a bit better now Cheers, Sideway. Quote Link to comment Share on other sites More sharing options...
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.