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.

New Here? Please read this important info!!!


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

Reply
 
Thread Tools Display Modes
Old July 28th, 2021, 07:28 PM   #16
JaxGTO
Member
United States

JaxGTO is offline
 
Join Date: Apr 2009
Location: Kalieefornia
Posts: 926
Call me simple minded but what wrong with:
XIC bit 3 OTE bit0

XIC bit 4 OTE bit1
...
XIC bit 12 OTE bit9
__________________
I have to use Rockwell Software!
  Reply With Quote
Old July 28th, 2021, 07:50 PM   #17
TheWaterboy
Lifetime Supporting Member + Moderator
United States

TheWaterboy is offline
 
TheWaterboy's Avatar
 
Join Date: May 2006
Location: State of Denial
Posts: 1,212
Jax.... That would be the simplest... LOL. And not a bad idea.
  Reply With Quote
Old July 28th, 2021, 09:02 PM   #18
drbitboy
Lifetime Supporting Member
United States

drbitboy is online now
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 3,336
Same idea, general purpose:

yyy.png
__________________
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
  Reply With Quote
Old July 28th, 2021, 10:36 PM   #19
koyeap
Member
Malaysia

koyeap is offline
 
Join Date: Feb 2013
Location: Selangor
Posts: 17
a dummy way to do this is create an AOI with 10 boolean input, and 1 int output:

in the AOI,
1) convert all 10 bool input to int using mov function (bool to int)
2) after conversion, bit 0 mul by 1, bit 1 mul by 2, bit 2 mul by 4......bit 9 mul by 512
3) sum all the result together and pass to int output

you can then map your bit 0-1, or bit 3-12 on the AOI, example if the AOI input bit0 and 1 both on, 1x1 + 1x2 you will get int value of 3, lets say if AOI all input is on, you will get 1x1 + 1x2 + 1x4 +......1x512 = 1024

Hope this help
  Reply With Quote
Old July 28th, 2021, 10:47 PM   #20
OkiePC
Lifetime Supporting Member
United States

OkiePC is offline
 
OkiePC's Avatar
 
Join Date: Mar 2005
Location: ENE of Nowhere Oklahoma
Posts: 11,100
There are no AOIs in a 1400, but you could shoehorn in something similar to one and make it nice and ugly and confusing.

I would do the brute force method JaxGTO described, but I am a brute force kind of guy. No need to get cute just for sake of "elegance".

Just use a BFH, and nail the bits where you want them, one by one with much greater efficiency that anything with a loop.
__________________
You've been taken, but you don't know it yet.
  Reply With Quote
Old July 29th, 2021, 12:02 AM   #21
drbitboy
Lifetime Supporting Member
United States

drbitboy is online now
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 3,336
Quote:
Originally Posted by OkiePC View Post
I would do the brute force method JaxGTO described, but I am a brute force kind of guy. No need to get cute just for sake of "elegance".
Even that loop approach was fuglier than I'd hoped for, and on top of that in a 1400 each "caller" would need to move things in and out of the N255 file "arguments," etc.


So yah, I agree, no point trying to put lipstick on the pig.


That said, for bit ranges that don't touch the sign bit e.g. ten bits 3-12:
AND srcint 8184 dstint
DIV dstint 8 dstint
Cleaner than brute force XIC/OTE; possibly faster per scan but not enough to matter (lose ~1.5μs on instructions; gain maybe 4-8μs for fewer rungs).
__________________
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
  Reply With Quote
Old July 29th, 2021, 06:07 AM   #22
parky
Member
United Kingdom

parky is offline
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 3,428
Here is a simple one, just and & shift.
Note: the way this works with the shift is it works on the same variable so the AND function for the bits 3-12 the result is shown as the result of the shift it's just the way it works, rather than shift & store it into another variable it works on the source variable.
Rung 1 just masks bits 0-1
Rung 2 masks the bits 3-12
Rung 3 shifts the 3-12 to 0-9
Attached Images
File Type: png Masked move equv.png (42.8 KB, 30 views)
  Reply With Quote
Old July 29th, 2021, 01:36 PM   #23
TheWaterboy
Lifetime Supporting Member + Moderator
United States

TheWaterboy is offline
 
TheWaterboy's Avatar
 
Join Date: May 2006
Location: State of Denial
Posts: 1,212
Mapped them using XIC OTE and that works fine. Thanks for the help guys.
  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
Alternating Messages donl517 LIVE PLC Questions And Answers 8 February 28th, 2012 08:45 AM
Setting up a Program with PID parameters and Analog Signals BHazen LIVE PLC Questions And Answers 4 December 29th, 2011 05:44 PM
turning off a pid loop jimbom LIVE PLC Questions And Answers 11 December 6th, 2009 03:42 PM
Trying to split Double Word in S7 uptown47 LIVE PLC Questions And Answers 11 May 14th, 2008 04:29 PM
Splitting Integers into 2 bytes (decimal to Hex?) Altair LIVE PLC Questions And Answers 8 February 26th, 2003 12:31 PM


All times are GMT -4. The time now is 05:21 PM.


.