Pop Machine Program

Atlascycle

Member
Join Date
Nov 2005
Location
Fremont, Ne
Posts
39
I Started a New Quarter at School last week and the First Project is to program a pop machine. The word for word description is as follows:



Pop Machine
Inputs:

4 Different Selections

4 Input Buttons for Money Inserted ($.05, $.10, $.25, & $1.00)

Coin Return Lever



Outputs:

4 Indicators Showing Product Dispensed

Indicators showing coins Returned

Use exact Change Light

Empty Try another Selection

Two separate Price Points



In Ladder 4 is using the mcr block in this fashion a good way to “slow down” the scan to allow the process to actually happen?



Not looking to get my homework done just looking for opinions.



Thanks,



Jason
 
I am not sure why you would need to "slow down" the scan to make it work.

I do not think you need the MOV in rung 5 Ladder 2. What you will need and may have, that I have not seen, is to "zero" N7:0 and N7:1 after the drink is dispersed. Technically not sure why Rung 0, Ladder 2 is used either but will look at it closer.

The other thing is do not overthink the application, the scan issue is a good example. What makes you think you need to slow down the process?

Do not think you have to use subroutines and instructions like MCR and JMP etc. Yes you may need to learn them but in due time, the objective at this point would be to create a simple, easy to read and follow working code.

I would suggest you attempt it again just using Lad 2, first extablish your order of operation, in this case the first thing would be too establish if drinks are available, if exact change is needed.....

In other words the machine should be easy to understand i.e. there will be inputs to show drinks are there, the counter works but that means it may have to be programmaed every time drinks are installed to reset the counters or will require an input to do the counting. The how could depend on conception of the machine, that you determine and document.

The same would apply to change holders, some method wiil be needed to show an appropriate amount of change is available.

Do not worry about scan time, a plc may only scan from top to botton etc but it can initiate multiple operations in one scan. In other words it should be fast enough to count the money by the time they push the button for their selection and have calculated what change to dispense if needed.
 
If they would insert say two dollar bills and choose root beer at $1.25 then the program would scan and trigger the output to return the quarters to fast, IE the light that is indicating will flash to quickly. Perhaps I am over thinking the problem. The jumps and mcrs are to get it to give back the change better, for instance if it owes you back $.35 it will give you back a quarter and then a dime. I was afraid that if I did not use the mcrs it would see that it woe’s you $.35 and give back a quarter, 3 dimes and 7 nickels.


And Thank you Ron For Your Input


Jason
 
The Move in Ladder 2 Rung 5 is to get the value of the money added to the machine available for the next scan when more money is inserted.



Rung 0 is to keep the outputs from dispensing the sodas when the machine is powered up incase the machine was in the middle of trying to dispense when power was lost.



The counters were used because there was no way given to have a limit switch to tell the plc that the slot was empty.



Thanks Again,

Jason
 
rsdoran said:
Technically not sure why Rung 0, Ladder 2 is used either but will look at it closer.

Does any one else have any thoughts on this?

Our instructor told us in a previous class that it was good practice to have the first pass bit reset any latches that are connected to the outputs.
 
Yes, I have a few thoughts. In Rungs 1 through 4, you add different amounts of money to N7:0, and put result in N7:1. For example:

Rung 1: $.05 Source
+ 00 N7:0
= $.05 N7:1

Rung 2: $.10 Source
+ 00 N7:0
= $.10 N7:1

Did not you want to actually do this, add new money to old total:

 Rung 1: $.05 Source 
+ xx N7:0 (whatever is already in N7:0, total deposited
= $.05+ N7:0

If so, then change rungs 2 thru 4 to match, and delete Rung 5 (not needed). N7:1 is not needed at all.
 
Last edited:
Lancie1 said:
Yes, I have a few thoughts. In Rungs 1 through 4, you add different amounts of money to N7:0, and put result in N7:1. For example:

Rung 1: $.05 Source
+ 00 N7:0
= $.05 N7:1

Rung 2: $.10 Source
+ 00 N7:0
= $.10 N7:1

Did not you want to actually do this:

Rung 1: $.05 Source
+ xx N7:1 (whatever is already in N7:1, total money deposited
= $.05+ N7:1
We were told by the instructor that the AB processors will not except this. I am new to the AB programming but have done a little using Horner OCS Controllers and with the OCS it is allowed to add a value to a integer and put the result back in the orignal file.
 
Jason.

You either misunderstood your instructor, or he is incorrect. I have been using the Allen-Bradley processors for 30 years, and it is perfectly acceptable to add a number to itself. It works great.

Test it for yourself. If it was not allowed, when your verifiy your rung ("Edit", "Verify file"), you would get an error message at the bottom of the screen. I just changed your program Rung 1, and guess what,--no errors when verified.

The vending machine has been covered on this forum before. Have you done a search to see what has already been done here?
 
Last edited:
Lancie1 is correct. But be a little careful. If you execute something like that unconditionally you will be a runaway sum. You can't just let an equation like that go unless you zero the sum at the top of the add group.

Keith
 
Keith is correct also. You must make sure you only add each number ONE time. A one-shot (OSR) would work well here. Never mind, you already have some OSRs!

Learn to use the Help menu often. Here is a quote from the RSLogix Help file on the ADD instruciton:

"When rung conditions are true, this output instruction adds Source A to Source B and stores the result at the destination address. Source A and Source B can either be values or addresses that contain values, however Source A and Source B cannot both be constants.

Rockwell Software 2000"

Where does it say you cannot add a number (value or address) to itself?
 
Last edited:
I will change it when I get to class tonight, unfortunately I do not have RS Logix 500 available out side of the class room. If I were to change the Processor to the micro 10pt would I be able to use that version to work on it? And when I get to the lab change tot processor back to the SLC.



I did a search for a pop machine not Vending machine,🙃 I just did the Vending machine search and will take a look at the results,





Thank you for your Time



Jason


:site:
 
If I were to change the Processor to the micro 10pt would I be able to use that version to work on it? And when I get to the lab change the processor back to the SLC?

Yes, as long as you do not need more than 10 external Inputs and Outputs. You woul have to recongfigure your I/O to be the same as the Micrologix.

A handy aid for you would be the LogixPro simulator program, available from MrPLC.com. It simulates the RSlogix program and also the PLC, so you can test your logic before getting to class and finding, to your horror, that your latest brainstorm crashes and you have to spend the whole class period trying to rewrite code. LogixPro is limited, but it should handle your pop machine.

I looked at the "Vending Machine" search. I was disappointed to see that no help was actually given to any of the students, for various reasons. Not to repeat that dismal failure again, I will try to test out your program for you when I find time.
 
Last edited:
Jason,

Fixing the money collection to add back to itself in N7:0, this picture shows that when each money slot is triggered once, the total is 140, exactly as it should be:

POP_MACHINE1.jpg


Did you know that you must add JSR's in your main Ladder 2 file to make ladder files 4, 5, and 8 active (get scanned)?
 
Jason
I just want to tell you that I think that you are doing a great job on this post.
Many peoplle wouldn't think to zip both the .RSS file and a PDF version.
The ladder file is well documented too.
I can tell that you are really interested in this project.
You'll have it working in no time.
Anyhow good luck, and don't forget the JSR's.
 
Sorry I did not reply yesterday I left work early to go to class.

I changed the math function blocks back to the way that Lancie1 suggested and it worked just fine. That is the way I originally had it written but the instructor thought it needed to be done the other way and actually did not believe me until I showed him that it would actually work. I added the JSR’s for the other ladders.



One of the problems I ran into last night was getting the change back to work correctly. I had to long of a delay on the T4:1 timer and it would not change the Money inserted to zero until after it started to return the change, it would always give back one extra quarter, which would be good for the customer but bad for business LOL.



The other thing that I noticed is that the way I have the money for change inventory set up it is not stopping when it is out of change to return. I need to ad the logic to see that the counter is at zero, or possibly set up an integer file and do a compare?



In the first post I was talking about “ Slowing down the scan” to get the change back to work correctly, I ended up putting in compares to get the quarters to return first and then if the change back value was less than 25 then return the dimes Etc…



The problem with doing it this way is I still need to find a way to allow it to return dimes if it is out of quarters and nickels if it is out of dimes.



I just ordered the LogixPro and I will try to find some time to give some if it a try with that.



Thanks for the reply’s so far.:site:





Jason
 

Similar Topics

Hi all, Working on another project in class, a Pop Machine this time. I currently have everything working, except for the change return. Using...
Replies
3
Views
3,406
Hello everyone, I need your help to guide me how to make this screen appear when the alarm is present, I have already configured its size and the...
Replies
5
Views
143
Hi to all, Does TIA portal support creating reusable pop-up display as FTV has it implemented? Something like on link below. Thanks in advance.
Replies
5
Views
531
I am running Logix Designer v32, and noticed if I type new instruction value(s) (XIC, XIO, MOV, etc etc) into a rung without any operands/tags...
Replies
4
Views
775
Hi Everyone, currently i'm developing a project using Cimplicity version 10. I'm facing an issue where every time i press the same button to open...
Replies
9
Views
832
Back
Top Bottom