Jump to content

Recommended Posts

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.

1786868425_timerfails.png.5c890f157d05bcf0684b12abf3eb5ac2.png

 

As you can see, TE2 is working properly, but TE33 always remains OFF. Why is that ? 

 

Greetings,

Sideway.

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • MVP 2021

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

Link to comment
Share on other sites

  • MVP 2021
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.

Link to comment
Share on other sites

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 :D

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 :o

Cheers,

Sideway.

Link to comment
Share on other sites

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

 

2133102861_timerfails2.png.b5262a56f135ebef67596fe5b565ae5a.png

 

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 : 

 

92581401_timerfails4.png.7d7110fcbfee5a25ba715ed19ae137c3.png

 

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 ? :D

 

Cheers, 

Sideway.

 

 

Link to comment
Share on other sites

  • MVP 2021
11 hours ago, Sideway said:

Any idea on what's going on here ? :D

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.

Link to comment
Share on other sites

  • MVP 2021
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?

Link to comment
Share on other sites

  • MVP 2021

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

Link to comment
Share on other sites

  • MVP 2021
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

 

Link to comment
Share on other sites

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.

image.png.2e6de82947de00bcfe9bc11da62e5ce2.png

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 oneimage.png.a02270e11977b5baa7dbfd51d7dc99ac.png

 

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 :D 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. 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...