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,118
I tried the click plus PLC to send emails today but could not get it to work over my network. I need a mass alert when a temperature reaches a...
Replies
4
Views
142
can the slc500 5/05 send a email and text over Ethernet ?
Replies
3
Views
153
Good morning. I'm doing a rehab and I need to recycle some part of the old code that won't change and that I need. This is a calculation that...
Replies
22
Views
1,170
I'm writing some structured text that's handling a data structure that comes from a PC. The PC structure is in the "new" LREAL 64-bit floating...
Replies
3
Views
440
Back
Top Bottom