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,140
I'm working with a project that contains some routines in ST but mostly in ladder. Am I correct in assuming this 'rung': DB1001DO._01AV55_OPEN :=...
Replies
4
Views
84
I have an expression in a structured text routine of a Logix controller that looks more or less like the following: ResultInteger := Integer1 *...
Replies
13
Views
359
Hey all, i have a panelview screen (image attached), with 4 items on it. Program 1, Program 2, ...3, ...4. The PLC i am using is a compactlogix...
Replies
5
Views
148
Good evening. I display the step number of a SFC on a display. Sometimes, on a trip, it goes quickly through many steps and I need to prove to...
Replies
1
Views
105
Back
Top Bottom