You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old October 10th, 2017, 01:08 PM   #1
cefisher15
Member
United States

cefisher15 is offline
 
Join Date: Oct 2017
Location: Lynnwood, WA
Posts: 3
PLC-5/250 Compute Expression

I've got a print-out of old code (PLC-5/250) that I am trying to decipher. I am hung up on an expression in one of the compute blocks. The block parameters are as follows:

COMPUTE
Dest: NUMST
Expression: I:013{07..00}+(I:013/16<<8)

Can anyone please help me understand what this expression is saying? I can take a picture of the rung if it will help, but that is all of the info from the block.
  Reply With Quote
Old October 10th, 2017, 06:51 PM   #2
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 3,950
Quote:
Originally Posted by cefisher15 View Post
I've got a print-out of old code (PLC-5/250) that I am trying to decipher. I am hung up on an expression in one of the compute blocks. The block parameters are as follows:

COMPUTE
Dest: NUMST
Expression: I:013{07..00}+(I:013/16<<8)

Can anyone please help me understand what this expression is saying? I can take a picture of the rung if it will help, but that is all of the info from the block.
I think I have deciphered it, and to be fair it looks a strange one, but to be absolutely sure can you show the bit patterns of I:013 and NUMST after the compute has been executed.
__________________
___________________________
ControlLogix & SLC Training
a-b train ltd.
abtrain@tiscali.co.uk
www.abtrain.co.uk
tel: 07506 73 9999
nil illegitimi carborundem



Last edited by daba; October 10th, 2017 at 06:53 PM.
  Reply With Quote
Old October 10th, 2017, 11:36 PM   #3
JaxGTO
Member
United States

JaxGTO is offline
 
Join Date: Apr 2009
Location: Kalieefornia
Posts: 515
I remember the << is a bit shift left
  Reply With Quote
Old October 11th, 2017, 10:03 AM   #4
cefisher15
Member
United States

cefisher15 is offline
 
Join Date: Oct 2017
Location: Lynnwood, WA
Posts: 3
Quote:
Originally Posted by daba View Post
I think I have deciphered it, and to be fair it looks a strange one, but to be absolutely sure can you show the bit patterns of I:013 and NUMST after the compute has been executed.
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?
Attached Images
File Type: jpg IMG_20171011_075023421.jpg (17.4 KB, 14 views)
File Type: jpg IMG_20171011_075454443.jpg (26.1 KB, 14 views)
  Reply With Quote
Old October 12th, 2017, 02:32 AM   #5
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 3,950
Quote:
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, 38 views)
__________________
___________________________
ControlLogix & SLC Training
a-b train ltd.
abtrain@tiscali.co.uk
www.abtrain.co.uk
tel: 07506 73 9999
nil illegitimi carborundem



Last edited by daba; October 12th, 2017 at 02:37 AM.
  Reply With Quote
Old October 12th, 2017, 09:57 AM   #6
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 3,950
I've just had the thought that the "/" in I:013/16 might be a bit address, not a "divide by".

It's been such a long since I looked at any PLC5/250 code that I can't remember... "Divide by" might be "|" (pipe).

PLC5/250 (Pyramid Integrator) was programmed using the very old 6200 software, I don't know if it ever made it into RSLogix5.

Anyway, if it is a bit designation, it looks like the latter part of the compute "pulls" bits 06..00 up to bits 16..10

Or, the "<<" bit shift might be circular within the destination, so it might be putting bit 16 only into bit 6 location

See if those ideas make any sense.....
__________________
___________________________
ControlLogix & SLC Training
a-b train ltd.
abtrain@tiscali.co.uk
www.abtrain.co.uk
tel: 07506 73 9999
nil illegitimi carborundem



Last edited by daba; October 12th, 2017 at 09:59 AM.
  Reply With Quote
Old October 12th, 2017, 11:33 AM   #7
cefisher15
Member
United States

cefisher15 is offline
 
Join Date: Oct 2017
Location: Lynnwood, WA
Posts: 3
Quote:
Originally Posted by daba View Post
I've just had the thought that the "/" in I:013/16 might be a bit address, not a "divide by".

It's been such a long since I looked at any PLC5/250 code that I can't remember... "Divide by" might be "|" (pipe).

PLC5/250 (Pyramid Integrator) was programmed using the very old 6200 software, I don't know if it ever made it into RSLogix5.

Anyway, if it is a bit designation, it looks like the latter part of the compute "pulls" bits 06..00 up to bits 16..10

Or, the "<<" bit shift might be circular within the destination, so it might be putting bit 16 only into bit 6 location

See if those ideas make any sense.....
Daba,

Thank you for your help! Looking at the other rungs of code, I agree that the"/" is a bit address. Taking into consideration your remarks, and what I know about the expected values of NUMST, I think the expression is basically concatenating bit 16 with bits 0-7 to make a 9-bit binary representation of a number, then storing the decimal equivalent in NUMST (see attached).
Attached Images
File Type: png Capture.PNG (7.9 KB, 20 views)
  Reply With Quote
Old October 12th, 2017, 12:02 PM   #8
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 3,950
Quote:
Originally Posted by cefisher15 View Post
Daba,

Thank you for your help! Looking at the other rungs of code, I agree that the"/" is a bit address. Taking into consideration your remarks, and what I know about the expected values of NUMST, I think the expression is basically concatenating bit 16 with bits 0-7 to make a 9-bit binary representation of a number, then storing the decimal equivalent in NUMST (see attached).
Your attached image is what I was working towards with bit 16 being "rotated" left by 8 bits, but I think that it would end up in bit 6, not bit 10. In a 16-bit integer, with the bits octally addressed, bit 6 and 16 are 8 bits apart, whichever way you shift.

Perhaps the number constraints mean that it is creating a 7-bit number, with bit 6 being the sign bit ??? EDIT : I meant 7, not 9

Whatever way you look at it, it's a rare piece of programming, I'm sure there would be a better way to do, IF we could understand what it is trying to achieve !!
__________________
___________________________
ControlLogix & SLC Training
a-b train ltd.
abtrain@tiscali.co.uk
www.abtrain.co.uk
tel: 07506 73 9999
nil illegitimi carborundem



Last edited by daba; October 12th, 2017 at 12:39 PM.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
1756-L62S PLC Faulting when generating safety signature Kalagaraz LIVE PLC Questions And Answers 7 April 11th, 2017 07:45 AM
PLC to replace spark detection/suppression system in LP ducting, good idea or bad? SolarNinja LIVE PLC Questions And Answers 17 January 7th, 2017 11:03 PM
Plc suggestion aec LIVE PLC Questions And Answers 36 January 2nd, 2012 01:56 AM
PC to PLC Protocol TheRixta LIVE PLC Questions And Answers 13 December 17th, 2008 12:56 PM
PLC 5 Compute analog scstroud LIVE PLC Questions And Answers 6 September 26th, 2008 03:57 PM


All times are GMT -5. The time now is 10:02 AM.


.