omron subroutine

srummel

Member
Join Date
Jul 2011
Location
TN
Posts
17
can anyone tell me if there is a difference between a subroutine and a section in omron cx-programmer? it seems that what I would call a subroutine is refered to as a section, but there are no instructions to call or define a section. all of the instructions refer to the subroutine as a subroutine. yet the word subroutine does not appear anywhere in any manuals except in the instruction help for those few instructions. any ideas at all would help
 
A section is simply a tool to organize your program.
The section divisions are not really recognized by the processor.

Subroutines are a different issue. These would work as you expect.

To get a better understanding of the instructions, I would recommend you go to www.omron247.com and download the manual for the processor that you are working with. Note, you will need to register on the site to download manuals. There is no cost to register.

Hope this will help.
 
have manual

I have the manual and it does not explain the function of either subroutine or section. it has very good explanations of the associated instructions but that is as far as it goes.
Thanks again.
 
What is the cpu part number that you are using?

What is the manual number that you are using?

Subroutines and related instructions are covered in the programming manual for each processor. We just need to make sure you have the correct manual.
 
I have the manual and it does not explain the function of either subroutine or section.
If you need help translating the broken English of the translated-from-Japanese manual into Tennessee Hillbilly English, then I can help with that!
 
From the Omron CX Programmer Operation Manual, Glossary, page 97:


Section: A part of a PLC program, like a chapter is to a book. The sections are combined in order to form a program, and scanned in order by the PLC.
From this definition, an Omron "Section" could indeed be a Subroutine, but a Subroutine is not necessarily a complete "Section".


So an Omron "Section" could contain two Subroutines, or a Subroutine and part of the main ladder program, or some other combination. In other words, in English-language terms, a "Section" is pretty much anything you want to put into it, therefore does not tell you much of anything helpful, except that it divides your program into nice groupings like chapters in a book.
 
Last edited:
Iam looking for a definition of section and of subroutine according to omron the instructions are well defined. but that is not what Im looking for. I am using a few different models cqm1-cpu21, cqm1h-cpu21 c200h I don't recall the cpu for the c200h. but my question is more related to cx-programmer than to any processor in rslogix a subroutine runs in the program and all subroutines are called except the main routine. the main routine and the subroutines appear in the project tree under/in the program. In cxprogrammer the sections appear in the project tree under/in the program subroutines dont seem to have an organizational place in the program
 
In cxprogrammer the sections appear in the project tree under/in the program subroutines dont seem to have an organizational place in the program
Exactly, you got it, "Section" is a bunch of stuff that may be loosely related in some way, but mainly it is whatever the programmer decided to put in there.

The only mention of subroutine in the entire Operation Manual is on page 35, talking about Interrupts:

The Interrupt/Refresh tab of the PLC Setup component allows certain PLCs to interrupt the main program by input and scheduled interrupts in order to call a subroutine.
I suppose they did not translate the definition of a Subroutine into English. To get that, you probably need to learn Japanese. They meant well, but the failure is in the follow-through.​

Section: A part of a PLC program, like a chapter is to a book. The sections are combined in order to form a program, and scanned in order by the PLC.
Program Sections
For the easier management of large programs, a program can be divided into a number of definable, named sections.
.A section is like a chapter in a book – the PLC scans the sections in order.

A list of the sections in a program is displayed in the project workspace under the program name. There is also a section list view showing the Start and End steps, which can be opened in the workspace window by clicking on a program name.
It is possible to reorder and/or rename the sections from this list or from the project workspace. It is important to remember however that when reordering or deleting sections, keep the ’END’ section at the end of the program.
Program sections can be reordered using the mouse to drag and drop sections up or down in the section list.
When using the keyboard, the 'Move Up' or 'Move Down' commands from the context menu of a section on the project workspace are used.
Sections in a specific program can also be used to store frequently used algorithms which can then be copied to other programs, using a section as a kind of library.


 
Last edited:
The section is only related to CX-Programmer and is only there to allow you to organise your program into 'sections'. These can be renamed by right clicking on them to 'Alarms', 'Communications' or whatever.
Sub routines are PLC related and are functions. Check functions SBN and SBS in the manual.
 
Yeah, my point was that it would be nice if they had a description in the manuals somewhere about what they thought a SUBROUTINE was (like they did for SECTIONS).
 
Last edited:
So, to sum up:

Sections are used to make order of your program. Sections are executed unconditionally.
Subroutines are contained within sections, and are executed conditionally using the instructions as shown in the previous posts.

The code above is from CQM1H CPU51 but is the same format for CQM1 CPU21
 
In the latest versions of CX-P if you hit F8 then click on details then click on instruction help a full list of instructions for the selected PLC with all the help you could require will pop up.
just click on the instruction.
There is a whole headed section on sub routines.
The help for the old CQM1, CQM1H, C200H, C200HS is pretty basic though. Select the PLC as a CJ2M and the help is extensive. The newer help files have not been migrated to the older antiquated PLCs. Just be careful you do not try to use a function that is not in the PLC you are using.
When programming for one of the older PLCs, I open 2 copies of CX-P. The PLC I am using is selceted in one instance of CX-P and the CJ2M is selected in the other instance. For the older PLC I am working on will let you know what functions are available and the instance containing the CJ2M will have the latest and very extensive help files.
At least I only have to use one programming package for Omron not 2 or 3 and then get totally confused going from one package to another.
If you learn the tricks it is all there.
 

Similar Topics

[Ladder Section Name : Section1] [Ladder Section Name : Section2] [Ladder Section Name : Section3] ERROR: Step at rung 16 (6, 1) - SBN not defined...
Replies
4
Views
2,297
Good morning everyone I’m currently working on a omron device net and have a nord drive that fell off the network. I have limit knowledge in...
Replies
2
Views
97
I've come across a system running omeron cx-programmer version 9.42. Am I going to need to find a legacy version of the software to edit and...
Replies
1
Views
85
Has anyone done SMS messaging from an Omron CJ2J-CPU31 PLC? If so could you help please. Omron here in Oz have not had any experience doing this...
Replies
5
Views
215
I have an old plc in the system I have, moxa nport was used to communicate with scada, I want to replace the plc with cj2m cpu33 and eliminate...
Replies
1
Views
87
Back
Top Bottom