Guest pctprogramer Posted October 29, 2002 Report Posted October 29, 2002 hey, I am current college student working on a PLC programming project for my class. We are using a GE 90-30 PLC with VersaPro software as our programing language. The current program that I have a question with involves using a "stack" to perform the needed operation. The stack is being used to run one part of our 4 part system through a cleaning cycle while the other 3 parts stay in operation. The stack must operate similar to that of a deck of cards, first on is the first out and so on. I was wondering if anyone who has experience with this software could give me a few tips as how to accomplish this task using this software. Any little bit helps. Thanks Quote
Guest PMC Posted March 4, 2003 Report Posted March 4, 2003 It's a good question, because many/most PLCs are lacking elementary features that any student would expect. (For example, indirect addressing). I use VersaMax, but I believe it is quite close to mid-range 90-30. You can also try the ARRAY MOVE instructions to emulate indexed or indirect addressing. There are some hints on the message board at GE FANUCs website. Maybe one way is with a block MOVE: Suppose you did a MOVE_INT for 10 words starting at R1000 R1000 is the first item in the stack, R1001 the second and so forth. Do a MOVE_INT 10 from R1000 to R1001. This "pushes" the stack down, and you can stick the item you want to add in at R1000. Now I'm not sure if you can do a POP by MOVE 10 R1001 R1000 Quote
Steve Bailey Posted March 5, 2003 Report Posted March 5, 2003 From your description, I think the Shift Register instruction will do what you need. Let's say you define a stack of four consecutive registers, %R001 - %R004, and that those registers initially contain the values %R001 = 10, %R002 = 20, %R003 = 30, %R004 = 40. Then you define a Shift Register instruction with a length of 4 and a starting address of %R001, an source address of %R005 and an output address of %R006. When the IN (enable) node of the Shift Register instruction is true, the value in %R004 gets shifted to the output register (%R006), the value in %R003 gets shifted to %R004, %R002 gets shifted to %R003, %R001 gets shifted to %R002, and the value in the input register (%R005) gets shifted into %R001. If you want to make it a circular shift, you can make the output register the same address as the input register. Be sure to make the enabling logic a one-shot, as the instruction performs the shift every scan that the enabling logic is true. Quote
Guest RichWargo Posted June 13, 2003 Report Posted June 13, 2003 My question back to you would be, why are you trying to emulate a FIFO stack? Usually when someone comes to me with a general question about emulating a computer-science data structure in a PLC, I sit down with them and convince them to develop a different paradigm. One must fit their thinking to the machine, rather than trying to force the machine to do something it really wasn't intended or designed to do. I have implemented phase logic numerous times on a PLC. Generally, the approach is to define as many contacts as states, and put logic in to control the state of the "state" contacts, with the logic for a state being conditional on the individual "state" contacts. Latched contacts are quite useful for this purpose as there can be separate "set" and "reset" logic flows. If you will provide more details on the general logic operating flow, I might be able to provide you some guidance. Quote
Guest John Harvey Posted August 8, 2003 Report Posted August 8, 2003 A neat way of manipulating numbers is by using the @ symbol (address by pointer) rather that the % symbol (address by reference). This will work for all GEFanuc PLC's Micro, 90-20, 90-30 & 90-70's EG If R10 contains the value of say 100 then you can get two completely different results by using the % or @ symbol. %R10 = 100 @R10 = Value in register 100. Their for by using a simple MOV instruction you can now create a cool array instruction. NOTE I have been a mining engineer for about 7 years, If I catch anybody using a @ pointer I usually shoot them. This makes code hard to debug at 2:00am when the thing stops working. jh_harvey@yahoo.com Quote
Steve Bailey Posted August 8, 2003 Report Posted August 8, 2003 John, Indirect addressing using the @ character instead of % only works with the 90-70 series. You can't use it in a 90-30, 90-20, series 90- micro, or VersaMax. Quote
Recommended Posts
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.