StudentOfPLC

MrPLC Member
  • Content count

    2
  • Joined

  • Last visited

Everything posted by StudentOfPLC

  1. Weird Timer Behaviour

    I have already found the answer. I set the timer.PT value with the use of an INT which I convert to TIME at the beginning of every cycle. This means that PT would still be 0 when the timer would start. This causes Q to true immediately.
  2. Weird Timer Behaviour

    Hello, I've been using a Beckhoff PLC and TwinCAT3 lately and I'm learning how it all works. Currently I'm using a ton timer in my program and I've noticed some weird behaviour. The timer.IN is set to true and afterwards I check for timer.Q in an IF statement. That statement should therefore only be true after the timer.PT delay value. However, the first time after I activate the configuration and timer.IN is set to true, timer.Q is immediately set to true for a very short amount of time. When I reset all values and try again without reactivating the configuration, this doesn't happen. I'm thinking that I don't initialse the timer in the correct way or something along those line. I have attached a code snippet. The problem I'm encountering is that the first time after I have activated the configuration and the tonTimeout.In is true. The following IF statement is also true without having run for the delay time. This sends my program to an error state. However, after resetting the values this doesnt happen anymore. Can anyone help me with this matter?