sbeekman Posted November 19, 2012 Report Share Posted November 19, 2012 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 More sharing options...
sbeekman Posted November 19, 2012 Author Report Share Posted November 19, 2012 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 More sharing options...
sbeekman Posted November 19, 2012 Author Report Share Posted November 19, 2012 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 More sharing options...
Damian Posted November 19, 2012 Report Share Posted November 19, 2012 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 More sharing options...
sbeekman Posted November 19, 2012 Author Report Share Posted November 19, 2012 Damian Thanks for the help, it won't let me upload the program, says permission error. I'm guessing I don't have enough posts yet. I can email you it if you would like. Link to comment Share on other sites More sharing options...
Damian Posted November 19, 2012 Report Share Posted November 19, 2012 Seth, I have attached your file. Link to comment Share on other sites More sharing options...
Damian Posted November 19, 2012 Report Share Posted November 19, 2012 Second try is the charm. RR 4618_05_26_10d.vlp Link to comment Share on other sites More sharing options...
sbeekman Posted November 19, 2012 Author Report Share Posted November 19, 2012 Here's a real simple program that illustrates what I'm trying to accomplish. Basically I need the odometer MI to be added only once on the first run of program. I can get it to keep a running total but if I try and add the odometer value it adds that value everytime. Test Sum.vlp Link to comment Share on other sites More sharing options...
Cara Bereck Levy Posted November 20, 2012 Report Share Posted November 20, 2012 Hi, sbeekman--were you able to upload what you wanted in the end? I see that in your final post you attached an application--was that it? Just want to make sure :-) Link to comment Share on other sites More sharing options...
Damian Posted November 20, 2012 Report Share Posted November 20, 2012 Is this what you're asking for? Link to comment Share on other sites More sharing options...
sbeekman Posted November 20, 2012 Author Report Share Posted November 20, 2012 That was exactly what I was looking for, thanks so much. I would have never figured that out. --Cara I was able to upload then, might have just been a glitch the first time. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now