You are on page 1of 28

OMRON CP1H, PLC, PLC BASICS

OMRON CP1H TABLE DATA


INSTRUCTIONS
JUNE 12, 2017 | GARRYS | LEAVE A COMMENT

The Omron CP1H programmable logic controller has several different table data processing
instructions. These instructions are used to handle table data, stacks and other ranges of data.
We can define a stack of data. With this data we can then do the following: add new data by
pushing onto the stack, use FIFO (First In First Out), use LIFO (Last In First Out), find the cur-
rent stack size and read, overwrite, insert or delete from the stack.
Dimension record tables are used to define the length of each record and the number of rec-
ords. We can then write and read these records. This is ideal for data acquisition projects.
Other instructions found in the table data processing instructions include searching, summing
and finding minimum and maximum values.
We will be looking at these instructions in the Omron CP1H PLC. Examples of the instructions
will be presented.

Previously in this CP1H series we have discussed:


System Hardware
CX-Programmer
Establishing Communication
Setting, Forcing and Online Editing
Numbering Systems and Addressing
Timers
Counters
Data Movement
Compare Instructions
Data Shifting Instructions
Math Instructions
Data Conversion Instructions
Program Control Instructions

Several different table data processing instructions are available in the CP1H. A full explana-
tion can be obtained by using the help menu in the CX-Programmer software or the Program-
ming Manual for the CP1H. Links are provided at the end of this post.
Instructions can have different variations.
Let’s look at when this instruction will execute:
SSET(630) when used will be scanned and executed every cycle of the PLC that the input con-
dition is on.
@ SSET(630) when used will be executed when the input condition turns from off to on. This
will trigger the instruction to happen only once.
Please refer to the programming manual or help file in CX-Programmer for different varia-
tions of the instructions that you want to use. We will now go over some of the table data pro-
cessing instructions in the Omron CP1H. This will give you a general idea of the instructions
available.
Table Data Processing Instructions

This list gives you all of the table data processing instructions in the CP1H. All of the instruc-
tions will work with a group of consecutive memory areas that we will call a table. Let’s look at
these instructions.

SET STACK: SSET(630)

This instruction will initialize and establish a stack. This is a group of addresses (consecutive)
that will contain data.
The first two registers contain the memory location for the last word in the stack. The stack
pointer is in the following two memory locations. When we first initialize this instruction, the
value will be TB+4.
We can now use additional commands to work with this group of data. (Stack)

PUSH ONTO STACK: PUSH(632)

The push instruction will write one word of data to the specified stack. The stack pointer will
be incremented by one.
In this example we are specifying our stack that we defined at D0. We are writing the value at
D20 into the stack and then increment the stack pointer by one.

FIRST IN FIRST OUT: FIFO(633)

The first in first out instruction moves the first data in the stack (Oldest Data) to the destina-
tion location. The stack pointer will be decremented by one. All of the stack information will
get moved in the stack back one address.
LAST IN FIRST OUT: LIFO(634)

The last in first out instruction will move the last data in the stack (Newest Data) to the desti-
nation location. The stack pointer will be decremented by one. The data will not be erased that
is moved until the next piece of data is pushed onto the stack. (The pointer will point to this old
data and erase it by copying over it.)
DIMENSION RECORD TABLE: DIM(631)

This instruction is used to define a customized record table. We do this by declaring the length
of each record and the number of records for the table. 16 record tables can be programmed.
We use this instruction to simplify the calculation of addresses in a data table. The table is usu-
ally a collection of specific data for a machine. An example would be a recipe for temperature,
pressures, etc.
SET RECORD LOCATION: SETR(635)

This instructions will write the location of the specified record in the Index Register. (,IR) Re-
member that the index registers act as pointers to get or retrieve information in the PLC. You
must immediately use this information before another instruction sets different information
in the IR word.
GET RECORD NUMBER: GETR(636)

The instruction will return the record number of the record at the PLC memory address con-
tained in the specified index register. (,IR)
DATA SEARCH: SRCH(181)

The SRCH will look for specific data within a specified range. It will then set the index register
to the location that it finds the first matched data.

The control word is used to establish how many words to search.


In this example we are seaching for the value 1234 in the first 100 words of data starting at
D0. The result location is then loaded into IR0. We then use this to move the value into D302.

SWAP BYTES: SWAP(637)

Usually when we are dealing with communication to another device and sharing information,
this is done on a byte level. (8 bits) The PLC is usually working with 16 bit words at a time. In-
formation such as numbers can mix around the bytes in the word. This instruction switches
the leftmost and rightmost bytes in all of the words in the range.

Full-stack monitoring for


container & cloud
environments powered by AI
Ad Dynatrace

Sign Up

FIND MAXIMUM: MAX(182)

This instruction will find the maximum value of a word in the specified range.
The instruction uses a control word to specify the number of words to look in the range and
the type of data. The location of the maximum value can be then transferred to the IR0.
Build sleek UI fast with
Telerik DevCraft
Ad .NET and JS components and tools
to build high-performant apps on any …
Progress Telerik

Download

FIND MINIMUM: MIN(183)

This instruction will find the minimum value in the specified range.

Just like the maximum instruction, this uses a control word. We specify the number of words
to search and indicate if the location address is set in IR0.

ServiceDesk Plus is a
Game Changing IT Service
Desk Software that is Easy …
Ad ManageEngine/SDP

Learn more

SUM: SUM(184)

The bytes or words in the specified range will be added and the result will be written to two
words.
This in-

struction will use a control word to specify the table length and type of data to add.

FRAME CHECKSUM: FCS(180)

This instruction calculates the FCS value for the specified range and outputs the result in
ASCII. Serial communication will utilize this calculation to determine if the message has not
lost any information from when it was sent to when it is received. See the following post: How
to implement the Omron Host Link Protocol (VB.net) for a demonstration on how the FCS is
used in transmission.

A control word is used in the instruction to indicate how many words/bytes are in the range. If
bytes are specified, then you can also indicate the starting byte in each word. (Leftmost or
Rightmost)
STACK SIZE READ: SNUM(638)
We now return to the stack that we first looked at in this post. The following five instructions
will also manipulate the information on the stack that was set.

This instruction will count the amount of stack data (number of words) in the specified stack.
You can calculate this by the beginning of the stack (TB+4) – Stack pointer position -1.
STACK DATA READ: SREAD(639)

This instruction reads the data from the specified data element in the stack. The offset value
indicates the location of the desired data element (how many data elements before the cur-
rent pointer position).
STACK DATA OVERWRITE: SWRIT(640)

This instruction writes the source data to the specified data element in the stack (overwriting
the existing data). The offset value indicates the location of the desired data element (how
many data elements before the current pointer position).

STACK DATA INSERT: SINS(641)

Inserts the source data at the specified location in the stack and shifts the rest of the data in
the stack downward. The offset value indicates the location of the desired data element (how
many data elements before the current pointer position).

STACK DATA DELETE: SDEL(642)

Deletes the data element at the specified location in the stack, outputs that data to the speci-
fied destination word, and shifts the remaining the data in the stack upward. The offset value
indicates the location of the desired data element (how many data elements before the cur-
rent pointer position).
You can see that we have many different table data instructions in the Omron CP1H. This
should give you a good idea of what is possible.

See the YouTube video below on table data processing instructions in the Omron CP1H PLC.

The following is a list of manuals associated with the CP1H programmable logic controller. See
the descriptions for each of these manuals in the first post: Omron CP1H System Hardware
W450 – SYSMAC CP Series CP1H CPU Unit Operation Manual
W451 – SYSMAC CP Series CP1H CPU Unit Programming Manual
W342 – SYSMAC CS/CJ series Communications Commands Reference Manual
W446 – SYSMAC CX-Programmer Ver. 6.1 Operation Manual
W447 – SYSMAC CX-Programmer Ver. 6.1 Operation Manual Function Blocks
W444 – CX-One FA Integrated Tool Package Setup Manual
W445 – CX-Integrator Operation Manual
W344 – CX-Protocol Operation Manual

You can download the PLC program as discussed above here.

Next time we will look at data control instructions in the Omron CP1H PLC.

Watch on YouTube : Omron CP1H Table Data Instructions

If you have any questions or need further information please contact me.
Thank you,
Garry
Free Clover Omron CP1H This Could Be Omron CP1H
Station 2018 Data Huge Compare
Movement Instructions
Ad TouchSuite accautomation.ca Ad Decentric accautomation.ca

Limited Time Omron CP1H omron plc Omron CP1H


Electronics Math training online Program
Instructions free Control...
Ad liquidation.com accautomation.ca accautomation.ca accautomation.ca

If you’re like most of my readers, you’re committed to learning about technology. Numbering
systems used in PLC’s are not difficult to learn and understand. We will walk through the num-
bering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating
Point.

To get this free article, subscribe to my free email newsletter.

First Name:

Your first name


Last Name:

Your last name


Email address:

Your email address

SIGN UP

Use the information to inform other people how numbering systems work. Sign up now.
The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is in-
cluded when you subscribe to ACC Automation.

AdChoices

PLC Programming Software

Software Automation

Instruction Manuals

Computer for Software

Is Database a Software

ACC AUTOMATION CP1 PLC CP1E CP1H CP1H SSET STACK CP1L HOW DOES A PLC WORK

OMRON OMRON AUTOMATION OMRON CP1H OMRON CP1H MANUAL

OMRON CP1H PROGRAMMING MANUAL OMRON CP1H SYSTEM HARDWARE

OMRON CP1H TABLE DATA INSTRUCTIONS OMRON ELECTRONICS OMRON PLC SERIES

OMRON PLC STACK OMRON PLC TRAINING ONLINE FREE PLC BASICS TRAINING PLC BASICS TUTORIAL

PLC PROGRAMMING ONLINE TUTORIAL PLC TRAINING FOR BEGINNERS PLC TRAINING ONLINE

STACK INSTRUCTIONS STACK OMRON

You might also like