Improving Code

Bob O

Member
Join Date
May 2003
Location
Posts
1,873
All,

Hardware/Software…
PV600 Touch
SLC 5/03
RSView32 SCADA

I have written code so that the machine operator can select the product that he/she is going to run for data logging and set points. There are currently 14 different products to choose from and I have them coded into the PV for their selection and coded in RSLogix500 for this and all works fine.
Operation…
The operator has to clear the current selected product before selecting another and once a product is selected it locks out all other products until the current one is cleared.
Question…
I am looking for a simpler way to lockout all other products after one is selected instead of 13 NC contacts in series with the output. I have another job coming up in the near future with about 30 products. Version 1

I have tested that when a certain product is selected that a binary word is equal to a value and then do compares on the rest of the product selection rungs, but that code just looks ugly. Version 2


Thanks,
Bob O.

Pic didn't load Working on it...
 
Last edited:
hi bob

Thirteen nc contacts may not look nice but from a processor scan consideration it is probably the fastest execution you can get.
I have just done a similar thing on clx and ended up with lots of xic and ote rungs instead of a large loop, because it was the fastest execution.

regards

kevin
 
Here is a sample of some code. Do not try to unzip it. Just change the file extension to RSS and open in RSLogix500. Regards Alan Case
 
Consider.

Writing so that it supports ONLY one product. This will make the program very clean. Then have a subroutine that selects and copies the constants and data from any of the 13 recipes into the working area. The part that copies the 13 recipes should all be in one subroutine that doesn't get scanned unless a change is made.
This avoids indirect or indexed addressing for the most part.
 
What I have done in the past is similar to what you are trying to do. I require a "clearing" command to clear the selected product.

Then when any product is selected, set a latch. This latch prevents any other product from being selected. When you clear the product, you clear the latch.
 
For the most part, I've done what Peter recommends. As he says, the key is preventing the "parameter copying" code from running unless that machine is in a safe state.

Put all of your change inhibit interlocks on a rung to drive a "Change Permitted" bit. Use this bit before the JSR to the "parameter copy" routine . . .

Marc
 
Thanks for all the advice. I already had the code in its own conditional sub and Alan really cleaned up the code by putting in the latch bit.

Thanks Again
Bob O.
 
Hi Bob. Glad to help. I had a typo in the code. The Panelview pushbuttons at the start of each rung should be unique for each selection but I guess you figured that out. Regards Alan
 

Similar Topics

Hello everyone, I work for an integration software company. Our flagship product is a middleware that allows anyone with SQL knowledge to...
Replies
3
Views
2,190
I have two 12" CMore panels and six 6" Cmore panels on our industrial Ethernet network. There are also three x SLC 5/05s (one serves as a DH-485...
Replies
1
Views
3,644
Hi I am using a plc to readin an analog signal. I tested the plc with a potentiometer and it recorded the correct voltage levels.when I connect my...
Replies
6
Views
1,948
Hello I'm writing a thesis in industrial engeneering and I need info/documentation on ways to improve stability in a hydraulic actuator. Stuff...
Replies
6
Views
3,388
I received an email from a student with the following code attached. This is supposed to control a floodgate system, and supposed to be written...
Replies
18
Views
400
Back
Top Bottom