You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
Thread Tools Display Modes
Unread December 2nd, 2019, 07:35 AM   #16
mikeexplorer
Member
United States

mikeexplorer is offline
 
Join Date: Nov 2018
Location: Scranton,PA
Posts: 16
Quote:
Originally Posted by GaryS View Post
I agree the best way to control outputs in sequence is with the SQO function
I have used it on many projects
It is challenging the first time you use it but you will catch on quickly
You can have u to 255 steps per SQO that would give you 16 bits per step if you use an integer data type
If you need more bits then that you can use add a second SQO. There are many options there if needed.
You may also look at SQI function for inputs
Check the online help for them

On a side note I looked over you ladder program and a few observations
You have 2 subprograms shown in you structure tree Lad 6 and 7
But I could find no place in your lad 2 where you call the sub programs I may have missed it.
You call then with the JSR function with the number of the subprogram you want to call 6 or 7
With the RS500 the only program that will run on power up is LAD 2 someplace in that ladder you must call the subprogram. If you donít call it will never run.
I also noticed that you call a JMP to LBL Q2:10 at different places in the ladder program
The LBL Q2:10 is the last rung in the adder program if you call it with( JMP) to it from any point in the program all the ladder rungs between the JMP and LBL are skipped completely and never evaluated
When the program is running after rung 35 (the last rung ) is excited the program will rollover to rung 00
It is possible for the program to run 00 to 09 then jump to 35 and back to 00 and not even scan any of the rungs between is that really what you want to do?
You do the same thing in both LAD 6 and LAD 7
Anytime you do JMP to jump over all the code between the JMP and the LBL it is not evaluated and the outputs are not cleared or set use them very carefully I have seen many programmers get in trouble with them. They spend many hours trying to figure out why the code doesnít work.

I did buy a book about PLC programming and it does mention the SQO instruction but the explanation of it was vague. I will have to experiment with it to see if that is a better way to do this project. I do have another ML1000 setup with push buttons as a trainer unit.



You are correct, in the program I posted, it never calls the subroutines. I keep a blank Rslogix file with these subroutines in place and for the purpose of that program, I was developing the parking routine, I did write it as ladder 2 (main program) for development purposes to see how it worked. The plan for it is for it to become another subroutine. It would not need to call either of the other subroutines since it is designed only to bring the train into the block and stop it, then sense if it overshot the sensors and then back it into place.



It was when I was coding this to be the next subroutine I hit a wall and could not get it to work and I realized the way I am coding these programs is bad practices which is why I reached out for help. An example where the subroutines are used is in my interchange program which was the last program written that worked well.


https://youtu.be/vrGwERqydGI


There is also a routine to deal with the chatter I have been seeing on the inputs and the link posted above for that other website has an excellent illustration of debouncing inputs.



The Omron block (block with the green SSR) is to provide isolation between the track and the PLC. If a train derails it is possible a short could happen and cause the AC track power to surge into the block detect input. This Omron block would prevent a PLC input from blowing out in that case.


Mike
Attached Files
File Type: pdf MAIN AND SIDE INTERCHANGE V1.pdf (224.4 KB, 5 views)
  Reply With Quote
Unread December 2nd, 2019, 07:41 AM   #17
mikeexplorer
Member
United States

mikeexplorer is offline
 
Join Date: Nov 2018
Location: Scranton,PA
Posts: 16
I forgot to answer the question about the JMP instructions. It is mainly how it deals with the case of an alarm code and I also realize that this is also bad programming practice.



Right now I use B3:20 as bits to indicate an alarm code. This will be changed to using an integer value, not only to allow for more then 16 alarm codes, but the Cmore HMI panel I am using has a lookup text function and I can use that to display the alarm code with a text description. Right now my alarm screen has all 16 text messages on it and makes the text visible if the bit is set. Again, not a good way to do that.



I am thinking a better way to avoid using the JMP instruction is to simply have the condition in each rung that the rung can only be true if the alarm code integer value is zero. If it is not, the rungs would always be false.


Also, if this routine was a subroutine, once it returned to the main program, it could also evaluate if there is an alarm condition (non-zero value) and would not JSR to the routine again until the alarm code was cleared.



Mike
  Reply With Quote
Unread December 2nd, 2019, 09:33 AM   #18
Ken Moore
Lifetime Supporting Member
United States

Ken Moore is offline
 
Ken Moore's Avatar
 
Join Date: May 2004
Location: North, West, South Carolina
Posts: 2,726
Instead of the Alarm integer equals zero in each rung, I would do a rung just for the compare and use an Alarms "OK" bit in all the other rungs, easier/faster to code, especially with the ML line you can use a Symbol: "Alarms_OK"

Or if Alarm Integer > 0, then "Alarm_Active" and use a closed contact in your other rungs.
  Reply With Quote
Unread December 2nd, 2019, 12:25 PM   #19
GaryS
Member
United States

GaryS is offline
 
GaryS's Avatar
 
Join Date: Aug 2003
Location: Lancaster Pa.
Posts: 1,050
The problem with using an integer for an alarm is the you can only post 1 alarm at a time
only the last posted alarm will show up in the HMI if you use the individual bits within an integer you can have all 16 alarms posted at the same time if you think you need more alarm then use double integer (32 bits) or use 2 integer words
the last rung of you ladder should be if alarm word = 0 then alarm OK bit is set
I sometimes have an additional alarm word "Old alarms " then compare the alarm word with the old alarm word if they are not equal them post new alarm to the HMI that way I don't keep posting all active alarms when a new one pops up just the new one. when I post the alarm I copy the alarms to old alarms
there are many ways to handle alarms depending on your needs
  Reply With Quote
Unread December 3rd, 2019, 07:00 AM   #20
mikeexplorer
Member
United States

mikeexplorer is offline
 
Join Date: Nov 2018
Location: Scranton,PA
Posts: 16
Quote:
Originally Posted by Ken Moore View Post
Instead of the Alarm integer equals zero in each rung, I would do a rung just for the compare and use an Alarms "OK" bit in all the other rungs, easier/faster to code, especially with the ML line you can use a Symbol: "Alarms_OK"

Or if Alarm Integer > 0, then "Alarm_Active" and use a closed contact in your other rungs.

That is a good idea, Thank you.


Mike
  Reply With Quote
Unread December 3rd, 2019, 07:09 AM   #21
mikeexplorer
Member
United States

mikeexplorer is offline
 
Join Date: Nov 2018
Location: Scranton,PA
Posts: 16
Quote:
Originally Posted by GaryS View Post
The problem with using an integer for an alarm is the you can only post 1 alarm at a time
only the last posted alarm will show up in the HMI if you use the individual bits within an integer you can have all 16 alarms posted at the same time if you think you need more alarm then use double integer (32 bits) or use 2 integer words
the last rung of you ladder should be if alarm word = 0 then alarm OK bit is set
I sometimes have an additional alarm word "Old alarms " then compare the alarm word with the old alarm word if they are not equal them post new alarm to the HMI that way I don't keep posting all active alarms when a new one pops up just the new one. when I post the alarm I copy the alarms to old alarms
there are many ways to handle alarms depending on your needs

Right now I am using B3:20 for the alarm codes and each bit represents an alarm. The issue I have with it is the HMI. I am using a Cmore EA3-T6CL panel and on my alarm screen I have the 16 text messages and whichever bit is set, would display the text. Not a good way to do it, but it works since I have 16 bits and all fit on the screen. I have already thought of expanding it to allow more bit codes but the issue becomes the display of them on the HMI.



Cmore has a lookup text function which will display one of 255 messages depending on the variable data. This will allow for more then 16 messages and will display the message properly.



Most likely there would only be one alarm condition to deal with since any alarm would stop all motion.



I have to figure out if there is a better way to use bit values for alarm codes as far as displaying them on the HMI.


Mike
  Reply With Quote
Unread December 3rd, 2019, 08:00 AM   #22
parky
Member
United Kingdom

parky is offline
 
Join Date: Oct 2004
Location: Midlands
Posts: 1,450
One suggestion is to use an integer this can be written to on a first up basis, in other words an alarm occurs and the value is stored in the integer, the block is not processed again until that alarm had been cleared allowing further alarms to be displayed (Note: this was not exactly first up only on first alarm but subsequent alarms based on the hierarchy), many HMI's have a function to display text based on a value in a register, although we had an Alarm page, on the main display pages we had a first up alarm using text based messages from an integer. On our system they were grouped into a number of groups depending on the area. This may not suit your needs and will depend on functions in your HMI, I'm surprised that from what you say it appears not to have a proper alarm screen or are you not intending to use it.
  Reply With Quote
Unread December 3rd, 2019, 08:08 AM   #23
Rson
Member
United States

Rson is offline
 
Join Date: Jun 2017
Location: Michigan
Posts: 206
Create fault logic

As mentioned, use a single bit to tell if there is / isnít a fault, and use all fault bits as XIC in that fault bitís logic setup. This way, there can be several faults occurring at the same time. You can use whatever fault bits you want, from Integers to fault bits.

The above article has pictures of the ladder logic, so you can see how it looks.
  Reply With Quote
Unread December 4th, 2019, 05:42 AM   #24
mikeexplorer
Member
United States

mikeexplorer is offline
 
Join Date: Nov 2018
Location: Scranton,PA
Posts: 16
There are several good articles on the website I have been reading and will be helpful to correct some of my issues.


I also have to see what new features the Micrologix 1400 has over the Micrologix 1000. I have it on order and awaiting for it. I am also waiting to get a copy of RSlogix Micro starter which is what I need to program the ML 1400 since the free version does not.



Mike
  Reply With Quote
Unread December 4th, 2019, 10:30 AM   #25
jaden
Member
United States

jaden is offline
 
Join Date: Sep 2009
Location: Pleasant Dale, Nebraska
Posts: 184
Here is a graphic representation of a SQO that I use in classes.
Attached Files
File Type: pdf SQO.pdf (81.4 KB, 13 views)
  Reply With Quote
Unread December 5th, 2019, 05:45 AM   #26
mikeexplorer
Member
United States

mikeexplorer is offline
 
Join Date: Nov 2018
Location: Scranton,PA
Posts: 16
Quote:
Originally Posted by jaden View Post
Here is a graphic representation of a SQO that I use in classes.

Thanks, I will have some time before I start the next phase of programming. Once the new PLC arrives, I will have to tear down and rebuild my controls. I will have to experiment with this using the emulator and see how it works.


Mike
  Reply With Quote
Unread December 5th, 2019, 05:51 AM   #27
mikeexplorer
Member
United States

mikeexplorer is offline
 
Join Date: Nov 2018
Location: Scranton,PA
Posts: 16
Quote:
Originally Posted by Ken Moore View Post
Instead of the Alarm integer equals zero in each rung, I would do a rung just for the compare and use an Alarms "OK" bit in all the other rungs, easier/faster to code, especially with the ML line you can use a Symbol: "Alarms_OK"

Or if Alarm Integer > 0, then "Alarm_Active" and use a closed contact in your other rungs.

Thinking about what you said it also would make it cleaner if I also included the two bits, "Automatic mode" and "Emergency Stop" combined with the test for no alarms. Just have to think of what to call that bit value that would be in each rung. Maybe something like "Good to go" ?


Although this is only a model train layout, I did wire my controls with a proper Emergency stop circuit to follow the model of proper control building. The monitor contacts of the safety relay are an input to the PLC so it knows the control power was shut down. If the button is pressed, it cuts off all power to the track, stopping the trains and cuts off the 24Volts that feeds all the outputs of the PLC.



Mike
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Sequences xzen LIVE PLC Questions And Answers 34 April 27th, 2016 10:47 PM
Control - Data Type in RSlogix 500 and 5K mrchris76 LIVE PLC Questions And Answers 2 July 3rd, 2014 08:02 PM
Programming a sequence of events with RSLogix 5000 JMoga LIVE PLC Questions And Answers 2 May 30th, 2014 06:11 PM
RSLogix 5000 in Motion Control Andreik LIVE PLC Questions And Answers 2 November 13th, 2011 11:14 PM
Speed control with rslogix 500 nickromano07 LIVE PLC Questions And Answers 5 December 21st, 2008 08:06 PM


All times are GMT -5. The time now is 03:57 AM.


.