Industrial Automation
Industrial Automation | Europe

myKnowledge

Main > Product Type > Software > Programming
Minimize Text   Default    Enlarge Text
 

Print
E-mail

Example Function Block To Shift Buffer And Insert Data


Introduction
Sometimes it is necessary to byte shift data right by one byte to insert a new byte at the head of a buffer. This could be for strings or data. However the current PLC shift instructions don't enable this function easily as data is often byte swapped in a word.

The attached sample CX-Programmer file includes a Function Block (FB) which allows users to shift a 'buffer' of data by one byte. The FB also inserts a new byte at the head of the buffer.

Example

Data in 'buffer' before shift.

1122 3344 5566 7788       

Data in 'buffer' after shift (assuming that new byte to insert at head is 0x99)

9911 2233 4455 6677 88  
 

 

Note: The Function Block is written for CJ1/CS1 V4.x CPU's or CJ2 V1.x

 



Attachments



Comments (View All Comments / Add Comment)

Related Articles
No related articles found.
Created 2010-03-17
Modified 2010-04-21
Views 9247

 

You are not logged in.