Sign in to follow this  
Followers 0
warkan

Automatic parking system

21 posts in this topic

Hey guys ! I am a student and working on this project called automatic parking system using PLC . I have a little experience on ladder logic programming using Rslogix 500. I used to be able to create a main rung which had all the sub routines in them. How do I do I do this on CX-Programmer ? Your help is much appreciated.

Share this post


Link to post
Share on other sites
What do you mean create a MAIN RUNG with subroutines in it? And which CPU will you be using?

Share this post


Link to post
Share on other sites
PLC : OMRON CP1L-M40DR-A HMI :OMRON-NP5-SQ001B I have attached a print screen of what I did on rslogix 500.

Share this post


Link to post
Share on other sites
CX-Programmer implements sub-routines differently than RS500. To the same as you have done in RS500, just create ladder sections in the order you wish them to be scanned. The PLC will automatically scan them as one consecutive program, whereas RS500 you could call a subroutine multiple times....

Share this post


Link to post
Share on other sites
Does that mean I cant create subroutines in CX-Programmer ? I would have to create ladder sections for all the tasks in one entire page ? That can get confusing ...

Share this post


Link to post
Share on other sites
No, you can create sections which contain your blocks like you have done in RS500. You do not need to call these sections though, CX-Programmer scans them automatically.

Share this post


Link to post
Share on other sites
How exactly do I create sections that contain my blocks ??

Share this post


Link to post
Share on other sites
Really? Right click on your program task & add section.

Share this post


Link to post
Share on other sites
You can create subroutines in the CP1L PLC. I have shown a picture below of the basic layout of how it is done. You would put the subroutines down at the bottom of the code, just before the END instruction. I am not sure exactly what this accomplishes though. The subroutine still has to be inside the program in which it is called. It is more useful for writing a routine that is called multiple times within one program, rather than for organizational purposes.

Share this post


Link to post
Share on other sites
The AB code showing all the subroutine calls in a row is a bit of a waste. And with all the bounce out to a sub and back then out to another and back cannot be very processor speed efficient.

Share this post


Link to post
Share on other sites
I agree, there is not much point to it, but it can be done. I did not show all the calls, just one example, but you could have multiple calls in the first rung and then have the subroutines one after another just before the end of the program.

Share this post


Link to post
Share on other sites
the Subroutine method was the only way AB could break the code into sections.. Something we have been taking for granted (and could do easily) since Windows 3.1 with Syswin...

Share this post


Link to post
Share on other sites
Does CX-programmer have a command called ONS- one shot ? Also, if you have any tips on how the addressing the works that would be very helpful ! I get confused with the 0.00 and stuff.

Share this post


Link to post
Share on other sites
There are a couple of variants, the most similar is the 'UP' instruction.

Share this post


Link to post
Share on other sites
A one shot output command (where every contact associated with the address is a one shot is a DIFU (differentiate up (leading edge)) or a DIFD (differentiate down (trailing edge)). However, you can just use a regular coil with newer Omron PLCs and you can change each contact to be a differentiated up or down, or leave it as a regular contact. It is more flexible to use the latter method. Quick tips on addressing: All addressing is broken up into 16 bit words. Most memory areas have a letter in front of the word address (except for CIO) and if you are referring to a bit, then there would be a decimal point and the bit number. Words can be any number format (integer, double integer, real, hex, BCD, etc). 32 bit values such as Double Integers and Real numbers use two consecutive addresses. The memory areas are not format specific, but functionally specific. What I mean by this is that each memory area has its own properties as to how the memory is used and could be any number format. I have listed them below: CIO is the I/O area. Typically (with perhaps some remote I/O exceptions) all of your real world I/O will be in this area. There is no letter in front of the address. When referring to a bit, the address would look like this: 0.00 or 1.12. This means channel 0, bit 0 and channel 1, bit 12 respectively. Words are addressed by just the channel number: 50. This would point to channel 50 in the CIO area. A - Auxiliary Relay Area - this is an area in the PLC that has many predefined status and command words and bits. It is all predefined for specific functions. You will find many different functions in this area. You will not use this as internal memory. T - Timer. Timers can use either BCD or Integer (Binary) format. Depending upon which PLC you are using and sometimes which mode the PLC is in. Timer done bits are referenced like this: T44. The contact labeled T44 will turn on when the timer has finished. The present value for a timer is also represented by T44. The PLC knows if you want the bit or the present value depending upon how you are trying to use the address. If you use it for a contact, you are using the done bit. if you use it in a move instruction, then you are using the present value word. C - Counter. All of the same rules that applied to timers (listed in paragraph above) also apply to counters. Done bit: C67. Present value is also C67. IR, DR - Index Registers and Data registers. These are indirect addressing registers. You can dig into how to use these later if you need to. Don't use these unless you are intending to use indirect addressing. D - Data Memory. This area used to be used only for word level functionality, however on the newest PLCs you can also assign bit level functions in this area. This memory area is retentive. So, when you turn off the power, the CPU remembers the values stored in this area. There is 32kwords of D memory. You can freely use from D0 - D19999. Above D19999, there are reserved memory areas that you need to avoid. Bit format: D5.12. Word format D5. Primarily used for storing numerical values that need to be retained. TK - Task flags. These are bits that tell you if a cyclical task is running or not. H - Holding relays. Internal bits/words that are retentive. These can be used for whatever function you want. Bit level H0.00. Word level H0. I would recommend that when you need retentive bits, to use the H area. When you need retentive words, use the D area. W - Work Relays. Internal bits/words that are NOT retentive. These can be used for whatever function you want. Bit level W5.05. Word level W15. That about covers it. More details can be found in the Operations manual for the PLC that you are using. One more note, when trying to use a constant number in a function, it is critical that you use the constant format indicator in front of the number. See the examples below: #45 Constant BCD or HEX number &45 Constant Unsigned Integer number -45, +45 Constant Signed Integer number +1.234e5 Constant Real number. If you do not put the # or & or whichever format you are using, then it will assume that you mean an address in the CIO area. For instance, if you put 45, but meant to do a constant unsigned integer 45, you are in for a surprise. 45 (without the & in front of it) means channel 45 in the CIO area (which would be 0 unless you have some I/O assigned to that word).
1 person likes this

Share this post


Link to post
Share on other sites
I have attached the program that I want to reproduce on CX Programmer V 9.3. So going to page 8, how would my addressing change ? Some people suggested me to use W in front of the Inputs/outputs rather than just entering the address number directly.. How do I decide this is the address for this this contact and this bit number is what it is ? These are my inputs and outputs : 1. CI0 0.00 In Gate Car Waiting 2. CIO 0.01 In Gate Car Entered 3. CIO 0.02 In Gate Motor Running 4. CIO 0.03 Out Gate Car Waiting 5. CIO 0.04 Out Gate Car Out 6. CIO 0.05 Out Gate Motor Running 7. CIO 0.06 Car in Position A1 8. CIO 0.07 Car in Position A2 9. CIO 0.08 Car in Position A3 10. CIO 0.09 Car in Position B1 11. CIO 0.10 Car in Position B2 12. CIO 0.11 Car in Position B3 13. CIO 1.00 Lift 1 Pushbutton 14. CIO 1.01 Lift 1 Motor Running 15. CIO 1.02 Car Waiting for Lift 1 on Floor G 16. CIO 1.03 Car Waiting for Lift 1 on Floor A 17. CIO 1.04 Lift 1 at Floor G 18. CIO 1.05 Lift 1 at Floor A 19. CIO 1.06 Lift 2 Pushbutton 20. CIO 1.07 Lift 2 Motor Running 21. CIO 1.08 Car Waiting for Lift 2 on Floor G 22. CIO 1.09 Car Waiting for Lift 2 on Floor A 23. CIO 1.10 Lift 2 at Floor G 24. CIO 1.11 Lift 2 at Floor A 1. CIO 100 .04 In Gate Up Direction 2. CIO 100 .05 In Gate Down Direction 3. CIO 100 .06 Out Gate Up Direction 4. CIO 100 .07 Out Gate Down Direction 5. CIO 101.04 Lift 1 Up Direction 6. CIO 101.05 Lift 1 Down Direction 7. CIO 101.06 Lift 2 Up Direction 8. CIO 101.07 Lift 2 Down Direction PROGRAM (1).pdf

Share this post


Link to post
Share on other sites
If they are actual inputs and outputs, you do NOT put a W in front of the address. W (Work area) bits / words are for internal use only.

Share this post


Link to post
Share on other sites
You are correct, in an earlier post, I referred to the fact that there are some remote I/O schemes that allow you to map I/O into other memory areas. Otherwise, all real I/O is in the CIO area. If by mapping, you mean using ladder to map the inputs to a W area, then run your program with the W bits and then map the W bits to outputs, the statement still holds true, "If they are actual inputs and outputs, you do NOT put a W in front of the address."

Share this post


Link to post
Share on other sites
Ah! so if you look in to that program file which I uploaded, on page 8 the first input Car_In_Pos_A1 is the only ACTUAL input from the I/O list. The OR gate along with it is within the program. So in this case I use W for this and latch it with the output ?

Share this post


Link to post
Share on other sites
Yes. That rung of ladder might look like this: If you wanted the internal addresses to be retentive, you would use the H (Holding Relay) area instead of the W (Work Relay) area.
1 person likes this

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0