![]() ![]() ![]() ![]() ![]() ![]() |
||
![]() |
||
![]() ![]() ![]() ![]() This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
![]()
|
New Here? Please read this important info!!!
![]() |
#1 |
Member
![]() ![]() 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. |
![]() |
![]() |
#2 | |
Lifetime Supporting Member + Moderator
|
Quote:
__________________
___________________________ ![]() 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. |
|
![]() |
![]() |
#3 |
Member
![]() ![]() Join Date: Apr 2009
Location: Kalieefornia
Posts: 561
|
I remember the << is a bit shift left
|
![]() |
![]() |
#4 | |
Member
![]() ![]() Join Date: Oct 2017
Location: Lynnwood, WA
Posts: 3
|
Quote:
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? |
|
![]() |
![]() |
#5 | |
Lifetime Supporting Member + Moderator
|
Quote:
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
__________________
___________________________ ![]() 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. |
|
![]() |
![]() |
#6 |
Lifetime Supporting Member + Moderator
|
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.....
__________________
___________________________ ![]() 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. |
![]() |
![]() |
#7 | |
Member
![]() ![]() Join Date: Oct 2017
Location: Lynnwood, WA
Posts: 3
|
Quote:
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). |
|
![]() |
![]() |
#8 | |
Lifetime Supporting Member + Moderator
|
Quote:
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 !!
__________________
___________________________ ![]() 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. |
|
![]() |
![]() |
Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
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 |