floating point to BCD for OMRON C200HG - HELP!!!

morzian

Member
Join Date
Dec 2002
Posts
10
Dear All,

I’m looking for ways to convert floating point value to BCD for OMRON C200HG CPU43 PLC. From instruction reference of CX-Programmer, the command is not available for this PLC type. I am not able to display properly the result of FDIV calculation on touchscreen. Do you have any suggestions?

Thanks!!!
 
Have a good look at the thread chavak posted as a link. You will probably find all your questions answered there.

If you are innovative, you will probably find a way to do what you want. I had to find a way to display IEEE754 floating point on a screen from a C200HE some time ago. Took a lot of code but worked at the end of the day.
beerchug
 
A lot of fiddle and diddle. Most significant bit is sign, 8 bits for exponent, 23 bits for mantissa with assumed 1.
Read 8 bits to extract exponent and then activate a routine to turn the mantissa with assumed 1. into a real number.
Only ever did it once as I was caught away from home with a device that had this format. More carefull in future what I purchased. Numbers were not entirely accurate but were close enough to bluff my way out of the problem.
You can imagine how much processing power was used and how much ladder logic was required to get the result. A lot of move bits I can tell you. It was not elegant or, as I mentioned, entirely accurate but it did work, to a point. Fortunately, I did not have to be too accurate and knew what the figure would be 99% of the time. That certainly helped.

I do not even have the code anymore and have no desire to re-invent it. It belonged to the company for whom I used to work. They went broke and I was able to retain a lot of stuff but not all.
beerchug
 
Last edited:
Thank you all. I have read the links you've given.

I'm actually calculating PPH for a machine and display the value on an NT touchscreen. I get the data from a parts counter and seconds counter of "auto mode-running time" (double word). The rated machine speed is at 600 parts per hour. Before performing FDIV calculation, I already converted the data into floating point format by some mov and movd instructions. Because the result will still be on parts per second, i extracted the first 7 digit data (right to left) and perform multiplication to #3600 to get results in hour by MULL command. Below is the list of mycommands;

;DM275/276 - holds the counter value
;DM178/179 - holds the auto running time value
;DM230 - PPH display on touchscreen

a- PREPARING HR TO HOLD THE COUNTER VALUE IN FLOATING POINT
MOV #0000 HR6
MOV #7000 HR7

b- PREPARING HR TO HOLD THE TIMER VALUE IN FLOATING POINT
MOV #0000 HR8
MOV #7000 HR9

c- PUTTING THE COUNTER VALUE IN HR TO BE IN FLOATING POINT
MOVD DM276 #020 HR7
MOVD DM275 #030 HR6

d- PUTTING THE TIMER VALUE IN HR TO BE IN FLOATING POINT
MOVD DM179 #020 HR9
MOVD DM178 #030 HR8

e- PERFORMING THE FLOATING POINT DIVISION
FDIV HR6 HR8 DM277

f- EXTRACTING FIRST 7 DIGITS RESULTS FROM THE LEFT -MANTISSA
MOV #0000 DM280
MOVD DM278 #020 DM280
MOVD DM277 #030 DM279

g- PUTTING #3600 IN DOUBLE WORD FORMAT
MOV #0000 DM282
MOV #3600 DM281

h- PERFORMING DOUBLE WORD MULTIPLICATION
MULL DM279 DM281 DM290

i- EXTRACTING THE RESULT FOR DISPLAY IN TOUCHSCREEN
MOVD DM292 #110 DM230
MOVD DM291 #003 DM230


I used the above method for computing UTILIZATION and MACHINE AVAILABILITY and it works(for value less than 100%).

When applied in PPH formula, I can actually get the right value but only for PPH 360 and above. Below 360, I got the wrong amount because the way FDIV result in step e have changed.

If PPH = 360 to 600
360/3600 = .1 = 01000000
600/3600 = .1666667 = 01666667

If PPH = 359 and below, say 350
350/3600 = .0972222 = 99722222
the leftmost digit 9 = 1001, which means(1001 ) 1 decimal point to the left (1 001)

The error now comes in because of my step-f.

DO YOU HAVE SUGGESTIONS HOW TO GO ABOUT WITH THIS PROBLEM???
 

Similar Topics

I need to check an axis actual travel position, and to compare it to the master travel position. To do this I have to multiply the axis travel...
Replies
6
Views
2,562
We have AOIs for projects, which handle material dosing (by hand or by pipes and pumps), obviously they have comparison between setpoint and...
Replies
50
Views
14,207
Hi eveyone. I need transfer signal from system 1 to DCS via modbus. System 1 only can send 32 bit floating point. DCS receive 16 bit integer. How...
Replies
20
Views
10,601
Hi, In my ladder logic, I've got a data register D60 whose value is -0.001 (when using monitor mode to see values). D406 is 0.250. But then...
Replies
5
Views
1,307
Hi, can anybody tell that how can we move floating point data from one Regiter to another register in Fatek PLC.?
Replies
0
Views
1,550
Back
Top Bottom