How do I use variables in ladder logic

bishoposiris

Member
Join Date
Feb 2017
Location
Cary
Posts
15
Say I have tag.0 and I want to increment it on a certain trigger. I'm sure there would be some syntax such as tag.var where var would increment from 0 to 1 to 2 and so forth but I don't know how to do this.

A second request is what if I want var to change randomly instead of sequentially between 1 and 20?
 
As I type this I don't know what you are programming in. If you are using ladder logic, this should get you close.

Example.jpg
Example_zpslxcarw5e.jpg.html
Example_zpslxcarw5e.jpg.html
 
"Randomness" is tricky in a PLC, as they are intended to be deterministic. The simplest I've seen is to read the system clock. I've also seen things mocked up where you smash a bunch of trig functions together and see what comes out.

Regardless, you usually use the smallest digits out of the result, not the whole thing.
 

Similar Topics

FOr what is the used of the variables in ladder logic diagrams?
Replies
2
Views
2,210
Hi, we are using Rx3i CRU320 redundant PLC system and we noticed a discrepancy between Primary and Secondary controller. Couple of variables (DI)...
Replies
8
Views
268
Hi everyone, I was wondering how we declare Persistent Variables in Studio 5000 (main reason to keep the values during power cycle and program...
Replies
5
Views
241
Hello everyone, how can I see in machine edition (in 1 overview) which variables are not in use? When I create a new variable it continues with...
Replies
2
Views
558
Hello, programming an AB Micro850 for the first time, using the developer edition of CCW and trying to figure out how to best structure...
Replies
5
Views
602
Back
Top Bottom