Omron CP1L multiplying

BAT

Member
Join Date
Sep 2021
Location
Rogaland
Posts
5
Hi!
Newbie here...
Cx-programmer
CP1L PLC
NB7 HMI

I want to multiply something i by 1,5 in CX-Programmer to get a higher number to use in HMI.

Example:
-I have a 4...20mA scaling in a function block that gives me the GRAPH with +0...+1000.
-I want the output in the function block to be multiplied by 1,5 after scaling is done.
-So that when output is ex 500 my sourceword is 750, and when output is 1000 i have sourceword 1500

I might be dumb, but I am in a learning process
 
Welcome to the forum.

I see there are several multiply instructions in CP1L; see here: https://assets.omron.eu/downloads/manual/en/v1/w451_cp1_cpu_unit_programming_manual_en.pdf#G10.33720

and here: https://assets.omron.eu/downloads/manual/en/v1/w451_cp1_cpu_unit_programming_manual_en.pdf#G11.57824

and here: https://assets.omron.eu/downloads/m....DOUBLE.FLOATINGPOINT.MULTIPLY.D847.CS1H.Only

But we don't really have enough information to answer the question e.g.

  • Do you want to change (overwrite the 50% larger product to) the output value of the scaling function block itself, or do you want to write the product to a new location?
  • What type of data are being multiplied, single or double, signed or unsigned, binary or BCD or floating point?
If you make a screen dump of the relevant section of the program, and annotate it to answer the questions above, it might help get a better answer.
 
Thanks for Reply!

See picture. This is what I want, but I get the wrong result word. I have tried with other numbers in the "first multiplier word" too.

* and *D Will not let me use "," in my numbers. Meaning no decimals.

-I want to write it to another position. You can see I take one word, and multiply it by a constant, and want a result word for further use.
-I think you get the other answer on the picture aswell

1.png
 
Have you tried

  • 1.5
instead of

  • 1,5
?

Also, the multiplicand appears to be an integer, the [*F] instruction might require casting it to a floating-point value, and you can then then cast the floating-point result from [*F] back to an integer; this approach would take three instructions.

Another approach that needs only two instructions would be to use a signed multiply by 3, then a signed divide by 2.
 
Last edited:
"Another approach that needs only two instructions would be to use a signed multiply by 3, then a signed divide by 2."


This worked ofc!
Thank you for just doing it simple(y)
 
I am glad that worked out!

TL;DR

Another way to express 1,5 without commas or decimal points is 15e-1

Although given the example, where F* takes arguments of 1000 and 1,5 multiplies them, and gives a result of 750, makes me wonder what else is wrong with that processor/language/brand of plcs.

Or maybe the problem was using an integer value for the multiplicand and/or product in a floating-point instruction; in a CX-Programmer manual, I found this:

xxx.png
 
Last edited:
Most PLC's to do floating point maths you must make the two variables into floats. so for example if you have a raw analogue this would probably be a 0-32000 or what ever, convert it to a float (some call it a real) then do the maths.
Using PLC's like Omron & Mitsubishi where the registers are 16 bit floats use 2 16 bit registers, I do know that Mitsubishi will not compile if using symbols that have been declared as integers or words in a floating point maths function, however, using direct registers like D100 will assume the float value would be in D100 & D101, so it will compile but give the wrong answer.
 

Similar Topics

Hi everyone! I have an issue with some Omron CP1L-E PLC's. They're connected to get the info from production machines, but I've noticed that...
Replies
2
Views
1,122
Hi! Omron CP1L. CX Programmer. How do I fix so that a CNTRX(548) remembers the count it had before a power failure? I need to know how many...
Replies
3
Views
1,365
Hi all, I've been upgrading some machines recently which involves installing a 10" NB HMI, HUB and a CP1L-E to avail of the built-in ethernet...
Replies
0
Views
1,676
Hi, is someone experiment connecting a Omron plc CP1L with a Siemens HMI TP1200?, i've installed the drivers in WinCC , plc options is just CS1 or...
Replies
0
Views
1,887
Hi all, Does anyone know if you can have a CP1L CPU communicate with two NB HMIs via an Ethernet switch. Both HMIs would have different functions...
Replies
2
Views
1,442
Back
Top Bottom