Quote:
Originally Posted by cefisher15
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 07 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