Jump to content

Recommended Posts

Posted

I have been trying this for two days and am getting nowhere,

My string array looks like this . . . 

BCData.Data[0]  currently equals 5

When Copied to a string that string value equals '6828$r$00$00$00$00$00$00$00$00

Why is it not simply copying the 5 that is located in that element

Posted

The default STRING datatype in ControlLogix consists of a 32-bit DINT that represents the Length, and a SINT[82] array that represents the data, one character at a time.

In your case it sounds like you have BCData.Data[0] that holds the Length (but it's only 8 bits), then BCData.Data[1],[2],[3],[4] that holds the letters "6 8 2 8".    The last character is shown as "$r" which is shorthand for 0x0D = 13 = Carriage Return.

The easiest way to handle this would be to use a MOV instruction to move the BCData.Data[0] value to the StringTag.LEN tag.     Use the MOV because it automatically converts from SINT to DINT and it's easy to understand.

Then perform a COP instruction, with the Source = BCData.Data[1] and the destination StringTag.Data[0].   Make the Length of the COPY the number of target elements (SINTs), so use StringTag.LEN as the Length.    If you don't want the carriage return on the end, subtract 1.

 

 

Posted

Hello, in this example, would we be able to use BCData.LEN as the length in the COP instruction? or would it need to be the StringTag.LEN? I am experiencing a similar issue where I am trying to move the barcode scanner data from a Zebra EA3600 scanner to a string but am occasionally copying a value of "$00$00..." over instead. 

 

Posted

Welcome to the MrPLC forum community !

In that case in 2018, there was no "BCData.LEN" element because BCDData was a SINT[8].   So that's not really a question i can answer.

Ideally, create a new thread and provide some details about your application.

Because some modern ControlLogix firmware has changed the way that COP instructions handle dissimilar-typed sources and destinations, please post your firmware revisions too.

When using barcode readers, the function that indicates that new data is present is important.   Sometimes it's a handshake, sometimes an incrementing identfier, etc.  

 

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...