Jump to content

Recommended Posts

Is there a way to always have a value add to an existing one so that the plc can keep a running total?

The application I'm trying to develop is a fueling one, where everytime they pump product, it adds to the master total and prints a before and after ticket.

I'm having trouble getting it to add each time without resetting. And I'm not sure how to read a before and after, basically from the same ML.

Where when they select begin fueling it will take the master total as a before and then when they hit end fueling it will take the master total plus the gross.

Do I need to incorporate a DT read/write rows?

hopefully this makes a little sense, I took this program over from an former co-worker so there is a lot of things in it that doesn't really make sense to me as I have no training beside a seminar.

Note: I can get the program to print a ticket and show a before and after with the values but they just reset evertime.

Link to comment
Share on other sites

I think I came up with a better explanation, with example ML's

Register Screen under Admin Menu:

Master Total: ML1 (ex. 1000 + gross)

(This is the running total, non-editable)

Register Odometer: ML0 (ex. 1000)

(This is inputed by customer to match register head, this is only set once at installation of program)

Register sub-routine:

first I need ML0(register odometer)+ML2(gross) = ML1 (Master Total), but only done once to get the register odometer included in the Master Total. And then this needs to increment with each additional fueling by gross(ML2)

Printed Ticket

Gross: ML2

Before:ML1 After:ML3 (ML1+ML2)

Now each additional fueling will move the ML3 to the Before total, and come up with a new After. I'm guessing I'm making it harder then it should be but the getting the after to before is what I can't wrap my head around.

Link to comment
Share on other sites

I think I came up with a better explanation, with example ML's

Register Screen under Admin Menu:

Master Total: ML1 (ex. 1000 + gross)

(This is the running total, non-editable)

Register Odometer: ML0 (ex. 1000)

(This is inputed by customer to match register head, this is only set once at installation of program)

Register sub-routine:

first I need ML0(register odometer)+ML2(gross) = ML1 (Master Total), but only done once to get the register odometer included in the Master Total. And then this needs to increment with each additional fueling by gross(ML2)

Printed Ticket

Gross: ML2

Before:ML1 After:ML3 (ML1+ML2)

Now each additional fueling will move the ML3 to the Before total, and come up with a new After. I'm guessing I'm making it harder then it should be but the getting the after to before is what I can't wrap my head around.

Link to comment
Share on other sites

Is there a way to always have a value add to an existing one so that the plc can keep a running total?

Yes, of course. Just an ADD block where one of the Source and the Destination are the same address.

The application I'm trying to develop is a fueling one, where everytime they pump product, it adds to the master total and prints a before and after ticket.

I'm having trouble getting it to add each time without resetting. And I'm not sure how to read a before and after, basically from the same ML.

You can't read before and after on the same ML. You need to define one as the previous value and one as the current value. Every time you read you need to then shoft the current value into your previous value.

Where when they select begin fueling it will take the master total as a before and then when they hit end fueling it will take the master total plus the gross.

To me it would be the other way around. It would be taking the current value minus the previous value to determine the gross of the last fill.

Do I need to incorporate a DT read/write rows?

That depends on if you need to keep track of every transaction.

hopefully this makes a little sense, I took this program over from an former co-worker so there is a lot of things in it that doesn't really make sense to me as I have no training beside a seminar.

Note: I can get the program to print a ticket and show a before and after with the values but they just reset evertime.

I might be a bit unclear about exactly what you want. Is it OK to post the program so we can see what you are doing?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...