Increment a data file element

riouxhugo

Member
Join Date
Sep 2009
Location
Mtl
Posts
18
Hello,

Is there a simple way to increment a data file element using a SLC5/05.

The idea is to store, at each increment, the result of a computation like the following in N97:0:

i = 0

CPT
Dest N97:0
Expression 1 / (N97:i / 3600)

i = i + 1

Thanks for your suggestions.

Regards,

H
 
I believe you are looking for indirect addressing. Something like this?

'i = N10:0

<insert your conditions here> CLR N10:0

CPT
Dest N97:0
Expression (1|(N97:[N10:0]|3600))

ADD
Source A 1
Source B N10:0
Dest N10:0

I don't suggest looping to perform the entire range of i in a single scan unless that range is very short or the process requires that the whole operation be done at once.
 
I don't know if the CPT function optomizes its operation but you may consider rewriting your expression as

3600 | N97:[N10:0]

unless you intend the truncation which may result in the "/ 3600" operation
 

Similar Topics

Hi, I'm learning lots about step 7 at the moment but still have a way to go. What I want to do is count how many parts are made every hour on a...
Replies
9
Views
4,238
How to increment the address of the 'D' data registers in MX-400 plc using MX-Builder software which is merely same as Omron Plc and there...
Replies
0
Views
1,297
I am new in Q series programming. I want to increase the data D automatically i.e : At the first scan (process counter = 1), PLC read data from...
Replies
6
Views
2,115
Hi, Am I being daft (again)? I want to increment a tag (Integer) by 1 each time a button on the HMI is pressed. Before the button press, the...
Replies
22
Views
2,341
Hi, I have a stand alone inspection unit with no PLC but I can send 24v input signals to the machine PLC to show a good read and a bad read when...
Replies
9
Views
776
Back
Top Bottom