Productivity 1000 PLC Data Handling Part 2

Data handling instructions are used to perform movement and manipulations of the memory in the programmable logic controller. The Productivity 1000 Series PLC has fifteen different data handling instructions that can be used in a wide variety of applications. In this second part we will be looking at the following instructions:
Lookup Table (LKUP) – Find a value within an XY Table by looking at the intercept of a referenced X Axis value and Y-Axis value.
Pack Bits (PKB) – Convert up to 32 Boolean Tag Bits or Constant Bits into an Output Integer Tag.
Pack Word (PKW) – Convert up to four 8 bit tags or two 16 bit tags, or four Constants into a 16 or 32 bit Destination Tag.
Shift / Rotate Bits (SFR) – Shift or Rotate Bits of a Tag or Constant value.
Sign Magnitude (SMAG) – Convert Sign Plus Magnitude data type values to 2’s Complement or Convert 2’s Complement data type values to Sign Plus Magnitude.
UnPack Bits (UPKB) – Convert up to a 32 Bit Integer Tag or Constant into Boolean Tags.
UnPack Word (UPKW) – Convert one 32 bit or 16 bit source tag into four 8 bit tags or two 16 bit tags.
A review of data handling instructions part 1 can be found here. Here is a link to the video.
Let’s get started with the Productivity 1000 Series PLC data handling instructions part 2.

Previously in this Productivity 1000 series PLC, we have discussed:
System HardwareVideo
Installing the SoftwareVideo
Establishing CommunicationVideo
First ProgramVideo
Documenting the ProgramVideo
Monitoring and Testing the ProgramVideo
Online Editing and Debug ModeVideo
Numbering Systems and Tag DatabaseVideo
Contact and Coil InstructionsVideo
Timer InstructionsVideo
Counter InstructionsVideo
Math InstructionsVideo
Data Handling Instructions Part 1Video

Lookup Table (LKUP) – Productivity Data Handling 

This instruction will find a value within an XY Table. It will look at the intercept of a referenced X Axis value and Y-Axis value.
Productivity 1000 Series PLC Data Handling Instructions Part 2
We will use a structure named Lookup_Table. This will set up our inputs XKey, YKey, and our output Output.
Productivity 1000 Series PLC Data Handling Instructions Part 2
Then the number of X references will be 5 and the number of Y references will be 10. This will give us a grid shown above. We now enter the data in the table.
Productivity 1000 Series PLC Data Handling Instructions Part 2
We can now define the tags for Lookup_Table. Make XKey and YKey retentive with an initial value of 60 each.
Productivity 1000 Series PLC Data Handling Instructions Part 2
When Switch1 is on the data handling lookup table instruction will take the XKey and YKey inputs and send the corresponding value based on the table specified to the Output.

Pack Bits (PKB) – Productivity Data Handling 

This instruction will convert up to 32 Boolean Tag Bits or Constant Bits into an Output Integer Tag.
Productivity 1000 Series PLC Data Handling Instructions Part 2
We will specify tag Pack_Bits_Out. Using the eight switches on our input card we will send the value to the Pack_Bits_Out tag.
Productivity 1000 Series PLC Data Handling Instructions Part 2
Select OK.
Productivity 1000 Series PLC Data Handling Instructions Part 2
Select OK
Productivity 1000 Series PLC Data Handling Instructions Part 2
When Switch2 is on the first eight switches will be converted into the Pack_Bits_Out flag on our data handling instruction.

Pack Word (PKW) – Productivity Data Handling 

This instruction will convert up to four 8 bit tags or two 16 bit tags, or four Constants into a 16 or 32-bit Destination Tag.
Productivity 1000 Series PLC Data Handling Instructions Part 2
We will use the structure name Pack_Word and specify Byte (8-bit) to Word (16-bit)
Productivity 1000 Series PLC Data Handling Instructions Part 2
Select OK
Productivity 1000 Series PLC Data Handling Instructions Part 2
Productivity 1000 Series PLC Data Handling Instructions Part 2
We will set Positions 1 and 2 as retentive with the initial values of 12 and 34 respectfully.

When Switch3 turns on the first 8 bits of Position 1 will be the least significant byte. The first 8 bits of Position 2 will be the most significant byte of the output.

Shift / Rotate Bits (SFR) – Productivity Data Handling 

This instruction will Shift or Rotate Bits of a Tag or Constant value.
P1000 P2000 P3000 Ladder Logic Programming Sample Code
We will call the structure Shift_Rotate. Select Rotate Left, Include Sign Bit and One-Shot.
P1000 P2000 P3000 Ladder Logic Programming Sample Code
Select OK.
P1000 P2000 P3000 Ladder Logic Programming Sample Code
Set the Input and Number to Shift/Rotate to retentive with the initial value of 1 each.
Select OK.
P1000 P2000 P3000 Ladder Logic Programming Sample Code
When Switch4 transitions from off to on the output will shift by 1 left. When the lost bit of the output is shifted it will rotate back to the first bit. This is a powerful data handling instruction on our Productivity Suite unit.
We have covered Shift Registers in previous posts. Here is a couple that will show you what can be done with rotating and shifting instructions.
PLC Programming Example Sorting StationVideoTesting Video
PLC Programming Example – Shift Register (Conveyor Reject)Video

Sign Magnitude (SMAG) – Productivity Data Handling 

This instruction will convert Sign Plus Magnitude data type values to 2’s Complement or Convert 2’s Complement data type values to Sign Plus Magnitude.
The following link is a good tutorial on signed binary numbering systems.
https://en.wikipedia.org/wiki/Signed_number_representations#Signed_magnitude_representationProductivity 1000 Series PLC Data Handling Instructions Part 2
We will use the structure name Sign_Mag_Out and select Sign magnitude to 2’s Complement.
Productivity 1000 Series PLC Data Handling Instructions Part 2
Select OK
Productivity 1000 Series PLC Data Handling Instructions Part 2
Make the Input memory retentive with an initial value of -200.
Productivity 1000 Series PLC Data Handling Instructions Part 2
When Switch5 is turned on the output will contain the sign-magnitude to 2’s complement of the Input number.

UnPack Bits (UPKB) – Productivity Data Handling 

This instruction will convert up to a 32 Bit Integer Tag or Constant into Boolean Tags.
Productivity 1000 Series PLC Data Handling Instructions Part 2
We will use the Pack_Bits_Out as the input to this instruction. This represents the 8 switches that we packed into the output. This instruction will do just the opposite. Our output will be Unpack_Bit:1 to 8.
Productivity 1000 Series PLC Data Handling Instructions Part 2
Select OK
Productivity 1000 Series PLC Data Handling Instructions Part 2
Select OK
Productivity 1000 Series PLC Data Handling Instructions Part 2
When Switch6 is turned on the input number will get broken out into bits. In our case, this represents the switches when we packed the input.

UnPack Word (UPKW) – Productivity Data Handling 

This instruction will convert one 32 bit or 16-bit source tag into four 8 bit tags or two 16 bit tags.
P1000 P2000 P3000 Ladder Logic Programming Sample Code
We will name the structure UnPack_Word. Select Word (16-bit) to Byte (8-bit).
P1000 P2000 P3000 Ladder Logic Programming Sample Code
Select OK.
P1000 P2000 P3000 Ladder Logic Programming Sample Code
Our input (Source) will be broken out into two 8 bit bytes of data.
P1000 P2000 P3000 Ladder Logic Programming Sample Code
Make the source memory retentive and set the initial value of it to 1234.
Select OK.
P1000 P2000 P3000 Ladder Logic Programming Sample Code
Switch7 when turned on will unpack the source into two bytes. This happens every scan as long as Switch7 is on. (The rung is true.)

Download the PLC program here.

Watch the video below to see the data handling instructions used in our Productivity 1000 Series PLC.

Productivity 1000 Series PLC from Automation Direct

Overview Link (Additional Information on the Unit)
Configuration (Configure and purchase a system – BOM)
User Manual and Inserts (Installation and Setup Guides)
Productivity Suite Programming Software (Free Download Link)
This software contains all of the instruction sets and help files for the Productivity Series.

Next time we will continue to look at the array functions in the Productivity 1000 Series PLC.

Watch on YouTube : Productivity 1000 Series PLC Data Handling Instructions Part 2


If you have any questions or need further information please contact me.
Thank you,
Garry



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 numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

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


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 included when you subscribe to ACC Automation.


Leave a Comment