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 January 11th, 2018, 10:01 AM   #1
Run_PLC
Member
United States

Run_PLC is offline
 
Join Date: Jan 2018
Location: North Carolina
Posts: 3
SQO array: negative element values to destination

I am new to PLC programming, so maybe this is a no brainer:

I am using a DINT array with a negative value of -34000 as one of the elements in an SQO. The destination is another DINT (it works fine when negative values are entered either manually to the DINT or by a MOV). However, the SQO outputs a different positive value into the destination DINT when that step is called.

This is on RSLogix5000 with a compactlogix PLC, advice on how to do this correctly or any workarounds for the same effect would be much appreciated.
  Reply With Quote
Old January 11th, 2018, 10:16 AM   #2
Mike_RH
Lifetime Supporting Member
Canada

Mike_RH is offline
 
Join Date: Sep 2006
Location: Toronto
Posts: 881
What is the value of the mask in the SQO? If you are transferring the entire DINT, all the mask bits should be a 1.
__________________
Mike
  Reply With Quote
Old January 11th, 2018, 10:22 AM   #3
Run_PLC
Member
United States

Run_PLC is offline
 
Join Date: Jan 2018
Location: North Carolina
Posts: 3
I entered it in hex format as 16#FFFF so all bits should be going through, correct? I will change to all 1's in decimal format just to check

Thanks
  Reply With Quote
Old January 11th, 2018, 10:26 AM   #4
James Mcquade
Member
United States

James Mcquade is offline
 
Join Date: Oct 2007
Location: Tennessee
Posts: 2,209
Welcome to the forum.

the negative sign is dealing with the sign bit of the word.
I think you have to do a 2's complement of the word to make it work out.
please note I said "I THINK" and I could very well be wrong.

may I suggest that you write down on paper your don't word.
then look at it in binary and write it down in binary.
then do the 2's complement and compare it against what you really want.

I have had this issue before with other ab processors in the past.
different software revs and firmware revs made me rethink the program and rewrite the logic.

james
  Reply With Quote
Old January 11th, 2018, 10:45 AM   #5
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 4,380
Quote:
Originally Posted by Run_PLC View Post
I entered it in hex format as 16#FFFF so all bits should be going through, correct? I will change to all 1's in decimal format just to check

Thanks
16#FFFF is only 16 bits, you need 32

Try 16#FFFF_FFFF or just -1 (decimal)
Attached Images
File Type: jpg 2018-01-11_164646.jpg (16.8 KB, 24 views)
__________________
___________________________
ControlLogix & SLC Training
a-b train ltd.
abtrain@tiscali.co.uk
www.abtrain.co.uk
tel: 07506 73 9999
nil illegitimi carborundem


  Reply With Quote
Old January 11th, 2018, 12:20 PM   #6
Run_PLC
Member
United States

Run_PLC is offline
 
Join Date: Jan 2018
Location: North Carolina
Posts: 3
Quote:
Originally Posted by daba View Post
16#FFFF is only 16 bits, you need 32

Try 16#FFFF_FFFF or just -1 (decimal)
Makes sense because of the DINT. I tried 16#ffff_ffff and it worked correctly. Thanks everyone for your help!
  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
Loading .Pre in an array of timers? dginbuffalo LIVE PLC Questions And Answers 24 March 11th, 2016 05:44 PM
Sequencers randy LIVE PLC Questions And Answers 43 December 20th, 2014 02:10 PM
STEP7 Array initial values. JesperMP LIVE PLC Questions And Answers 9 April 17th, 2007 06:32 AM
Sequencer Exercise Problem skingusmc LIVE PLC Questions And Answers 27 July 18th, 2006 07:28 PM
Building an S7 Array Move Questions DesertDog LIVE PLC Questions And Answers 19 June 17th, 2004 09:51 AM


All times are GMT -5. The time now is 11:24 PM.


.