kamenges
Member
A couple of things. In post 31, you show some pseudocode that shows T2 as a TMRAF. Was this a typo or did you recently switch to a TMRF? The reason I ask is if you really were using a TMRAF and then only using the lower word of the accumulated value, as you show in rung 3 in post 31, the lower word will go to zero after 100 seconds. So, for example, if the time between pulses was 100.1 seconds, the package rate would calculate out to 600 packages per minute. This is why I asked what constituted 'really slow' from your original post.
If you are going to use the free-running timer idea do some testing to see how the plc handles subtractions and rollover. For example, if you do something like :
500 - 9950
what do you get? With any luck you will get 550. If you do then you don't need to perform any babysitting of the timer accumulated value as you get a true delta even if the timer rolls over (or is reset in your case). This also means you can get rid of all of the comparisons of TA0 you have. Just check V2020 to make sure it's non-zero and call it even.
Keith
If you are going to use the free-running timer idea do some testing to see how the plc handles subtractions and rollover. For example, if you do something like :
500 - 9950
what do you get? With any luck you will get 550. If you do then you don't need to perform any babysitting of the timer accumulated value as you get a true delta even if the timer rolls over (or is reset in your case). This also means you can get rid of all of the comparisons of TA0 you have. Just check V2020 to make sure it's non-zero and call it even.
Keith