Stuctured Text And Input Sensor

dschmiddr

Member
Join Date
Nov 2013
Location
Sacramento
Posts
6
If an input sensor sees an object and the PLC will count it then how can I do this with Structured Text. Since there is no one shot with ST the program I cutrently have will increase the value for each scan while the input is true.
 
if bool and not bool_old then
count := count + 1;
end_if;

bool_old := bool;

But you should be able to call a one-shot-function in ST as well? Might depend on what system you're on..
 
Last edited:
The usual functions are called R_TRIG for Rising Edge Trigger, and F_TRIG for Falling Edge Trigger.
Since AB (and I suspect you are using AB) names anything and everything differently, the functions are called OSRI and OSFI.

Edit: Dirt's example can also be used for falling edge with a "NOT bool AND bool_old" check instead.
 
Last edited:

Similar Topics

I'm using RSLogix 5000 v20. I have created a User Defined Type that I would like to zero out in Structured Text. In Ladder I can use the FLL...
Replies
4
Views
3,160
I´ve being trying wrap head around FOR loops.. When and what can this be used for? I´ve mostly seen it move data, resettting arrays etc. I made a...
Replies
7
Views
135
Hi! When is CASE preffered? CASE uses a numreric variable for the cases and doesnt handle BOOL, but this can be done with numreric and bool using...
Replies
4
Views
128
Hello everyone, Wondering if anybody can help me with this: I have a CompactLogix processor running a little robot cell. Every 200 cycles...
Replies
8
Views
167
Hello, doing switch from FBD to ST. First task is converting my old work. How do you sum variables? For example, Interlock1, interlocl2 and...
Replies
5
Views
200
Back
Top Bottom