Timer Help Codsesy SFC or Structed Text

link
2020-06-21
2020-07-07
  • link

    link - 2020-06-21

    Hi,

    I am quite new to Codsesy and am after some help on trying to come a basic problem. Long story short I'm saying to implement a timer to start timing when sensor 1 is triggered and stop timing when sensor 2 goes high, then calculate the average speed.

    The problem wants it to be completed in SFC but if you know how to complete it in ST or ladder I would be interested to learn.

    Any advice would be great.

    Thanks

     
  • snguyen

    snguyen - 2020-07-07

    Hi, can't write the code for you, but here's how to do it.

    Create a bool that is going to be turned on by the first sensor and off by the second. Create a timer (TON) and tie the input to the bool variable. When the timer stops, the variable "ET" (elapsed time) will give you the time between the on and off of the timer. You can then correlate the distance and time together.

     

Log in to post a comment.