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,148
Hello, I am using studio 5000 pro and am trying to figure out the structured text. Here's my scenario: An operator scans a barcode, the barcode...
Replies
15
Views
248
Hi everyone, I hope you're all doing well. I'm currently working on updating an HMI project for the GP2500, and I've encountered a bit of a...
Replies
1
Views
102
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
114
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
390
Back
Top Bottom