double-word to single-word

saf1zweh5

Member
Join Date
Nov 2010
Location
Kay Eel
Posts
14
Hello everybody...Im using IDEC PLC and. I have a problem with single-word and double-word issue.

example: when im using Multiply (Word) instruction
2475 (Source1) x 100 (Source2) = 247500 (Data1) (all are data registers)

Then use a divide(Word) instruction for value 247500. The problem is, in divide instruction the value of Data1 is not 247500, it shows 50892.

example: 50892(Data1) / 10000 = 5
so how can i get the value --> 247500 / 10000 = 24 ?

please anybody help me...
 
Looking at the numbers should give you a clue as to what is wrong.

If you remove the high word of the 247500 you are left with 50892. More than likley you are looking at only the low word of the result but other things can be wrong. Look to be sure that the divide's data type is correct (Double, Long, Float), or be sure you're not overwritting the high word's address, etc.

Use the custom monitor in WinLDR to verify your results.

Good luck

Ken
 
Another possible method could be to do the divide first, then do the multiply, that way would stop your answer exceeding single word size, BUT it may create other problems if exact accuracy is required.
 

Similar Topics

Hi! I am using a TM200CE40T PLC from Schneider to write data over Modbus. I have used Memory words (%MW) before using the Write variable...
Replies
1
Views
533
Hi, I am currently reading a Modbus value from a Device, through TCP, going into our 400 series plc. The Modbus value is a real value, and it is...
Replies
27
Views
7,593
Hello How to convert dword to bit in Siemens plc s7؟ Thank you
Replies
15
Views
2,798
Hi, In Proficy Historian I have a tag connected with Double Integer / DWord configuration. In the PLC it is a Time format. Can that be a problem...
Replies
0
Views
1,206
Hello Everyone, I am working in Automation Builder software and PLC is PM554-ETH. I am doing communication over Modbus-TCP...
Replies
2
Views
3,273
Back
Top Bottom