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 August 12th, 2017, 11:22 AM   #1
Jeppe666
Lifetime Supporting Member
United States

Jeppe666 is offline
 
Join Date: Jun 2008
Location: Florida
Posts: 11
Cool SoMachine datatype question on negative number

Hello,

Background with PL7 and just started with SoMacine 4.2 Logicbuilder.

I have Modbus Slave reading an analog value into a Word. All works great as long the value is positive (0-100) - however once reading is negative (-1...-100) value acts as a unsigned integer. -1 shows up as 65535, -2 as 65534 etc.

I see what is happening, but cant seem to get datatype conversion correct and then scaled with a division of 10 (see attached).

Quite sure this is a newbie thing, but does anyone have a pointer as to what I do wrong? Also, CFC is new for me so fumbling a bit in the darkness

Tia,
JP
Attached Images
File Type: jpg Type_Convertion_attempt.JPG (21.9 KB, 27 views)
  Reply With Quote
Old August 13th, 2017, 05:20 PM   #2
Jeppe666
Lifetime Supporting Member
United States

Jeppe666 is offline
 
Join Date: Jun 2008
Location: Florida
Posts: 11
Took it one step further

Made it a little further (attached) - hope my question makes better sense now.
Attached Images
File Type: jpg Demo2.jpg (40.0 KB, 18 views)
  Reply With Quote
Old August 13th, 2017, 06:25 PM   #3
labeledas
Member
Canada

labeledas is offline
 
labeledas's Avatar
 
Join Date: Apr 2010
Location: Peace River Alberta
Posts: 524
What value are you expecting and what is the original data size 16 bit 32 bit
  Reply With Quote
Old August 13th, 2017, 06:29 PM   #4
labeledas
Member
Canada

labeledas is offline
 
labeledas's Avatar
 
Join Date: Apr 2010
Location: Peace River Alberta
Posts: 524
Also if you are looking for the non truncated div result you will need to make the data type for sdm1_scaled real
  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
A little question about S7 IEC timers. JesperMP LIVE PLC Questions And Answers 5 December 10th, 2016 12:51 PM
[:ol Negative number nightmare! titoyabril LIVE PLC Questions And Answers 4 August 9th, 2008 12:15 AM
Howto read serial number of CLX 1756-L61? oldnewbee LIVE PLC Questions And Answers 9 June 18th, 2008 08:46 AM
(Another) Conveyor question Vuli LIVE PLC Questions And Answers 11 April 29th, 2006 02:00 PM
Philosophical Illusion? Terry Woods LIVE PLC Questions And Answers 71 June 28th, 2004 07:41 AM


All times are GMT -5. The time now is 05:29 AM.


.