View Single Post
Old October 12th, 2017, 02:32 AM   #5
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
daba's Avatar
Join Date: Jul 2004
Location: uk
Posts: 4,001
Originally Posted by cefisher15 View Post
daba, Unfortunately all I have access to is a PDF file of the code. Attached is an image of the input rung and the compute block. I013 has 16 bits, as far as I can tell, this compute block is concerned with bits 0-7 and 16. It looks like NUMST is an int.

I'll dig through my PDF to see if there's any variable maps, but I seem to have lost access rights to it, so it might take a while... if its not one thing, its another, am I right?
Working through it, bit by bit....

I:013{07..00} extracts the low 8 bits of the data in I:013, this seems to make sense going by the handwritten notes on the first picture - "Data"

I:013/16 will result in the data being "shifted" towards bit 0, by 4 bits (/2 will shift by one bit, /4 by 2, /8 by 3, and /16 by 5 bits). Then the <<8 will shift the above 8 bits to the left, putting what was labelled as "Index" into the upper 4 bits, bits 17..14, but it also duplicates the upper 4 bits of "Data" into bits 13..12, zeroes fill the lower 8 bits of this partial result.

After adding the partial results together, you get....

bits 17..14 = "Index"
bits 13..10 = upper 4 bits of "Data"
bits 07..04 = upper 4 bits of "Data"
bits 03..00 = lower 4 bits of "Data"

The picture shows the individual operations within the compute. You should look at this when you look at any other operations performed on CCO_NUMST
Attached Images
File Type: jpg 2017-10-12_082430.jpg (68.3 KB, 40 views)
ControlLogix & SLC Training
a-b train ltd.
tel: 07506 73 9999
nil illegitimi carborundem

Last edited by daba; October 12th, 2017 at 02:37 AM.
  Reply With Quote